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.



17247
17248
17249
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17247

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



17245
17246
17247
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17245

def value
  @value
end

Class Method Details

.ALLObject



17267
17268
17269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17267

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



17252
17253
17254
17255
17256
17257
17258
17259
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17252

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



17262
17263
17264
17265
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17262

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

.has_inventoryObject



17271
17272
17273
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17271

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

.no_inventoryObject



17275
17276
17277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17275

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

Instance Method Details

#to_hashObject



17279
17280
17281
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17279

def to_hash
  value
end