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.



10995
10996
10997
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10995

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Class Method Details

.ALLObject



11015
11016
11017
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11015

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



11019
11020
11021
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11019

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



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

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



11023
11024
11025
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11023

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

.china_union_payObject



11027
11028
11029
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11027

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

.dankortObject



11031
11032
11033
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11031

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

.diners_clubObject



11035
11036
11037
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11035

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

.discoverObject



11039
11040
11041
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11039

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



11010
11011
11012
11013
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11010

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

.jcbObject



11043
11044
11045
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11043

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

.maestroObject



11047
11048
11049
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11047

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

.mastercardObject



11051
11052
11053
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11051

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

.visaObject



11055
11056
11057
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11055

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

Instance Method Details

#to_hashObject



11059
11060
11061
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11059

def to_hash
  value
end