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.



11983
11984
11985
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11983

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



11981
11982
11983
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11981

def value
  @value
end

Class Method Details

.ALLObject



12003
12004
12005
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12003

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



11988
11989
11990
11991
11992
11993
11994
11995
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11988

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



11998
11999
12000
12001
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11998

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

.privateObject



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

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

.publicObject



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

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

Instance Method Details

#to_hashObject



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

def to_hash
  value
end