Class: Io::Flow::V0::Models::RatecardEstimateFormV1

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

Instance Attribute Summary collapse

Attributes inherited from RatecardEstimateForm

#discriminator

Instance Method Summary collapse

Methods inherited from RatecardEstimateForm

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ RatecardEstimateFormV1

Returns a new instance of RatecardEstimateFormV1.



46092
46093
46094
46095
46096
46097
46098
46099
46100
46101
46102
46103
46104
46105
46106
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46092

def initialize(incoming={})
  super(:discriminator => RatecardEstimateForm::Types::RATECARD_ESTIMATE_FORM_V1)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  @origin = (x = opts.delete(:origin); x.nil? ? nil : HttpClient::Preconditions.assert_class('origin', x, String))
  @destination = (x = opts.delete(:destination); x.nil? ? nil : HttpClient::Preconditions.assert_class('destination', x, String))
  @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)) })
end

Instance Attribute Details

#delivered_dutyObject (readonly)

Returns the value of attribute delivered_duty.



46090
46091
46092
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46090

def delivered_duty
  @delivered_duty
end

#depthObject (readonly)

Returns the value of attribute depth.



46090
46091
46092
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46090

def depth
  @depth
end

#destinationObject (readonly)

Returns the value of attribute destination.



46090
46091
46092
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46090

def destination
  @destination
end

#distance_unitObject (readonly)

Returns the value of attribute distance_unit.



46090
46091
46092
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46090

def distance_unit
  @distance_unit
end

#lengthObject (readonly)

Returns the value of attribute length.



46090
46091
46092
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46090

def length
  @length
end

#line_itemsObject (readonly)

Returns the value of attribute line_items.



46090
46091
46092
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46090

def line_items
  @line_items
end

#originObject (readonly)

Returns the value of attribute origin.



46090
46091
46092
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46090

def origin
  @origin
end

#serviceObject (readonly)

Returns the value of attribute service.



46090
46091
46092
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46090

def service
  @service
end

#weightObject (readonly)

Returns the value of attribute weight.



46090
46091
46092
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46090

def weight
  @weight
end

#weight_unitObject (readonly)

Returns the value of attribute weight_unit.



46090
46091
46092
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46090

def weight_unit
  @weight_unit
end

#widthObject (readonly)

Returns the value of attribute width.



46090
46091
46092
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46090

def width
  @width
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



46112
46113
46114
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46112

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

#subtype_to_hashObject



46116
46117
46118
46119
46120
46121
46122
46123
46124
46125
46126
46127
46128
46129
46130
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46116

def subtype_to_hash
  {
    :origin => origin,
    :destination => destination,
    :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 }
  }
end

#to_jsonObject



46108
46109
46110
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46108

def to_json
  JSON.dump(to_hash)
end