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.



11501
11502
11503
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11501

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



11499
11500
11501
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11499

def value
  @value
end

Class Method Details

.ALLObject



11521
11522
11523
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11521

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



11506
11507
11508
11509
11510
11511
11512
11513
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11506

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



11525
11526
11527
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11525

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

.discardObject



11534
11535
11536
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11534

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



11516
11517
11518
11519
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11516

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.



11530
11531
11532
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11530

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

Instance Method Details

#to_hashObject



11538
11539
11540
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11538

def to_hash
  value
end