Class: Io::Flow::V0::Models::RatecardLaneForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::RatecardLaneForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#delivered_duty ⇒ Object
readonly
Returns the value of attribute delivered_duty.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#dim_factor ⇒ Object
readonly
Returns the value of attribute dim_factor.
-
#distance_unit ⇒ Object
readonly
Returns the value of attribute distance_unit.
-
#fees ⇒ Object
readonly
Returns the value of attribute fees.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#ratecard_id ⇒ Object
readonly
Returns the value of attribute ratecard_id.
-
#rates ⇒ Object
readonly
Returns the value of attribute rates.
-
#rounding ⇒ Object
readonly
Returns the value of attribute rounding.
-
#shipment_window ⇒ Object
readonly
Returns the value of attribute shipment_window.
-
#weight_unit ⇒ Object
readonly
Returns the value of attribute weight_unit.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ RatecardLaneForm
constructor
A new instance of RatecardLaneForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ RatecardLaneForm
Returns a new instance of RatecardLaneForm.
55064 55065 55066 55067 55068 55069 55070 55071 55072 55073 55074 55075 55076 55077 55078 55079 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55064 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:ratecard_id, :currency, :destination, :shipment_window, :delivered_duty, :dim_factor, :fees, :origin, :rounding, :rates, :weight_unit, :distance_unit], 'RatecardLaneForm') @ratecard_id = HttpClient::Preconditions.assert_class('ratecard_id', opts.delete(:ratecard_id), String) @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String) @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::Zone) ? x : ::Io::Flow::V0::Models::Zone.new(x)) @shipment_window = (x = opts.delete(:shipment_window); x.is_a?(::Io::Flow::V0::Models::ShipmentWindow) ? x : ::Io::Flow::V0::Models::ShipmentWindow.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)) @dim_factor = HttpClient::Preconditions.assert_class('dim_factor', opts.delete(:dim_factor), Numeric) @fees = HttpClient::Preconditions.assert_class('fees', opts.delete(:fees), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::RatecardFee) ? x : ::Io::Flow::V0::Models::RatecardFee.from_json(x)) } @origin = (x = opts.delete(:origin); x.is_a?(::Io::Flow::V0::Models::Zone) ? x : ::Io::Flow::V0::Models::Zone.new(x)) @rounding = (x = opts.delete(:rounding); x.is_a?(::Io::Flow::V0::Models::Rounding) ? x : ::Io::Flow::V0::Models::Rounding.new(x)) @rates = HttpClient::Preconditions.assert_class('rates', opts.delete(:rates), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::RatecardRateForm) ? x : ::Io::Flow::V0::Models::RatecardRateForm.new(x)) } @weight_unit = (x = opts.delete(:weight_unit); x.is_a?(::Io::Flow::V0::Models::UnitOfMeasurement) ? x : ::Io::Flow::V0::Models::UnitOfMeasurement.apply(x)) @distance_unit = (x = opts.delete(:distance_unit); x.is_a?(::Io::Flow::V0::Models::UnitOfMeasurement) ? x : ::Io::Flow::V0::Models::UnitOfMeasurement.apply(x)) end |
Instance Attribute Details
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
55062 55063 55064 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55062 def currency @currency end |
#delivered_duty ⇒ Object (readonly)
Returns the value of attribute delivered_duty.
55062 55063 55064 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55062 def delivered_duty @delivered_duty end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
55062 55063 55064 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55062 def destination @destination end |
#dim_factor ⇒ Object (readonly)
Returns the value of attribute dim_factor.
55062 55063 55064 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55062 def dim_factor @dim_factor end |
#distance_unit ⇒ Object (readonly)
Returns the value of attribute distance_unit.
55062 55063 55064 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55062 def distance_unit @distance_unit end |
#fees ⇒ Object (readonly)
Returns the value of attribute fees.
55062 55063 55064 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55062 def fees @fees end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
55062 55063 55064 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55062 def origin @origin end |
#ratecard_id ⇒ Object (readonly)
Returns the value of attribute ratecard_id.
55062 55063 55064 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55062 def ratecard_id @ratecard_id end |
#rates ⇒ Object (readonly)
Returns the value of attribute rates.
55062 55063 55064 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55062 def rates @rates end |
#rounding ⇒ Object (readonly)
Returns the value of attribute rounding.
55062 55063 55064 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55062 def rounding @rounding end |
#shipment_window ⇒ Object (readonly)
Returns the value of attribute shipment_window.
55062 55063 55064 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55062 def shipment_window @shipment_window end |
#weight_unit ⇒ Object (readonly)
Returns the value of attribute weight_unit.
55062 55063 55064 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55062 def weight_unit @weight_unit end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
55085 55086 55087 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55085 def copy(incoming={}) RatecardLaneForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
55089 55090 55091 55092 55093 55094 55095 55096 55097 55098 55099 55100 55101 55102 55103 55104 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55089 def to_hash { :ratecard_id => ratecard_id, :currency => currency, :destination => destination.to_hash, :shipment_window => shipment_window.to_hash, :delivered_duty => delivered_duty.value, :dim_factor => dim_factor, :fees => fees.map { |o| o.to_hash }, :origin => origin.to_hash, :rounding => rounding.to_hash, :rates => rates.map { |o| o.to_hash }, :weight_unit => weight_unit.value, :distance_unit => distance_unit.value } end |
#to_json ⇒ Object
55081 55082 55083 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55081 def to_json JSON.dump(to_hash) end |