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.



7537
7538
7539
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7537

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7535
7536
7537
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7535

def value
  @value
end

Class Method Details

.ALLObject



7557
7558
7559
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7557

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



7542
7543
7544
7545
7546
7547
7548
7549
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7542

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



7569
7570
7571
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7569

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



7552
7553
7554
7555
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7552

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

.insertObject



7561
7562
7563
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7561

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

.updateObject



7565
7566
7567
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7565

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

Instance Method Details

#to_hashObject



7573
7574
7575
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7573

def to_hash
  value
end