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.



10313
10314
10315
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10313

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10311
10312
10313
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10311

def value
  @value
end

Class Method Details

.ALLObject



10333
10334
10335
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10333

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



10318
10319
10320
10321
10322
10323
10324
10325
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10318

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



10328
10329
10330
10331
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10328

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

.privateObject



10341
10342
10343
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10341

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

.publicObject



10337
10338
10339
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10337

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

Instance Method Details

#to_hashObject



10345
10346
10347
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10345

def to_hash
  value
end