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.



8021
8022
8023
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8021

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8019
8020
8021
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8019

def value
  @value
end

Class Method Details

.ALLObject



8041
8042
8043
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8041

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



8026
8027
8028
8029
8030
8031
8032
8033
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8026

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



8053
8054
8055
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8053

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



8036
8037
8038
8039
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8036

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

.insertObject



8045
8046
8047
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8045

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

.updateObject



8049
8050
8051
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8049

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

Instance Method Details

#to_hashObject



8057
8058
8059
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8057

def to_hash
  value
end