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.
-
#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.
-
#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.
38851 38852 38853 38854 38855 38856 38857 38858 38859 38860 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38851 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)) end |
Instance Attribute Details
#centers ⇒ Object (readonly)
Returns the value of attribute centers.
38849 38850 38851 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38849 def centers @centers end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
38849 38850 38851 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38849 def id @id end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
38849 38850 38851 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38849 def query @query end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
38849 38850 38851 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38849 def region @region end |
#shipping_configuration ⇒ Object (readonly)
Returns the value of attribute shipping_configuration.
38849 38850 38851 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38849 def shipping_configuration @shipping_configuration end |
#tiers ⇒ Object (readonly)
Returns the value of attribute tiers.
38849 38850 38851 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38849 def tiers @tiers end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
38866 38867 38868 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38866 def copy(incoming={}) ShippingLane.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
38870 38871 38872 38873 38874 38875 38876 38877 38878 38879 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38870 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 } end |
#to_json ⇒ Object
38862 38863 38864 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38862 def to_json JSON.dump(to_hash) end |