Class: Io::Flow::V0::Models::RatecardLane
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::RatecardLane
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Describe list of rates applicable for a lane on the ratecard - defined by origin and destination zone
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.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#ratecard ⇒ Object
readonly
Returns the value of attribute ratecard.
-
#rates ⇒ Object
readonly
Returns the value of attribute rates.
-
#rounding ⇒ Object
readonly
Returns the value of attribute rounding.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#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 = {}) ⇒ RatecardLane
constructor
A new instance of RatecardLane.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ RatecardLane
Returns a new instance of RatecardLane.
57491 57492 57493 57494 57495 57496 57497 57498 57499 57500 57501 57502 57503 57504 57505 57506 57507 57508 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57491 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :ratecard, :currency, :delivered_duty, :shipment_window, :destination, :dim_factor, :fees, :origin, :service, :rates, :rounding, :weight_unit, :distance_unit], 'RatecardLane') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @ratecard = (x = opts.delete(:ratecard); x.is_a?(::Io::Flow::V0::Models::RatecardSummary) ? x : ::Io::Flow::V0::Models::RatecardSummary.new(x)) @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String) @delivered_duty = (x = opts.delete(:delivered_duty); x.is_a?(::Io::Flow::V0::Models::DeliveredDuty) ? x : ::Io::Flow::V0::Models::DeliveredDuty.apply(x)) @shipment_window = (x = opts.delete(:shipment_window); x.is_a?(::Io::Flow::V0::Models::ShipmentWindow) ? x : ::Io::Flow::V0::Models::ShipmentWindow.new(x)) @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::Zone) ? x : ::Io::Flow::V0::Models::Zone.new(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)) @service = (x = opts.delete(:service); x.is_a?(::Io::Flow::V0::Models::RatecardServiceSummary) ? x : ::Io::Flow::V0::Models::RatecardServiceSummary.new(x)) @rates = HttpClient::Preconditions.assert_class('rates', opts.delete(:rates), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::RatecardRate) ? x : ::Io::Flow::V0::Models::RatecardRate.new(x)) } @rounding = (x = opts.delete(:rounding); x.is_a?(::Io::Flow::V0::Models::Rounding) ? x : ::Io::Flow::V0::Models::Rounding.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.
57489 57490 57491 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57489 def currency @currency end |
#delivered_duty ⇒ Object (readonly)
Returns the value of attribute delivered_duty.
57489 57490 57491 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57489 def delivered_duty @delivered_duty end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
57489 57490 57491 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57489 def destination @destination end |
#dim_factor ⇒ Object (readonly)
Returns the value of attribute dim_factor.
57489 57490 57491 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57489 def dim_factor @dim_factor end |
#distance_unit ⇒ Object (readonly)
Returns the value of attribute distance_unit.
57489 57490 57491 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57489 def distance_unit @distance_unit end |
#fees ⇒ Object (readonly)
Returns the value of attribute fees.
57489 57490 57491 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57489 def fees @fees end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
57489 57490 57491 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57489 def id @id end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
57489 57490 57491 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57489 def origin @origin end |
#ratecard ⇒ Object (readonly)
Returns the value of attribute ratecard.
57489 57490 57491 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57489 def ratecard @ratecard end |
#rates ⇒ Object (readonly)
Returns the value of attribute rates.
57489 57490 57491 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57489 def rates @rates end |
#rounding ⇒ Object (readonly)
Returns the value of attribute rounding.
57489 57490 57491 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57489 def rounding @rounding end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
57489 57490 57491 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57489 def service @service end |
#shipment_window ⇒ Object (readonly)
Returns the value of attribute shipment_window.
57489 57490 57491 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57489 def shipment_window @shipment_window end |
#weight_unit ⇒ Object (readonly)
Returns the value of attribute weight_unit.
57489 57490 57491 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57489 def weight_unit @weight_unit end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
57514 57515 57516 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57514 def copy(incoming={}) RatecardLane.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
57518 57519 57520 57521 57522 57523 57524 57525 57526 57527 57528 57529 57530 57531 57532 57533 57534 57535 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57518 def to_hash { :id => id, :ratecard => ratecard.to_hash, :currency => currency, :delivered_duty => delivered_duty.value, :shipment_window => shipment_window.to_hash, :destination => destination.to_hash, :dim_factor => dim_factor, :fees => fees.map { |o| o.to_hash }, :origin => origin.to_hash, :service => service.to_hash, :rates => rates.map { |o| o.to_hash }, :rounding => rounding.to_hash, :weight_unit => weight_unit.value, :distance_unit => distance_unit.value } end |
#to_json ⇒ Object
57510 57511 57512 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57510 def to_json JSON.dump(to_hash) end |