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.



12318
12319
12320
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12318

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



12316
12317
12318
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12316

def value
  @value
end

Class Method Details

.ALLObject



12338
12339
12340
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12338

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



12342
12343
12344
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12342

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



12323
12324
12325
12326
12327
12328
12329
12330
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12323

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



12346
12347
12348
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12346

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

.china_union_payObject



12350
12351
12352
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12350

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

.dankortObject



12354
12355
12356
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12354

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

.diners_clubObject



12358
12359
12360
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12358

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

.discoverObject



12362
12363
12364
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12362

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



12333
12334
12335
12336
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12333

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

.jcbObject



12366
12367
12368
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12366

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

.maestroObject



12370
12371
12372
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12370

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

.mastercardObject



12374
12375
12376
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12374

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

.visaObject



12378
12379
12380
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12378

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

Instance Method Details

#to_hashObject



12382
12383
12384
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12382

def to_hash
  value
end