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.



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

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Class Method Details

.ALLObject



11300
11301
11302
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11300

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



11285
11286
11287
11288
11289
11290
11291
11292
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11285

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



11295
11296
11297
11298
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11295

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

.privateObject



11308
11309
11310
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11308

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

.publicObject



11304
11305
11306
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11304

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

Instance Method Details

#to_hashObject



11312
11313
11314
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11312

def to_hash
  value
end