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.



13657
13658
13659
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13657

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13655
13656
13657
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13655

def value
  @value
end

Class Method Details

.ALLObject



13677
13678
13679
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13677

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



13681
13682
13683
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13681

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



13662
13663
13664
13665
13666
13667
13668
13669
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13662

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



13685
13686
13687
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13685

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

.china_union_payObject



13689
13690
13691
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13689

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

.dankortObject



13693
13694
13695
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13693

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

.diners_clubObject



13697
13698
13699
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13697

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

.discoverObject



13701
13702
13703
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13701

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



13672
13673
13674
13675
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13672

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

.jcbObject



13705
13706
13707
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13705

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

.maestroObject



13709
13710
13711
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13709

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

.mastercardObject



13713
13714
13715
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13713

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

.visaObject



13717
13718
13719
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13717

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

Instance Method Details

#to_hashObject



13721
13722
13723
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13721

def to_hash
  value
end