Class: Io::Flow::V0::Models::ItemAvailabilityStatus
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ItemAvailabilityStatus
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
- .ALL ⇒ Object
-
.apply(value) ⇒ Object
Returns the instance of ItemAvailabilityStatus for this value, creating a new instance for an unknown value.
-
.available ⇒ Object
Inventory is generally available for purchase.
-
.from_string(value) ⇒ Object
Returns the instance of ItemAvailabilityStatus for this value, or nil if not found.
-
.low ⇒ Object
Inventory is low and may soon become unavailable for purchase (# inventory items <= 5).
-
.out_of_stock ⇒ Object
There is no inventory available and is not available for purchase.
Instance Method Summary collapse
-
#initialize(value) ⇒ ItemAvailabilityStatus
constructor
A new instance of ItemAvailabilityStatus.
- #to_hash ⇒ Object
Constructor Details
#initialize(value) ⇒ ItemAvailabilityStatus
Returns a new instance of ItemAvailabilityStatus.
21725 21726 21727 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21725 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
21723 21724 21725 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21723 def value @value end |
Class Method Details
.ALL ⇒ Object
21745 21746 21747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21745 def ItemAvailabilityStatus.ALL @@all ||= [ItemAvailabilityStatus.available, ItemAvailabilityStatus.low, ItemAvailabilityStatus.out_of_stock] end |
.apply(value) ⇒ Object
Returns the instance of ItemAvailabilityStatus for this value, creating a new instance for an unknown value
21730 21731 21732 21733 21734 21735 21736 21737 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21730 def ItemAvailabilityStatus.apply(value) if value.instance_of?(ItemAvailabilityStatus) value else HttpClient::Preconditions.assert_class_or_nil('value', value, String) value.nil? ? nil : (from_string(value) || ItemAvailabilityStatus.new(value)) end end |
.available ⇒ Object
Inventory is generally available for purchase
21750 21751 21752 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21750 def ItemAvailabilityStatus.available @@_available ||= ItemAvailabilityStatus.new('available') end |
.from_string(value) ⇒ Object
Returns the instance of ItemAvailabilityStatus for this value, or nil if not found
21740 21741 21742 21743 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21740 def ItemAvailabilityStatus.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) ItemAvailabilityStatus.ALL.find { |v| v.value == value } end |
.low ⇒ Object
Inventory is low and may soon become unavailable for purchase (# inventory items <= 5). Unless there is a specific use case for low inventory, it can be treated the same as ‘available’
21757 21758 21759 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21757 def ItemAvailabilityStatus.low @@_low ||= ItemAvailabilityStatus.new('low') end |
.out_of_stock ⇒ Object
There is no inventory available and is not available for purchase. Sample actions that can be taken are hiding the item or marking as ‘sold out` on the frontend
21764 21765 21766 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21764 def ItemAvailabilityStatus.out_of_stock @@_out_of_stock ||= ItemAvailabilityStatus.new('out_of_stock') end |
Instance Method Details
#to_hash ⇒ Object
21768 21769 21770 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21768 def to_hash value end |