Class: Io::Flow::V0::Models::SerialStatus

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



18824
18825
18826
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18824

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



18822
18823
18824
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18822

def value
  @value
end

Class Method Details

.ALLObject



18844
18845
18846
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18844

def SerialStatus.ALL
  @@all ||= [SerialStatus.available, SerialStatus.reserved, SerialStatus.sold]
end

.apply(value) ⇒ Object

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



18829
18830
18831
18832
18833
18834
18835
18836
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18829

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

.availableObject



18848
18849
18850
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18848

def SerialStatus.available
  @@_available ||= SerialStatus.new('available')
end

.from_string(value) ⇒ Object

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



18839
18840
18841
18842
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18839

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

.reservedObject



18852
18853
18854
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18852

def SerialStatus.reserved
  @@_reserved ||= SerialStatus.new('reserved')
end

.soldObject



18856
18857
18858
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18856

def SerialStatus.sold
  @@_sold ||= SerialStatus.new('sold')
end

Instance Method Details

#to_hashObject



18860
18861
18862
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18860

def to_hash
  value
end