Class: Io::Flow::V0::Models::CardType

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

Returns a new instance of CardType.



7439
7440
7441
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7439

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7437
7438
7439
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7437

def value
  @value
end

Class Method Details

.ALLObject



7459
7460
7461
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7459

def CardType.ALL
  @@all ||= [CardType.american_express, CardType.cartes_bancaires, CardType.china_union_pay, CardType.dankort, CardType.diners_club, CardType.discover, CardType.jcb, CardType.maestro, CardType.mastercard, CardType.visa]
end

.american_expressObject



7463
7464
7465
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7463

def CardType.american_express
  @@_american_express ||= CardType.new('american_express')
end

.apply(value) ⇒ Object

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



7444
7445
7446
7447
7448
7449
7450
7451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7444

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

.cartes_bancairesObject



7467
7468
7469
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7467

def CardType.cartes_bancaires
  @@_cartes_bancaires ||= CardType.new('cartes_bancaires')
end

.china_union_payObject



7471
7472
7473
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7471

def CardType.china_union_pay
  @@_china_union_pay ||= CardType.new('china_union_pay')
end

.dankortObject



7475
7476
7477
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7475

def CardType.dankort
  @@_dankort ||= CardType.new('dankort')
end

.diners_clubObject



7479
7480
7481
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7479

def CardType.diners_club
  @@_diners_club ||= CardType.new('diners_club')
end

.discoverObject



7483
7484
7485
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7483

def CardType.discover
  @@_discover ||= CardType.new('discover')
end

.from_string(value) ⇒ Object

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



7454
7455
7456
7457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7454

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

.jcbObject



7487
7488
7489
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7487

def CardType.jcb
  @@_jcb ||= CardType.new('jcb')
end

.maestroObject



7491
7492
7493
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7491

def CardType.maestro
  @@_maestro ||= CardType.new('maestro')
end

.mastercardObject



7495
7496
7497
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7495

def CardType.mastercard
  @@_mastercard ||= CardType.new('mastercard')
end

.visaObject



7499
7500
7501
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7499

def CardType.visa
  @@_visa ||= CardType.new('visa')
end

Instance Method Details

#to_hashObject



7503
7504
7505
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7503

def to_hash
  value
end