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.



16489
16490
16491
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16489

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16487
16488
16489
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16487

def value
  @value
end

Class Method Details

.ALLObject



16509
16510
16511
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16509

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



16513
16514
16515
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16513

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



16494
16495
16496
16497
16498
16499
16500
16501
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16494

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



16517
16518
16519
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16517

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

.china_union_payObject



16521
16522
16523
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16521

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

.dankortObject



16525
16526
16527
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16525

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

.diners_clubObject



16529
16530
16531
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16529

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

.discoverObject



16533
16534
16535
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16533

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



16504
16505
16506
16507
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16504

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

.jcbObject



16537
16538
16539
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16537

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

.maestroObject



16541
16542
16543
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16541

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

.mastercardObject



16545
16546
16547
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16545

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

.visaObject



16549
16550
16551
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16549

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

Instance Method Details

#to_hashObject



16553
16554
16555
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16553

def to_hash
  value
end