Class: Io::Flow::V0::Models::RatecardLaneImportForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::RatecardLaneImportForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents a line in a ratecard lane import file to be used with bulk CSV imports of multiple ratecard lanes across different services in a single import file. This would represent a row in each file.
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.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#ratecard_owner ⇒ Object
readonly
Returns the value of attribute ratecard_owner.
-
#rates ⇒ Object
readonly
Returns the value of attribute rates.
-
#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 = {}) ⇒ RatecardLaneImportForm
constructor
A new instance of RatecardLaneImportForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ RatecardLaneImportForm
Returns a new instance of RatecardLaneImportForm.
62320 62321 62322 62323 62324 62325 62326 62327 62328 62329 62330 62331 62332 62333 62334 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62320 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:ratecard_owner, :service, :currency, :delivered_duty, :origin, :destination, :shipment_window, :dim_factor, :weight_unit, :distance_unit, :rates], 'RatecardLaneImportForm') @ratecard_owner = (x = opts.delete(:ratecard_owner); x.is_a?(::Io::Flow::V0::Models::RatecardOwner) ? x : ::Io::Flow::V0::Models::RatecardOwner.apply(x)) @service = HttpClient::Preconditions.assert_class('service', opts.delete(:service), String) @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)) @origin = (x = opts.delete(:origin); x.is_a?(::Io::Flow::V0::Models::Zone) ? x : ::Io::Flow::V0::Models::Zone.new(x)) @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)) @dim_factor = HttpClient::Preconditions.assert_class('dim_factor', HttpClient::Helper.to_big_decimal(opts.delete(:dim_factor)), BigDecimal) @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)) @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)) } end |
Instance Attribute Details
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
62318 62319 62320 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62318 def currency @currency end |
#delivered_duty ⇒ Object (readonly)
Returns the value of attribute delivered_duty.
62318 62319 62320 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62318 def delivered_duty @delivered_duty end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
62318 62319 62320 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62318 def destination @destination end |
#dim_factor ⇒ Object (readonly)
Returns the value of attribute dim_factor.
62318 62319 62320 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62318 def dim_factor @dim_factor end |
#distance_unit ⇒ Object (readonly)
Returns the value of attribute distance_unit.
62318 62319 62320 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62318 def distance_unit @distance_unit end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
62318 62319 62320 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62318 def origin @origin end |
#ratecard_owner ⇒ Object (readonly)
Returns the value of attribute ratecard_owner.
62318 62319 62320 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62318 def ratecard_owner @ratecard_owner end |
#rates ⇒ Object (readonly)
Returns the value of attribute rates.
62318 62319 62320 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62318 def rates @rates end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
62318 62319 62320 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62318 def service @service end |
#shipment_window ⇒ Object (readonly)
Returns the value of attribute shipment_window.
62318 62319 62320 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62318 def shipment_window @shipment_window end |
#weight_unit ⇒ Object (readonly)
Returns the value of attribute weight_unit.
62318 62319 62320 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62318 def weight_unit @weight_unit end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
62340 62341 62342 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62340 def copy(incoming={}) RatecardLaneImportForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
62344 62345 62346 62347 62348 62349 62350 62351 62352 62353 62354 62355 62356 62357 62358 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62344 def to_hash { :ratecard_owner => ratecard_owner.value, :service => service, :currency => currency, :delivered_duty => delivered_duty.value, :origin => origin.to_hash, :destination => destination.to_hash, :shipment_window => shipment_window.to_hash, :dim_factor => dim_factor.to_f.to_s, :weight_unit => weight_unit.value, :distance_unit => distance_unit.value, :rates => rates.map { |o| o.to_hash } } end |
#to_json ⇒ Object
62336 62337 62338 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62336 def to_json JSON.dump(to_hash) end |