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

Returns a new instance of UpdateType.



11238
11239
11240
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11238

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



11236
11237
11238
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11236

def value
  @value
end

Class Method Details

.ALLObject



11258
11259
11260
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11258

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



11243
11244
11245
11246
11247
11248
11249
11250
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11243

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.



11264
11265
11266
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11264

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



11253
11254
11255
11256
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11253

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

.setObject

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



11269
11270
11271
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11269

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

Instance Method Details

#to_hashObject



11273
11274
11275
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11273

def to_hash
  value
end