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

Returns a new instance of SerialStatus.



19018
19019
19020
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19018

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



19016
19017
19018
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19016

def value
  @value
end

Class Method Details

.ALLObject



19038
19039
19040
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19038

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



19023
19024
19025
19026
19027
19028
19029
19030
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19023

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



19042
19043
19044
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19042

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



19033
19034
19035
19036
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19033

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

.reservedObject



19046
19047
19048
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19046

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

.soldObject



19050
19051
19052
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19050

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

Instance Method Details

#to_hashObject



19054
19055
19056
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19054

def to_hash
  value
end