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.



13220
13221
13222
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13220

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13218
13219
13220
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13218

def value
  @value
end

Class Method Details

.ALLObject



13240
13241
13242
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13240

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



13225
13226
13227
13228
13229
13230
13231
13232
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13225

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



13235
13236
13237
13238
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13235

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

.privateObject



13248
13249
13250
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13248

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

.publicObject



13244
13245
13246
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13244

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

Instance Method Details

#to_hashObject



13252
13253
13254
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13252

def to_hash
  value
end