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.



8631
8632
8633
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8631

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8629
8630
8631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8629

def value
  @value
end

Class Method Details

.ALLObject



8651
8652
8653
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8651

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



8655
8656
8657
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8655

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



8636
8637
8638
8639
8640
8641
8642
8643
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8636

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



8659
8660
8661
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8659

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

.china_union_payObject



8663
8664
8665
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8663

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

.dankortObject



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

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

.diners_clubObject



8671
8672
8673
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8671

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

.discoverObject



8675
8676
8677
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8675

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



8646
8647
8648
8649
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8646

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

.jcbObject



8679
8680
8681
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8679

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

.maestroObject



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

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

.mastercardObject



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

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

.visaObject



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

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

Instance Method Details

#to_hashObject



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

def to_hash
  value
end