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.



12442
12443
12444
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12442

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



12440
12441
12442
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12440

def value
  @value
end

Class Method Details

.ALLObject



12462
12463
12464
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12462

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



12447
12448
12449
12450
12451
12452
12453
12454
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12447

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



12474
12475
12476
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12474

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



12457
12458
12459
12460
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12457

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

.insertObject



12466
12467
12468
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12466

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

.updateObject



12470
12471
12472
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12470

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

Instance Method Details

#to_hashObject



12478
12479
12480
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12478

def to_hash
  value
end