Class: Io::Flow::V0::Models::InventoryBackorder
- Inherits:
-
InventoryStrategy
- Object
- InventoryStrategy
- Io::Flow::V0::Models::InventoryBackorder
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Enables backorders, setting an optional number of units that we allow for backorder. For example, a backorder w/ quantity 10 will enable selling until the actual inventory quantity is -10.
Instance Attribute Summary collapse
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
Attributes inherited from InventoryStrategy
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ InventoryBackorder
constructor
A new instance of InventoryBackorder.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from InventoryStrategy
Constructor Details
#initialize(incoming = {}) ⇒ InventoryBackorder
Returns a new instance of InventoryBackorder.
20582 20583 20584 20585 20586 20587 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20582 def initialize(incoming={}) super(:discriminator => InventoryStrategy::Types::INVENTORY_BACKORDER) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:quantity], 'InventoryBackorder') @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer) end |
Instance Attribute Details
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
20580 20581 20582 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20580 def quantity @quantity end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
20593 20594 20595 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20593 def copy(incoming={}) InventoryBackorder.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
20597 20598 20599 20600 20601 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20597 def subtype_to_hash { :quantity => quantity } end |
#to_json ⇒ Object
20589 20590 20591 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20589 def to_json JSON.dump(to_hash) end |