Class: Io::Flow::V0::Models::Visibility

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

Returns a new instance of Visibility.



11187
11188
11189
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11187

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



11185
11186
11187
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11185

def value
  @value
end

Class Method Details

.ALLObject



11207
11208
11209
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11207

def Visibility.ALL
  @@all ||= [Visibility.public, Visibility.private]
end

.apply(value) ⇒ Object

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



11192
11193
11194
11195
11196
11197
11198
11199
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11192

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

.from_string(value) ⇒ Object

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



11202
11203
11204
11205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11202

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

.privateObject



11215
11216
11217
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11215

def Visibility.private
  @@_private ||= Visibility.new('private')
end

.publicObject



11211
11212
11213
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11211

def Visibility.public
  @@_public ||= Visibility.new('public')
end

Instance Method Details

#to_hashObject



11219
11220
11221
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11219

def to_hash
  value
end