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.



21954
21955
21956
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21954

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



21952
21953
21954
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21952

def value
  @value
end

Class Method Details

.ALLObject



21974
21975
21976
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21974

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



21959
21960
21961
21962
21963
21964
21965
21966
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21959

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.



21980
21981
21982
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21980

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



21969
21970
21971
21972
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21969

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



21985
21986
21987
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21985

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

Instance Method Details

#to_hashObject



21989
21990
21991
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21989

def to_hash
  value
end