Class: Io::Flow::V0::Models::RatecardLaneForm

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ RatecardLaneForm

Returns a new instance of RatecardLaneForm.



46269
46270
46271
46272
46273
46274
46275
46276
46277
46278
46279
46280
46281
46282
46283
46284
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46269

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

#currencyObject (readonly)

Returns the value of attribute currency.



46267
46268
46269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46267

def currency
  @currency
end

#delivered_dutyObject (readonly)

Returns the value of attribute delivered_duty.



46267
46268
46269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46267

def delivered_duty
  @delivered_duty
end

#destinationObject (readonly)

Returns the value of attribute destination.



46267
46268
46269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46267

def destination
  @destination
end

#dim_factorObject (readonly)

Returns the value of attribute dim_factor.



46267
46268
46269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46267

def dim_factor
  @dim_factor
end

#distance_unitObject (readonly)

Returns the value of attribute distance_unit.



46267
46268
46269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46267

def distance_unit
  @distance_unit
end

#feesObject (readonly)

Returns the value of attribute fees.



46267
46268
46269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46267

def fees
  @fees
end

#originObject (readonly)

Returns the value of attribute origin.



46267
46268
46269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46267

def origin
  @origin
end

#ratecard_idObject (readonly)

Returns the value of attribute ratecard_id.



46267
46268
46269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46267

def ratecard_id
  @ratecard_id
end

#ratesObject (readonly)

Returns the value of attribute rates.



46267
46268
46269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46267

def rates
  @rates
end

#roundingObject (readonly)

Returns the value of attribute rounding.



46267
46268
46269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46267

def rounding
  @rounding
end

#shipment_windowObject (readonly)

Returns the value of attribute shipment_window.



46267
46268
46269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46267

def shipment_window
  @shipment_window
end

#weight_unitObject (readonly)

Returns the value of attribute weight_unit.



46267
46268
46269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46267

def weight_unit
  @weight_unit
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



46290
46291
46292
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46290

def copy(incoming={})
  RatecardLaneForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



46294
46295
46296
46297
46298
46299
46300
46301
46302
46303
46304
46305
46306
46307
46308
46309
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46294

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_jsonObject



46286
46287
46288
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46286

def to_json
  JSON.dump(to_hash)
end