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.



7015
7016
7017
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7015

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7013
7014
7015
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7013

def value
  @value
end

Class Method Details

.ALLObject



7035
7036
7037
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7035

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



7039
7040
7041
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7039

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



7020
7021
7022
7023
7024
7025
7026
7027
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7020

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



7043
7044
7045
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7043

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

.china_union_payObject



7047
7048
7049
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7047

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

.dankortObject



7051
7052
7053
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7051

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

.diners_clubObject



7055
7056
7057
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7055

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

.discoverObject



7059
7060
7061
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7059

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



7030
7031
7032
7033
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7030

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

.jcbObject



7063
7064
7065
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7063

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

.maestroObject



7067
7068
7069
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7067

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

.mastercardObject



7071
7072
7073
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7071

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

.visaObject



7075
7076
7077
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7075

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

Instance Method Details

#to_hashObject



7079
7080
7081
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7079

def to_hash
  value
end