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.
56591 56592 56593 56594 56595 56596 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56591 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.
56589 56590 56591 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56589 def item @item end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
56589 56590 56591 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56589 def quantity @quantity end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
56602 56603 56604 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56602 def copy(incoming={}) ReservationItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
56606 56607 56608 56609 56610 56611 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56606 def to_hash { :item => item.to_hash, :quantity => quantity } end |
#to_json ⇒ Object
56598 56599 56600 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56598 def to_json JSON.dump(to_hash) end |