class Io::Flow::V0::Models::RatecardEstimateForm

Attributes

center_id[R]
delivered_duty[R]
depth[R]
destination_address[R]
distance_unit[R]
length[R]
line_items[R]
origin_address[R]
service[R]
weight[R]
weight_unit[R]
width[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 61903
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:origin_address, :destination_address], 'RatecardEstimateForm')
  @origin_address = (x = opts.delete(:origin_address); x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x))
  @destination_address = (x = opts.delete(:destination_address); x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x))
  @weight_unit = (x = opts.delete(:weight_unit); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::UnitOfMeasurement) ? x : ::Io::Flow::V0::Models::UnitOfMeasurement.apply(x)))
  @distance_unit = (x = opts.delete(:distance_unit); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::UnitOfMeasurement) ? x : ::Io::Flow::V0::Models::UnitOfMeasurement.apply(x)))
  @service = (x = opts.delete(:service); x.nil? ? nil : HttpClient::Preconditions.assert_class('service', x, String))
  @weight = (x = opts.delete(:weight); x.nil? ? nil : HttpClient::Preconditions.assert_class('weight', x, Numeric))
  @length = (x = opts.delete(:length); x.nil? ? nil : HttpClient::Preconditions.assert_class('length', x, Numeric))
  @width = (x = opts.delete(:width); x.nil? ? nil : HttpClient::Preconditions.assert_class('width', x, Numeric))
  @depth = (x = opts.delete(:depth); x.nil? ? nil : HttpClient::Preconditions.assert_class('depth', x, Numeric))
  @delivered_duty = (x = opts.delete(:delivered_duty); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::DeliveredDuty) ? x : ::Io::Flow::V0::Models::DeliveredDuty.apply(x)))
  @line_items = (x = opts.delete(:line_items); x.nil? ? nil : HttpClient::Preconditions.assert_class('line_items', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::LineItemForm) ? x : ::Io::Flow::V0::Models::LineItemForm.new(x)) })
  @center_id = (x = opts.delete(:center_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('center_id', x, String))
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 61924
def copy(incoming={})
  RatecardEstimateForm.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 61928
def to_hash
  {
    :origin_address => origin_address.to_hash,
    :destination_address => destination_address.to_hash,
    :weight_unit => weight_unit.nil? ? nil : weight_unit.value,
    :distance_unit => distance_unit.nil? ? nil : distance_unit.value,
    :service => service,
    :weight => weight,
    :length => length,
    :width => width,
    :depth => depth,
    :delivered_duty => delivered_duty.nil? ? nil : delivered_duty.value,
    :line_items => line_items.nil? ? nil : line_items.map { |o| o.to_hash },
    :center_id => center_id
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 61920
def to_json
  JSON.dump(to_hash)
end