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.



12259
12260
12261
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12259

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



12257
12258
12259
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12257

def value
  @value
end

Class Method Details

.ALLObject



12279
12280
12281
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12279

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



12264
12265
12266
12267
12268
12269
12270
12271
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12264

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



12274
12275
12276
12277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12274

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

.has_inventoryObject



12283
12284
12285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12283

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

.no_inventoryObject



12287
12288
12289
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12287

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

Instance Method Details

#to_hashObject



12291
12292
12293
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12291

def to_hash
  value
end