Class: Io::Flow::V0::Models::DeliveryOption
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::DeliveryOption
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents a way to fulfill a delivery, including an estimates for the date range and cost
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.
-
#rule_outcome ⇒ Object
readonly
Returns the value of attribute rule_outcome.
-
#send_to ⇒ Object
readonly
Returns the value of attribute send_to.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#surcharge ⇒ Object
readonly
Returns the value of attribute surcharge.
-
#tier ⇒ Object
readonly
Returns the value of attribute tier.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
-
#window ⇒ Object
readonly
Returns the value of attribute window.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ DeliveryOption
constructor
A new instance of DeliveryOption.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ DeliveryOption
Returns a new instance of DeliveryOption.
25840 25841 25842 25843 25844 25845 25846 25847 25848 25849 25850 25851 25852 25853 25854 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25840 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :cost, :delivered_duty, :price, :service, :tier, :window], 'DeliveryOption') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @cost = (x = opts.delete(:cost); x.is_a?(::Io::Flow::V0::Models::PriceWithBaseAndDetails) ? x : ::Io::Flow::V0::Models::PriceWithBaseAndDetails.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::PriceWithBaseAndDetails) ? x : ::Io::Flow::V0::Models::PriceWithBaseAndDetails.new(x)) @service = (x = opts.delete(:service); x.is_a?(::Io::Flow::V0::Models::ServiceSummary) ? x : ::Io::Flow::V0::Models::ServiceSummary.new(x)) @tier = (x = opts.delete(:tier); x.is_a?(::Io::Flow::V0::Models::TierSummary) ? x : ::Io::Flow::V0::Models::TierSummary.new(x)) @window = (x = opts.delete(:window); x.is_a?(::Io::Flow::V0::Models::DeliveryWindow) ? x : ::Io::Flow::V0::Models::DeliveryWindow.new(x)) @rule_outcome = (x = opts.delete(:rule_outcome); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::TierRuleOutcome) ? x : ::Io::Flow::V0::Models::TierRuleOutcome.from_json(x))) @weight = (x = opts.delete(:weight); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OptionWeightEstimates) ? x : ::Io::Flow::V0::Models::OptionWeightEstimates.new(x))) @send_to = (x = opts.delete(:send_to); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x))) @surcharge = (x = opts.delete(:surcharge); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PriceWithBaseAndDetails) ? x : ::Io::Flow::V0::Models::PriceWithBaseAndDetails.new(x))) end |
Instance Attribute Details
#cost ⇒ Object (readonly)
Returns the value of attribute cost.
25838 25839 25840 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25838 def cost @cost end |
#delivered_duty ⇒ Object (readonly)
Returns the value of attribute delivered_duty.
25838 25839 25840 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25838 def delivered_duty @delivered_duty end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
25838 25839 25840 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25838 def id @id end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
25838 25839 25840 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25838 def price @price end |
#rule_outcome ⇒ Object (readonly)
Returns the value of attribute rule_outcome.
25838 25839 25840 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25838 def rule_outcome @rule_outcome end |
#send_to ⇒ Object (readonly)
Returns the value of attribute send_to.
25838 25839 25840 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25838 def send_to @send_to end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
25838 25839 25840 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25838 def service @service end |
#surcharge ⇒ Object (readonly)
Returns the value of attribute surcharge.
25838 25839 25840 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25838 def surcharge @surcharge end |
#tier ⇒ Object (readonly)
Returns the value of attribute tier.
25838 25839 25840 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25838 def tier @tier end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
25838 25839 25840 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25838 def weight @weight end |
#window ⇒ Object (readonly)
Returns the value of attribute window.
25838 25839 25840 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25838 def window @window end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
25860 25861 25862 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25860 def copy(incoming={}) DeliveryOption.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
25864 25865 25866 25867 25868 25869 25870 25871 25872 25873 25874 25875 25876 25877 25878 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25864 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, :rule_outcome => rule_outcome.nil? ? nil : rule_outcome.to_hash, :weight => weight.nil? ? nil : weight.to_hash, :send_to => send_to.nil? ? nil : send_to.to_hash, :surcharge => surcharge.nil? ? nil : surcharge.to_hash } end |
#to_json ⇒ Object
25856 25857 25858 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25856 def to_json JSON.dump(to_hash) end |