Class: Io::Flow::V0::Models::AuthorizationOption

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

Returns a new instance of AuthorizationOption.



8156
8157
8158
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8156

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8154
8155
8156
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8154

def value
  @value
end

Class Method Details

.ALLObject



8176
8177
8178
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8176

def AuthorizationOption.ALL
  @@all ||= [AuthorizationOption.store_card]
end

.apply(value) ⇒ Object

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



8161
8162
8163
8164
8165
8166
8167
8168
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8161

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

.from_string(value) ⇒ Object

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



8171
8172
8173
8174
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8171

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

.store_cardObject

If set, and the authorization is created using a one time nonce, we automatically tokenize and store the card. In these cases you will want to store the new card token in the authorization response (card object)



8183
8184
8185
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8183

def AuthorizationOption.store_card
  @@_store_card ||= AuthorizationOption.new('store_card')
end

Instance Method Details

#to_hashObject



8187
8188
8189
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8187

def to_hash
  value
end