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.



11119
11120
11121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11119

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



11117
11118
11119
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11117

def value
  @value
end

Class Method Details

.ALLObject



11139
11140
11141
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11139

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



11124
11125
11126
11127
11128
11129
11130
11131
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11124

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



11151
11152
11153
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11151

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



11134
11135
11136
11137
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11134

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

.insertObject



11143
11144
11145
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11143

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

.updateObject



11147
11148
11149
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11147

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

Instance Method Details

#to_hashObject



11155
11156
11157
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11155

def to_hash
  value
end