Class: Io::Flow::V0::Models::PaymentMethodCapability

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

Returns a new instance of PaymentMethodCapability.



24303
24304
24305
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24303

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



24301
24302
24303
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24301

def value
  @value
end

Class Method Details

.ALLObject



24323
24324
24325
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24323

def PaymentMethodCapability.ALL
  @@all ||= [PaymentMethodCapability.credit, PaymentMethodCapability.debit]
end

.apply(value) ⇒ Object

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



24308
24309
24310
24311
24312
24313
24314
24315
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24308

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

.creditObject

Credit cards provide access to a line of debt issued by a bank.



24328
24329
24330
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24328

def PaymentMethodCapability.credit
  @@_credit ||= PaymentMethodCapability.new('credit')
end

.debitObject

Debit cards deduct money directly from a bank account.



24333
24334
24335
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24333

def PaymentMethodCapability.debit
  @@_debit ||= PaymentMethodCapability.new('debit')
end

.from_string(value) ⇒ Object

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



24318
24319
24320
24321
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24318

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

Instance Method Details

#to_hashObject



24337
24338
24339
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24337

def to_hash
  value
end