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.



16134
16135
16136
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16134

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16132
16133
16134
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16132

def value
  @value
end

Class Method Details

.ALLObject



16154
16155
16156
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16154

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



16139
16140
16141
16142
16143
16144
16145
16146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16139

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



16149
16150
16151
16152
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16149

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

.privateObject



16162
16163
16164
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16162

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

.publicObject



16158
16159
16160
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16158

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

Instance Method Details

#to_hashObject



16166
16167
16168
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16166

def to_hash
  value
end