class Io::Flow::V0::Models::RatecardLaneImportForm
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.
Attributes
currency[R]
delivered_duty[R]
destination[R]
dim_factor[R]
distance_unit[R]
origin[R]
ratecard_owner[R]
rates[R]
service[R]
shipment_window[R]
weight_unit[R]
Public Class Methods
new(incoming={})
click to toggle source
# 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
Public Instance Methods
copy(incoming={})
click to toggle source
# 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()
click to toggle source
# 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()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 62336 def to_json JSON.dump(to_hash) end