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.



11242
11243
11244
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11242

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



11240
11241
11242
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11240

def value
  @value
end

Class Method Details

.ALLObject



11262
11263
11264
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11262

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



11247
11248
11249
11250
11251
11252
11253
11254
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11247

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



11266
11267
11268
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11266

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

.discardObject



11275
11276
11277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11275

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



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

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.



11271
11272
11273
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11271

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

Instance Method Details

#to_hashObject



11279
11280
11281
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11279

def to_hash
  value
end