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.



7531
7532
7533
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7531

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7529
7530
7531
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7529

def value
  @value
end

Class Method Details

.ALLObject



7551
7552
7553
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7551

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



7555
7556
7557
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7555

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



7536
7537
7538
7539
7540
7541
7542
7543
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7536

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



7559
7560
7561
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7559

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

.china_union_payObject



7563
7564
7565
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7563

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

.dankortObject



7567
7568
7569
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7567

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

.diners_clubObject



7571
7572
7573
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7571

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

.discoverObject



7575
7576
7577
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7575

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



7546
7547
7548
7549
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7546

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

.jcbObject



7579
7580
7581
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7579

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

.maestroObject



7583
7584
7585
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7583

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

.mastercardObject



7587
7588
7589
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7587

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

.visaObject



7591
7592
7593
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7591

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

Instance Method Details

#to_hashObject



7595
7596
7597
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7595

def to_hash
  value
end