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.



20144
20145
20146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20144

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



20142
20143
20144
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20142

def value
  @value
end

Class Method Details

.ALLObject



20164
20165
20166
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20164

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



20149
20150
20151
20152
20153
20154
20155
20156
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20149

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



20159
20160
20161
20162
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20159

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

.privateObject



20172
20173
20174
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20172

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

.publicObject



20168
20169
20170
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20168

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

Instance Method Details

#to_hashObject



20176
20177
20178
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20176

def to_hash
  value
end