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.



8667
8668
8669
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8667

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8665
8666
8667
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8665

def value
  @value
end

Class Method Details

.ALLObject



8687
8688
8689
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8687

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



8691
8692
8693
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8691

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



8672
8673
8674
8675
8676
8677
8678
8679
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8672

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



8695
8696
8697
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8695

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

.china_union_payObject



8699
8700
8701
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8699

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

.dankortObject



8703
8704
8705
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8703

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

.diners_clubObject



8707
8708
8709
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8707

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

.discoverObject



8711
8712
8713
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8711

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



8682
8683
8684
8685
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8682

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

.jcbObject



8715
8716
8717
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8715

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

.maestroObject



8719
8720
8721
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8719

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

.mastercardObject



8723
8724
8725
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8723

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

.visaObject



8727
8728
8729
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8727

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

Instance Method Details

#to_hashObject



8731
8732
8733
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8731

def to_hash
  value
end