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.
14882 14883 14884 14885 14886 14887 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14882 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.
14880 14881 14882 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14880 def deliveries @deliveries end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
14880 14881 14882 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14880 def destination @destination end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
14893 14894 14895 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14893 def copy(incoming={}) QuoteEstimate.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
14897 14898 14899 14900 14901 14902 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14897 def to_hash { :destination => destination.to_hash, :deliveries => deliveries.map { |o| o.to_hash } } end |
#to_json ⇒ Object
14889 14890 14891 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14889 def to_json JSON.dump(to_hash) end |