Class: Io::Flow::V0::Models::ShippingConfigurationItemAvailability

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Denormalized availability status of an item in a shipping configuration for a destination region

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ShippingConfigurationItemAvailability

Returns a new instance of ShippingConfigurationItemAvailability.



66091
66092
66093
66094
66095
66096
66097
66098
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66091

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :item, :shipping_configuration, :availabilities], 'ShippingConfigurationItemAvailability')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @item = (x = opts.delete(:item); x.is_a?(::Io::Flow::V0::Models::ItemReference) ? x : ::Io::Flow::V0::Models::ItemReference.new(x))
  @shipping_configuration = (x = opts.delete(:shipping_configuration); x.is_a?(::Io::Flow::V0::Models::ShippingConfigurationSummary) ? x : ::Io::Flow::V0::Models::ShippingConfigurationSummary.new(x))
  @availabilities = HttpClient::Preconditions.assert_class('availabilities', opts.delete(:availabilities), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::CountryAvailability) ? x : ::Io::Flow::V0::Models::CountryAvailability.new(x)) }
end

Instance Attribute Details

#availabilitiesObject (readonly)

Returns the value of attribute availabilities.



66089
66090
66091
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66089

def availabilities
  @availabilities
end

#idObject (readonly)

Returns the value of attribute id.



66089
66090
66091
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66089

def id
  @id
end

#itemObject (readonly)

Returns the value of attribute item.



66089
66090
66091
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66089

def item
  @item
end

#shipping_configurationObject (readonly)

Returns the value of attribute shipping_configuration.



66089
66090
66091
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66089

def shipping_configuration
  @shipping_configuration
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



66104
66105
66106
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66104

def copy(incoming={})
  ShippingConfigurationItemAvailability.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



66108
66109
66110
66111
66112
66113
66114
66115
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66108

def to_hash
  {
    :id => id,
    :item => item.to_hash,
    :shipping_configuration => shipping_configuration.to_hash,
    :availabilities => availabilities.map { |o| o.to_hash }
  }
end

#to_jsonObject



66100
66101
66102
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66100

def to_json
  JSON.dump(to_hash)
end