Class: Io::Flow::V0::Models::DeliveryOptionSummary
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::DeliveryOptionSummary
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#cost ⇒ Object
readonly
Returns the value of attribute cost.
-
#delivered_duty ⇒ Object
readonly
Returns the value of attribute delivered_duty.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#tier ⇒ Object
readonly
Returns the value of attribute tier.
-
#window ⇒ Object
readonly
Returns the value of attribute window.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ DeliveryOptionSummary
constructor
A new instance of DeliveryOptionSummary.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ DeliveryOptionSummary
Returns a new instance of DeliveryOptionSummary.
39132 39133 39134 39135 39136 39137 39138 39139 39140 39141 39142 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39132 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :cost, :delivered_duty, :price, :service, :tier, :window], 'DeliveryOptionSummary') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @cost = (x = opts.delete(:cost); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)) @delivered_duty = (x = opts.delete(:delivered_duty); x.is_a?(::Io::Flow::V0::Models::DeliveredDuty) ? x : ::Io::Flow::V0::Models::DeliveredDuty.apply(x)) @price = (x = opts.delete(:price); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)) @service = (x = opts.delete(:service); x.is_a?(::Io::Flow::V0::Models::ServiceReference) ? x : ::Io::Flow::V0::Models::ServiceReference.new(x)) @tier = (x = opts.delete(:tier); x.is_a?(::Io::Flow::V0::Models::TierReference) ? x : ::Io::Flow::V0::Models::TierReference.new(x)) @window = (x = opts.delete(:window); x.is_a?(::Io::Flow::V0::Models::DatetimeRange) ? x : ::Io::Flow::V0::Models::DatetimeRange.new(x)) end |
Instance Attribute Details
#cost ⇒ Object (readonly)
Returns the value of attribute cost.
39130 39131 39132 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39130 def cost @cost end |
#delivered_duty ⇒ Object (readonly)
Returns the value of attribute delivered_duty.
39130 39131 39132 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39130 def delivered_duty @delivered_duty end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
39130 39131 39132 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39130 def id @id end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
39130 39131 39132 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39130 def price @price end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
39130 39131 39132 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39130 def service @service end |
#tier ⇒ Object (readonly)
Returns the value of attribute tier.
39130 39131 39132 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39130 def tier @tier end |
#window ⇒ Object (readonly)
Returns the value of attribute window.
39130 39131 39132 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39130 def window @window end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
39148 39149 39150 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39148 def copy(incoming={}) DeliveryOptionSummary.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
39152 39153 39154 39155 39156 39157 39158 39159 39160 39161 39162 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39152 def to_hash { :id => id, :cost => cost.to_hash, :delivered_duty => delivered_duty.value, :price => price.to_hash, :service => service.to_hash, :tier => tier.to_hash, :window => window.to_hash } end |
#to_json ⇒ Object
39144 39145 39146 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39144 def to_json JSON.dump(to_hash) end |