Class: Io::Flow::V0::Models::ChangeType

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

Returns a new instance of ChangeType.



10021
10022
10023
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10021

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10019
10020
10021
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10019

def value
  @value
end

Class Method Details

.ALLObject



10041
10042
10043
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10041

def ChangeType.ALL
  @@all ||= [ChangeType.insert, ChangeType.update, ChangeType.delete]
end

.apply(value) ⇒ Object

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



10026
10027
10028
10029
10030
10031
10032
10033
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10026

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

.deleteObject



10053
10054
10055
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10053

def ChangeType.delete
  @@_delete ||= ChangeType.new('delete')
end

.from_string(value) ⇒ Object

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



10036
10037
10038
10039
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10036

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

.insertObject



10045
10046
10047
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10045

def ChangeType.insert
  @@_insert ||= ChangeType.new('insert')
end

.updateObject



10049
10050
10051
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10049

def ChangeType.update
  @@_update ||= ChangeType.new('update')
end

Instance Method Details

#to_hashObject



10057
10058
10059
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10057

def to_hash
  value
end