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.



9705
9706
9707
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9705

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9703
9704
9705
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9703

def value
  @value
end

Class Method Details

.ALLObject



9725
9726
9727
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9725

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



9710
9711
9712
9713
9714
9715
9716
9717
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9710

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



9720
9721
9722
9723
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9720

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

.privateObject



9733
9734
9735
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9733

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

.publicObject



9729
9730
9731
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9729

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

Instance Method Details

#to_hashObject



9737
9738
9739
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9737

def to_hash
  value
end