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.



8970
8971
8972
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8970

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8968
8969
8970
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8968

def value
  @value
end

Class Method Details

.ALLObject



8990
8991
8992
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8990

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



8994
8995
8996
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8994

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



8975
8976
8977
8978
8979
8980
8981
8982
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8975

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



8998
8999
9000
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8998

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

.china_union_payObject



9002
9003
9004
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9002

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

.dankortObject



9006
9007
9008
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9006

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

.diners_clubObject



9010
9011
9012
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9010

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

.discoverObject



9014
9015
9016
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9014

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



8985
8986
8987
8988
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8985

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

.jcbObject



9018
9019
9020
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9018

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

.maestroObject



9022
9023
9024
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9022

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

.mastercardObject



9026
9027
9028
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9026

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

.visaObject



9030
9031
9032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9030

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

Instance Method Details

#to_hashObject



9034
9035
9036
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9034

def to_hash
  value
end