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.



11463
11464
11465
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11463

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



11461
11462
11463
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11461

def value
  @value
end

Class Method Details

.ALLObject



11483
11484
11485
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11483

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



11468
11469
11470
11471
11472
11473
11474
11475
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11468

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



11478
11479
11480
11481
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11478

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

.privateObject



11491
11492
11493
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11491

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

.publicObject



11487
11488
11489
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11487

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

Instance Method Details

#to_hashObject



11495
11496
11497
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11495

def to_hash
  value
end