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.



10746
10747
10748
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10746

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10744
10745
10746
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10744

def value
  @value
end

Class Method Details

.ALLObject



10766
10767
10768
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10766

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



10770
10771
10772
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10770

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



10751
10752
10753
10754
10755
10756
10757
10758
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10751

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



10774
10775
10776
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10774

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

.china_union_payObject



10778
10779
10780
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10778

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

.dankortObject



10782
10783
10784
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10782

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

.diners_clubObject



10786
10787
10788
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10786

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

.discoverObject



10790
10791
10792
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10790

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



10761
10762
10763
10764
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10761

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

.jcbObject



10794
10795
10796
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10794

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

.maestroObject



10798
10799
10800
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10798

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

.mastercardObject



10802
10803
10804
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10802

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

.visaObject



10806
10807
10808
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10806

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

Instance Method Details

#to_hashObject



10810
10811
10812
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10810

def to_hash
  value
end