Class: Io::Flow::V0::Models::RatecardEstimateForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::RatecardEstimateForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#center_id ⇒ Object
readonly
Returns the value of attribute center_id.
-
#delivered_duty ⇒ Object
readonly
Returns the value of attribute delivered_duty.
-
#depth ⇒ Object
readonly
Returns the value of attribute depth.
-
#destination_address ⇒ Object
readonly
Returns the value of attribute destination_address.
-
#distance_unit ⇒ Object
readonly
Returns the value of attribute distance_unit.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#line_items ⇒ Object
readonly
Returns the value of attribute line_items.
-
#origin_address ⇒ Object
readonly
Returns the value of attribute origin_address.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
-
#weight_unit ⇒ Object
readonly
Returns the value of attribute weight_unit.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ RatecardEstimateForm
constructor
A new instance of RatecardEstimateForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ RatecardEstimateForm
Returns a new instance of RatecardEstimateForm.
61903 61904 61905 61906 61907 61908 61909 61910 61911 61912 61913 61914 61915 61916 61917 61918 |
# 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 |
Instance Attribute Details
#center_id ⇒ Object (readonly)
Returns the value of attribute center_id.
61901 61902 61903 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61901 def center_id @center_id end |
#delivered_duty ⇒ Object (readonly)
Returns the value of attribute delivered_duty.
61901 61902 61903 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61901 def delivered_duty @delivered_duty end |
#depth ⇒ Object (readonly)
Returns the value of attribute depth.
61901 61902 61903 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61901 def depth @depth end |
#destination_address ⇒ Object (readonly)
Returns the value of attribute destination_address.
61901 61902 61903 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61901 def destination_address @destination_address end |
#distance_unit ⇒ Object (readonly)
Returns the value of attribute distance_unit.
61901 61902 61903 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61901 def distance_unit @distance_unit end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
61901 61902 61903 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61901 def length @length end |
#line_items ⇒ Object (readonly)
Returns the value of attribute line_items.
61901 61902 61903 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61901 def line_items @line_items end |
#origin_address ⇒ Object (readonly)
Returns the value of attribute origin_address.
61901 61902 61903 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61901 def origin_address @origin_address end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
61901 61902 61903 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61901 def service @service end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
61901 61902 61903 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61901 def weight @weight end |
#weight_unit ⇒ Object (readonly)
Returns the value of attribute weight_unit.
61901 61902 61903 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61901 def weight_unit @weight_unit end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
61901 61902 61903 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61901 def width @width end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
61924 61925 61926 |
# 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 ⇒ Object
61928 61929 61930 61931 61932 61933 61934 61935 61936 61937 61938 61939 61940 61941 61942 61943 |
# 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 ⇒ Object
61920 61921 61922 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61920 def to_json JSON.dump(to_hash) end |