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.



8055
8056
8057
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8055

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Class Method Details

.ALLObject



8075
8076
8077
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8075

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



8060
8061
8062
8063
8064
8065
8066
8067
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8060

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



8087
8088
8089
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8087

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



8070
8071
8072
8073
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8070

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

.insertObject



8079
8080
8081
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8079

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

.updateObject



8083
8084
8085
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8083

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

Instance Method Details

#to_hashObject



8091
8092
8093
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8091

def to_hash
  value
end