Class: Io::Flow::V0::Models::QuoteEstimate
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::QuoteEstimate
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#deliveries ⇒ Object
readonly
Returns the value of attribute deliveries.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ QuoteEstimate
constructor
A new instance of QuoteEstimate.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ QuoteEstimate
Returns a new instance of QuoteEstimate.
16228 16229 16230 16231 16232 16233 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16228 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:destination, :deliveries], 'QuoteEstimate') @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x)) @deliveries = HttpClient::Preconditions.assert_class('deliveries', opts.delete(:deliveries), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::DeliveryEstimate) ? x : ::Io::Flow::V0::Models::DeliveryEstimate.new(x)) } end |
Instance Attribute Details
#deliveries ⇒ Object (readonly)
Returns the value of attribute deliveries.
16226 16227 16228 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16226 def deliveries @deliveries end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
16226 16227 16228 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16226 def destination @destination end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
16239 16240 16241 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16239 def copy(incoming={}) QuoteEstimate.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
16243 16244 16245 16246 16247 16248 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16243 def to_hash { :destination => destination.to_hash, :deliveries => deliveries.map { |o| o.to_hash } } end |
#to_json ⇒ Object
16235 16236 16237 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16235 def to_json JSON.dump(to_hash) end |