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.



10993
10994
10995
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10993

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10991
10992
10993
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10991

def value
  @value
end

Class Method Details

.ALLObject



11013
11014
11015
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11013

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



11017
11018
11019
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11017

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



10998
10999
11000
11001
11002
11003
11004
11005
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10998

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



11021
11022
11023
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11021

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

.china_union_payObject



11025
11026
11027
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11025

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

.dankortObject



11029
11030
11031
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11029

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

.diners_clubObject



11033
11034
11035
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11033

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

.discoverObject



11037
11038
11039
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11037

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



11008
11009
11010
11011
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11008

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

.jcbObject



11041
11042
11043
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11041

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

.maestroObject



11045
11046
11047
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11045

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

.mastercardObject



11049
11050
11051
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11049

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

.visaObject



11053
11054
11055
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11053

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

Instance Method Details

#to_hashObject



11057
11058
11059
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11057

def to_hash
  value
end