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.



13652
13653
13654
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13652

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13650
13651
13652
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13650

def value
  @value
end

Class Method Details

.ALLObject



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

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



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

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



13657
13658
13659
13660
13661
13662
13663
13664
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13657

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



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

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

.china_union_payObject



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

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

.dankortObject



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

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

.diners_clubObject



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

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

.discoverObject



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

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



13667
13668
13669
13670
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13667

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

.jcbObject



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

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

.maestroObject



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

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

.mastercardObject



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

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

.visaObject



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

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

Instance Method Details

#to_hashObject



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

def to_hash
  value
end