Class: Io::Flow::V0::Models::InventoryStatus

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) ⇒ InventoryStatus

Returns a new instance of InventoryStatus.



16251
16252
16253
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16251

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16249
16250
16251
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16249

def value
  @value
end

Class Method Details

.ALLObject



16271
16272
16273
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16271

def InventoryStatus.ALL
  @@all ||= [InventoryStatus.has_inventory, InventoryStatus.no_inventory]
end

.apply(value) ⇒ Object

Returns the instance of InventoryStatus for this value, creating a new instance for an unknown value



16256
16257
16258
16259
16260
16261
16262
16263
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16256

def InventoryStatus.apply(value)
  if value.instance_of?(InventoryStatus)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || InventoryStatus.new(value))
  end
end

.from_string(value) ⇒ Object

Returns the instance of InventoryStatus for this value, or nil if not found



16266
16267
16268
16269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16266

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

.has_inventoryObject



16275
16276
16277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16275

def InventoryStatus.has_inventory
  @@_has_inventory ||= InventoryStatus.new('has_inventory')
end

.no_inventoryObject



16279
16280
16281
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16279

def InventoryStatus.no_inventory
  @@_no_inventory ||= InventoryStatus.new('no_inventory')
end

Instance Method Details

#to_hashObject



16283
16284
16285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16283

def to_hash
  value
end