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.



21813
21814
21815
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21813

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



21811
21812
21813
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21811

def value
  @value
end

Class Method Details

.ALLObject



21833
21834
21835
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21833

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



21818
21819
21820
21821
21822
21823
21824
21825
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21818

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



21828
21829
21830
21831
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21828

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

.privateObject



21841
21842
21843
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21841

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

.publicObject



21837
21838
21839
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21837

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

Instance Method Details

#to_hashObject



21845
21846
21847
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21845

def to_hash
  value
end