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.
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#preference ⇒ Object
readonly
Returns the value of attribute preference.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#shipping_configuration ⇒ Object
readonly
Returns the value of attribute shipping_configuration.
-
#strategy ⇒ Object
readonly
Returns the value of attribute strategy.
-
#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.
49331 49332 49333 49334 49335 49336 49337 49338 49339 49340 49341 49342 49343 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49331 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :shipping_configuration, :region, :centers, :tiers, :query], '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::ExpandableCenter) ? x : ::Io::Flow::V0::Models::ExpandableCenter.from_json(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)) } @query = (x = opts.delete(:query); x.is_a?(::Io::Flow::V0::Models::Query) ? x : ::Io::Flow::V0::Models::Query.new(x)) @strategy = (x = (x = opts.delete(:strategy); x.nil? ? "oldest" : x); x.is_a?(::Io::Flow::V0::Models::LaneStrategy) ? x : ::Io::Flow::V0::Models::LaneStrategy.apply(x)) @direction = (x = opts.delete(:direction); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::LaneDirection) ? x : ::Io::Flow::V0::Models::LaneDirection.apply(x))) @preference = (x = opts.delete(:preference); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::LanePreselectPreference) ? x : ::Io::Flow::V0::Models::LanePreselectPreference.apply(x))) end |
Instance Attribute Details
#centers ⇒ Object (readonly)
Returns the value of attribute centers.
49329 49330 49331 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49329 def centers @centers end |
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
49329 49330 49331 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49329 def direction @direction end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
49329 49330 49331 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49329 def id @id end |
#preference ⇒ Object (readonly)
Returns the value of attribute preference.
49329 49330 49331 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49329 def preference @preference end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
49329 49330 49331 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49329 def query @query end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
49329 49330 49331 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49329 def region @region end |
#shipping_configuration ⇒ Object (readonly)
Returns the value of attribute shipping_configuration.
49329 49330 49331 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49329 def shipping_configuration @shipping_configuration end |
#strategy ⇒ Object (readonly)
Returns the value of attribute strategy.
49329 49330 49331 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49329 def strategy @strategy end |
#tiers ⇒ Object (readonly)
Returns the value of attribute tiers.
49329 49330 49331 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49329 def tiers @tiers end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
49349 49350 49351 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49349 def copy(incoming={}) ShippingLane.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
49353 49354 49355 49356 49357 49358 49359 49360 49361 49362 49363 49364 49365 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49353 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 }, :query => query.to_hash, :strategy => strategy.value, :direction => direction.nil? ? nil : direction.value, :preference => preference.nil? ? nil : preference.value } end |
#to_json ⇒ Object
49345 49346 49347 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49345 def to_json JSON.dump(to_hash) end |