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.



13954
13955
13956
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13954

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13952
13953
13954
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13952

def value
  @value
end

Class Method Details

.ALLObject



13974
13975
13976
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13974

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



13978
13979
13980
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13978

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



13959
13960
13961
13962
13963
13964
13965
13966
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13959

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



13982
13983
13984
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13982

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

.china_union_payObject



13986
13987
13988
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13986

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

.dankortObject



13990
13991
13992
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13990

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

.diners_clubObject



13994
13995
13996
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13994

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

.discoverObject



13998
13999
14000
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13998

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



13969
13970
13971
13972
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13969

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

.jcbObject



14002
14003
14004
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14002

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

.maestroObject



14006
14007
14008
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14006

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

.mastercardObject



14010
14011
14012
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14010

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

.visaObject



14014
14015
14016
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14014

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

Instance Method Details

#to_hashObject



14018
14019
14020
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14018

def to_hash
  value
end