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.



13287
13288
13289
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13287

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13285
13286
13287
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13285

def value
  @value
end

Class Method Details

.ALLObject



13307
13308
13309
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13307

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



13311
13312
13313
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13311

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



13292
13293
13294
13295
13296
13297
13298
13299
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13292

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



13315
13316
13317
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13315

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

.china_union_payObject



13319
13320
13321
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13319

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

.dankortObject



13323
13324
13325
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13323

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

.diners_clubObject



13327
13328
13329
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13327

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

.discoverObject



13331
13332
13333
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13331

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



13302
13303
13304
13305
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13302

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

.jcbObject



13335
13336
13337
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13335

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

.maestroObject



13339
13340
13341
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13339

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

.mastercardObject



13343
13344
13345
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13343

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

.visaObject



13347
13348
13349
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13347

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

Instance Method Details

#to_hashObject



13351
13352
13353
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13351

def to_hash
  value
end