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.



13045
13046
13047
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13045

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13043
13044
13045
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13043

def value
  @value
end

Class Method Details

.ALLObject



13065
13066
13067
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13065

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



13050
13051
13052
13053
13054
13055
13056
13057
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13050

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



13077
13078
13079
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13077

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



13060
13061
13062
13063
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13060

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

.insertObject



13069
13070
13071
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13069

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

.updateObject



13073
13074
13075
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13073

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

Instance Method Details

#to_hashObject



13081
13082
13083
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13081

def to_hash
  value
end