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.



19323
19324
19325
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19323

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



19321
19322
19323
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19321

def value
  @value
end

Class Method Details

.ALLObject



19343
19344
19345
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19343

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



19328
19329
19330
19331
19332
19333
19334
19335
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19328

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



19338
19339
19340
19341
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19338

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

.privateObject



19351
19352
19353
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19351

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

.publicObject



19347
19348
19349
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19347

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

Instance Method Details

#to_hashObject



19355
19356
19357
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19355

def to_hash
  value
end