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.



13462
13463
13464
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13462

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13460
13461
13462
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13460

def value
  @value
end

Class Method Details

.ALLObject



13482
13483
13484
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13482

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



13467
13468
13469
13470
13471
13472
13473
13474
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13467

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



13477
13478
13479
13480
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13477

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

.privateObject



13490
13491
13492
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13490

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

.publicObject



13486
13487
13488
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13486

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

Instance Method Details

#to_hashObject



13494
13495
13496
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13494

def to_hash
  value
end