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.



10669
10670
10671
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10669

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10667
10668
10669
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10667

def value
  @value
end

Class Method Details

.ALLObject



10689
10690
10691
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10689

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



10693
10694
10695
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10693

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



10674
10675
10676
10677
10678
10679
10680
10681
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10674

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



10697
10698
10699
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10697

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

.china_union_payObject



10701
10702
10703
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10701

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

.dankortObject



10705
10706
10707
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10705

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

.diners_clubObject



10709
10710
10711
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10709

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

.discoverObject



10713
10714
10715
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10713

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



10684
10685
10686
10687
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10684

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

.jcbObject



10717
10718
10719
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10717

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

.maestroObject



10721
10722
10723
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10721

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

.mastercardObject



10725
10726
10727
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10725

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

.visaObject



10729
10730
10731
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10729

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

Instance Method Details

#to_hashObject



10733
10734
10735
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10733

def to_hash
  value
end