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.



28418
28419
28420
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28418

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



28416
28417
28418
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28416

def value
  @value
end

Class Method Details

.ALLObject



28438
28439
28440
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28438

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



28423
28424
28425
28426
28427
28428
28429
28430
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28423

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



28433
28434
28435
28436
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28433

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

.privateObject



28446
28447
28448
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28446

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

.publicObject



28442
28443
28444
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28442

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

Instance Method Details

#to_hashObject



28450
28451
28452
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28450

def to_hash
  value
end