Class: Io::Flow::V0::Models::ShippingConfigurationItemShippingPricing

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

Overview

Denormalized shipping pricing available for a customer of an item in a shipping configuration for a destination region.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ShippingConfigurationItemShippingPricing

Returns a new instance of ShippingConfigurationItemShippingPricing.



66191
66192
66193
66194
66195
66196
66197
66198
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66191

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :item, :shipping_configuration, :country_shipping_pricings], 'ShippingConfigurationItemShippingPricing')
  @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))
  @country_shipping_pricings = HttpClient::Preconditions.assert_class('country_shipping_pricings', opts.delete(:country_shipping_pricings), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::CountryShippingPricing) ? x : ::Io::Flow::V0::Models::CountryShippingPricing.new(x)) }
end

Instance Attribute Details

#country_shipping_pricingsObject (readonly)

Returns the value of attribute country_shipping_pricings.



66189
66190
66191
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66189

def country_shipping_pricings
  @country_shipping_pricings
end

#idObject (readonly)

Returns the value of attribute id.



66189
66190
66191
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66189

def id
  @id
end

#itemObject (readonly)

Returns the value of attribute item.



66189
66190
66191
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66189

def item
  @item
end

#shipping_configurationObject (readonly)

Returns the value of attribute shipping_configuration.



66189
66190
66191
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66189

def shipping_configuration
  @shipping_configuration
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



66204
66205
66206
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66204

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

#to_hashObject



66208
66209
66210
66211
66212
66213
66214
66215
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66208

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

#to_jsonObject



66200
66201
66202
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66200

def to_json
  JSON.dump(to_hash)
end