Class: Io::Flow::V0::Models::ItemAvailabilityStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ ItemAvailabilityStatus

Returns a new instance of ItemAvailabilityStatus.



20193
20194
20195
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20193

def initialize(value)
  @value = HttpClient::Preconditions.assert_class('value', value, String)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



20191
20192
20193
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20191

def value
  @value
end

Class Method Details

.ALLObject



20213
20214
20215
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20213

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



20198
20199
20200
20201
20202
20203
20204
20205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20198

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

.availableObject

Inventory is generally available for purchase



20218
20219
20220
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20218

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



20208
20209
20210
20211
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20208

def ItemAvailabilityStatus.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  ItemAvailabilityStatus.ALL.find { |v| v.value == value }
end

.lowObject

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’



20225
20226
20227
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20225

def ItemAvailabilityStatus.low
  @@_low ||= ItemAvailabilityStatus.new('low')
end

.out_of_stockObject

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



20232
20233
20234
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20232

def ItemAvailabilityStatus.out_of_stock
  @@_out_of_stock ||= ItemAvailabilityStatus.new('out_of_stock')
end

Instance Method Details

#to_hashObject



20236
20237
20238
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20236

def to_hash
  value
end