Class: Io::Flow::V0::Models::ReservationItem
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ReservationItem
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ReservationItem
constructor
A new instance of ReservationItem.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ReservationItem
Returns a new instance of ReservationItem.
37359 37360 37361 37362 37363 37364 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37359 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:item, :quantity], 'ReservationItem') @item = (x = opts.delete(:item); x.is_a?(::Io::Flow::V0::Models::ReservationItemReference) ? x : ::Io::Flow::V0::Models::ReservationItemReference.new(x)) @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer) end |
Instance Attribute Details
#item ⇒ Object (readonly)
Returns the value of attribute item.
37357 37358 37359 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37357 def item @item end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
37357 37358 37359 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37357 def quantity @quantity end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
37370 37371 37372 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37370 def copy(incoming={}) ReservationItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
37374 37375 37376 37377 37378 37379 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37374 def to_hash { :item => item.to_hash, :quantity => quantity } end |
#to_json ⇒ Object
37366 37367 37368 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37366 def to_json JSON.dump(to_hash) end |