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.



6777
6778
6779
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6777

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



6775
6776
6777
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6775

def value
  @value
end

Class Method Details

.ALLObject



6797
6798
6799
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6797

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



6801
6802
6803
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6801

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



6782
6783
6784
6785
6786
6787
6788
6789
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6782

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



6805
6806
6807
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6805

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

.china_union_payObject



6809
6810
6811
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6809

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

.dankortObject



6813
6814
6815
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6813

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

.diners_clubObject



6817
6818
6819
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6817

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

.discoverObject



6821
6822
6823
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6821

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



6792
6793
6794
6795
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6792

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

.jcbObject



6825
6826
6827
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6825

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

.maestroObject



6829
6830
6831
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6829

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

.mastercardObject



6833
6834
6835
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6833

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

.visaObject



6837
6838
6839
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6837

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

Instance Method Details

#to_hashObject



6841
6842
6843
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6841

def to_hash
  value
end