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.



17845
17846
17847
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17845

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



17843
17844
17845
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17843

def value
  @value
end

Class Method Details

.ALLObject



17865
17866
17867
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17865

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



17850
17851
17852
17853
17854
17855
17856
17857
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17850

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



17877
17878
17879
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17877

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



17860
17861
17862
17863
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17860

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

.insertObject



17869
17870
17871
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17869

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

.updateObject



17873
17874
17875
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17873

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

Instance Method Details

#to_hashObject



17881
17882
17883
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17881

def to_hash
  value
end