Class: Io::Flow::V0::Models::UpdatePolicy

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

Returns a new instance of UpdatePolicy.



20190
20191
20192
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20190

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



20188
20189
20190
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20188

def value
  @value
end

Class Method Details

.ALLObject



20210
20211
20212
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20210

def UpdatePolicy.ALL
  @@all ||= [UpdatePolicy.auto, UpdatePolicy.queue, UpdatePolicy.discard]
end

.apply(value) ⇒ Object

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



20195
20196
20197
20198
20199
20200
20201
20202
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20195

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

.autoObject



20214
20215
20216
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20214

def UpdatePolicy.auto
  @@_auto ||= UpdatePolicy.new('auto')
end

.discardObject



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

def UpdatePolicy.discard
  @@_discard ||= UpdatePolicy.new('discard')
end

.from_string(value) ⇒ Object

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



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

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

.queueObject

Queue item update for approval.



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

def UpdatePolicy.queue
  @@_queue ||= UpdatePolicy.new('queue')
end

Instance Method Details

#to_hashObject



20227
20228
20229
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20227

def to_hash
  value
end