Class: Io::Flow::V0::Models::ShippingLane
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ShippingLane
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#centers ⇒ Object
readonly
Returns the value of attribute centers.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#shipping_configuration ⇒ Object
readonly
Returns the value of attribute shipping_configuration.
-
#tiers ⇒ Object
readonly
Returns the value of attribute tiers.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ShippingLane
constructor
A new instance of ShippingLane.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ShippingLane
Returns a new instance of ShippingLane.
35135 35136 35137 35138 35139 35140 35141 35142 35143 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35135 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :shipping_configuration, :region, :centers, :tiers], 'ShippingLane') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @shipping_configuration = (x = opts.delete(:shipping_configuration); x.is_a?(::Io::Flow::V0::Models::ShippingConfigurationReference) ? x : ::Io::Flow::V0::Models::ShippingConfigurationReference.new(x)) @region = HttpClient::Preconditions.assert_class('region', opts.delete(:region), String) @centers = HttpClient::Preconditions.assert_class('centers', opts.delete(:centers), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::CenterReference) ? x : ::Io::Flow::V0::Models::CenterReference.new(x)) } @tiers = HttpClient::Preconditions.assert_class('tiers', opts.delete(:tiers), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::Tier) ? x : ::Io::Flow::V0::Models::Tier.new(x)) } end |
Instance Attribute Details
#centers ⇒ Object (readonly)
Returns the value of attribute centers.
35133 35134 35135 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35133 def centers @centers end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
35133 35134 35135 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35133 def id @id end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
35133 35134 35135 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35133 def region @region end |
#shipping_configuration ⇒ Object (readonly)
Returns the value of attribute shipping_configuration.
35133 35134 35135 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35133 def shipping_configuration @shipping_configuration end |
#tiers ⇒ Object (readonly)
Returns the value of attribute tiers.
35133 35134 35135 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35133 def tiers @tiers end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
35149 35150 35151 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35149 def copy(incoming={}) ShippingLane.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
35153 35154 35155 35156 35157 35158 35159 35160 35161 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35153 def to_hash { :id => id, :shipping_configuration => shipping_configuration.to_hash, :region => region, :centers => centers.map { |o| o.to_hash }, :tiers => tiers.map { |o| o.to_hash } } end |
#to_json ⇒ Object
35145 35146 35147 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35145 def to_json JSON.dump(to_hash) end |