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.



10198
10199
10200
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10198

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10196
10197
10198
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10196

def value
  @value
end

Class Method Details

.ALLObject



10218
10219
10220
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10218

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



10222
10223
10224
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10222

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



10203
10204
10205
10206
10207
10208
10209
10210
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10203

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



10226
10227
10228
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10226

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

.china_union_payObject



10230
10231
10232
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10230

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

.dankortObject



10234
10235
10236
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10234

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

.diners_clubObject



10238
10239
10240
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10238

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

.discoverObject



10242
10243
10244
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10242

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



10213
10214
10215
10216
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10213

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

.jcbObject



10246
10247
10248
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10246

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

.maestroObject



10250
10251
10252
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10250

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

.mastercardObject



10254
10255
10256
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10254

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

.visaObject



10258
10259
10260
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10258

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

Instance Method Details

#to_hashObject



10262
10263
10264
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10262

def to_hash
  value
end