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.



13019
13020
13021
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13019

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13017
13018
13019
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13017

def value
  @value
end

Class Method Details

.ALLObject



13039
13040
13041
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13039

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



13043
13044
13045
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13043

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



13024
13025
13026
13027
13028
13029
13030
13031
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13024

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



13047
13048
13049
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13047

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

.china_union_payObject



13051
13052
13053
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13051

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

.dankortObject



13055
13056
13057
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13055

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

.diners_clubObject



13059
13060
13061
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13059

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

.discoverObject



13063
13064
13065
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13063

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



13034
13035
13036
13037
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13034

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

.jcbObject



13067
13068
13069
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13067

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

.maestroObject



13071
13072
13073
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13071

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

.mastercardObject



13075
13076
13077
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13075

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

.visaObject



13079
13080
13081
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13079

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

Instance Method Details

#to_hashObject



13083
13084
13085
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13083

def to_hash
  value
end