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.



12055
12056
12057
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12055

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



12053
12054
12055
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12053

def value
  @value
end

Class Method Details

.ALLObject



12075
12076
12077
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12075

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



12060
12061
12062
12063
12064
12065
12066
12067
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12060

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



12070
12071
12072
12073
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12070

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

.privateObject



12083
12084
12085
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12083

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

.publicObject



12079
12080
12081
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12079

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

Instance Method Details

#to_hashObject



12087
12088
12089
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12087

def to_hash
  value
end