Class: Io::Flow::V0::Models::OptinResponseType

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) ⇒ OptinResponseType

Returns a new instance of OptinResponseType.



16839
16840
16841
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16839

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16837
16838
16839
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16837

def value
  @value
end

Class Method Details

.ALLObject



16859
16860
16861
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16859

def OptinResponseType.ALL
  @@all ||= [OptinResponseType.not_shown, OptinResponseType.opted_in, OptinResponseType.opted_out]
end

.apply(value) ⇒ Object

Returns the instance of OptinResponseType for this value, creating a new instance for an unknown value



16844
16845
16846
16847
16848
16849
16850
16851
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16844

def OptinResponseType.apply(value)
  if value.instance_of?(OptinResponseType)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || OptinResponseType.new(value))
  end
end

.from_string(value) ⇒ Object

Returns the instance of OptinResponseType for this value, or nil if not found



16854
16855
16856
16857
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16854

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

.not_shownObject



16863
16864
16865
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16863

def OptinResponseType.not_shown
  @@_not_shown ||= OptinResponseType.new('not_shown')
end

.opted_inObject



16867
16868
16869
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16867

def OptinResponseType.opted_in
  @@_opted_in ||= OptinResponseType.new('opted_in')
end

.opted_outObject



16871
16872
16873
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16871

def OptinResponseType.opted_out
  @@_opted_out ||= OptinResponseType.new('opted_out')
end

Instance Method Details

#to_hashObject



16875
16876
16877
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16875

def to_hash
  value
end