Class: Io::Flow::V0::Models::ShippingConfiguration
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ShippingConfiguration
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#shipping_lanes ⇒ Object
readonly
Returns the value of attribute shipping_lanes.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ShippingConfiguration
constructor
A new instance of ShippingConfiguration.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ShippingConfiguration
Returns a new instance of ShippingConfiguration.
38952 38953 38954 38955 38956 38957 38958 38959 38960 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38952 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :name, :key, :type, :shipping_lanes], 'ShippingConfiguration') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String) @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::ShippingConfigurationType) ? x : ::Io::Flow::V0::Models::ShippingConfigurationType.apply(x)) @shipping_lanes = HttpClient::Preconditions.assert_class('shipping_lanes', opts.delete(:shipping_lanes), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ShippingLane) ? x : ::Io::Flow::V0::Models::ShippingLane.new(x)) } end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
38950 38951 38952 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38950 def id @id end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
38950 38951 38952 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38950 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
38950 38951 38952 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38950 def name @name end |
#shipping_lanes ⇒ Object (readonly)
Returns the value of attribute shipping_lanes.
38950 38951 38952 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38950 def shipping_lanes @shipping_lanes end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
38950 38951 38952 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38950 def type @type end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
38966 38967 38968 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38966 def copy(incoming={}) ShippingConfiguration.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
38970 38971 38972 38973 38974 38975 38976 38977 38978 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38970 def to_hash { :id => id, :name => name, :key => key, :type => type.value, :shipping_lanes => shipping_lanes.map { |o| o.to_hash } } end |
#to_json ⇒ Object
38962 38963 38964 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38962 def to_json JSON.dump(to_hash) end |