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.



20046
20047
20048
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20046

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



20044
20045
20046
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20044

def value
  @value
end

Class Method Details

.ALLObject



20066
20067
20068
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20066

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



20051
20052
20053
20054
20055
20056
20057
20058
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20051

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



20061
20062
20063
20064
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20061

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

.not_shownObject



20070
20071
20072
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20070

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

.opted_inObject



20074
20075
20076
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20074

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

.opted_outObject



20078
20079
20080
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20078

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

Instance Method Details

#to_hashObject



20082
20083
20084
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20082

def to_hash
  value
end