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.



11990
11991
11992
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11990

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



11988
11989
11990
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11988

def value
  @value
end

Class Method Details

.ALLObject



12010
12011
12012
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12010

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



11995
11996
11997
11998
11999
12000
12001
12002
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11995

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



12005
12006
12007
12008
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12005

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

.privateObject



12018
12019
12020
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12018

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

.publicObject



12014
12015
12016
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12014

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

Instance Method Details

#to_hashObject



12022
12023
12024
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12022

def to_hash
  value
end