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.



7615
7616
7617
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7615

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7613
7614
7615
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7613

def value
  @value
end

Class Method Details

.ALLObject



7635
7636
7637
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7635

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



7639
7640
7641
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7639

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



7620
7621
7622
7623
7624
7625
7626
7627
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7620

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



7643
7644
7645
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7643

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

.china_union_payObject



7647
7648
7649
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7647

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

.dankortObject



7651
7652
7653
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7651

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

.diners_clubObject



7655
7656
7657
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7655

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

.discoverObject



7659
7660
7661
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7659

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



7630
7631
7632
7633
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7630

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

.jcbObject



7663
7664
7665
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7663

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

.maestroObject



7667
7668
7669
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7667

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

.mastercardObject



7671
7672
7673
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7671

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

.visaObject



7675
7676
7677
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7675

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

Instance Method Details

#to_hashObject



7679
7680
7681
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7679

def to_hash
  value
end