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.



18131
18132
18133
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18131

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



18129
18130
18131
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18129

def value
  @value
end

Class Method Details

.ALLObject



18151
18152
18153
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18151

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



18136
18137
18138
18139
18140
18141
18142
18143
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18136

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



18146
18147
18148
18149
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18146

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

.not_shownObject



18155
18156
18157
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18155

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

.opted_inObject



18159
18160
18161
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18159

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

.opted_outObject



18163
18164
18165
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18163

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

Instance Method Details

#to_hashObject



18167
18168
18169
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18167

def to_hash
  value
end