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.



17268
17269
17270
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17268

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



17266
17267
17268
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17266

def value
  @value
end

Class Method Details

.ALLObject



17288
17289
17290
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17288

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



17273
17274
17275
17276
17277
17278
17279
17280
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17273

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



17283
17284
17285
17286
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17283

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

.privateObject



17296
17297
17298
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17296

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

.publicObject



17292
17293
17294
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17292

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

Instance Method Details

#to_hashObject



17300
17301
17302
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17300

def to_hash
  value
end