Class: Io::Flow::V0::Models::PeakSurchargeByWeightServiceFee
- Inherits:
-
ServiceFee
- Object
- ServiceFee
- Io::Flow::V0::Models::PeakSurchargeByWeightServiceFee
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#ends_at ⇒ Object
readonly
Returns the value of attribute ends_at.
-
#regions ⇒ Object
readonly
Returns the value of attribute regions.
-
#starts_at ⇒ Object
readonly
Returns the value of attribute starts_at.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Attributes inherited from ServiceFee
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ PeakSurchargeByWeightServiceFee
constructor
A new instance of PeakSurchargeByWeightServiceFee.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from ServiceFee
Constructor Details
#initialize(incoming = {}) ⇒ PeakSurchargeByWeightServiceFee
Returns a new instance of PeakSurchargeByWeightServiceFee.
59430 59431 59432 59433 59434 59435 59436 59437 59438 59439 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59430 def initialize(incoming={}) super(:discriminator => ServiceFee::Types::PEAK_SURCHARGE_BY_WEIGHT_SERVICE_FEE) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:amount, :weight], 'PeakSurchargeByWeightServiceFee') @amount = (x = opts.delete(:amount); x.is_a?(::Io::Flow::V0::Models::Money) ? x : ::Io::Flow::V0::Models::Money.new(x)) @weight = (x = opts.delete(:weight); x.is_a?(::Io::Flow::V0::Models::FeeWeight) ? x : ::Io::Flow::V0::Models::FeeWeight.new(x)) @regions = (x = opts.delete(:regions); x.nil? ? nil : HttpClient::Preconditions.assert_class('regions', x, Array).map { |v| HttpClient::Preconditions.assert_class('regions', v, String) }) @starts_at = (x = opts.delete(:starts_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('starts_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) @ends_at = (x = opts.delete(:ends_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('ends_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
59428 59429 59430 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59428 def amount @amount end |
#ends_at ⇒ Object (readonly)
Returns the value of attribute ends_at.
59428 59429 59430 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59428 def ends_at @ends_at end |
#regions ⇒ Object (readonly)
Returns the value of attribute regions.
59428 59429 59430 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59428 def regions @regions end |
#starts_at ⇒ Object (readonly)
Returns the value of attribute starts_at.
59428 59429 59430 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59428 def starts_at @starts_at end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
59428 59429 59430 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59428 def weight @weight end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
59445 59446 59447 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59445 def copy(incoming={}) PeakSurchargeByWeightServiceFee.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
59449 59450 59451 59452 59453 59454 59455 59456 59457 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59449 def subtype_to_hash { :amount => amount.to_hash, :weight => weight.to_hash, :regions => regions.nil? ? nil : regions, :starts_at => starts_at, :ends_at => ends_at } end |
#to_json ⇒ Object
59441 59442 59443 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59441 def to_json JSON.dump(to_hash) end |