Class: Io::Flow::V0::Models::UpdateType

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) ⇒ UpdateType



20204
20205
20206
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20204

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



20202
20203
20204
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20202

def value
  @value
end

Class Method Details

.ALLObject



20224
20225
20226
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20224

def UpdateType.ALL
  @@all ||= [UpdateType.change, UpdateType.set]
end

.apply(value) ⇒ Object

Returns the instance of UpdateType for this value, creating a new instance for an unknown value



20209
20210
20211
20212
20213
20214
20215
20216
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20209

def UpdateType.apply(value)
  if value.instance_of?(UpdateType)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || UpdateType.new(value))
  end
end

.changeObject

Long value to increment or decrement. Positive quantities are added to inventory while negative quantities are decrement from inventory.



20230
20231
20232
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20230

def UpdateType.change
  @@_change ||= UpdateType.new('change')
end

.from_string(value) ⇒ Object

Returns the instance of UpdateType for this value, or nil if not found



20219
20220
20221
20222
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20219

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

.setObject

Set absolute quantity to new value with no regard for previous updates



20235
20236
20237
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20235

def UpdateType.set
  @@_set ||= UpdateType.new('set')
end

Instance Method Details

#to_hashObject



20239
20240
20241
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20239

def to_hash
  value
end