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.



10125
10126
10127
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10125

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10123
10124
10125
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10123

def value
  @value
end

Class Method Details

.ALLObject



10145
10146
10147
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10145

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



10130
10131
10132
10133
10134
10135
10136
10137
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10130

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



10149
10150
10151
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10149

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

.discardObject



10158
10159
10160
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10158

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



10140
10141
10142
10143
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10140

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.



10154
10155
10156
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10154

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

Instance Method Details

#to_hashObject



10162
10163
10164
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10162

def to_hash
  value
end