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.



6225
6226
6227
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6225

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



6223
6224
6225
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6223

def value
  @value
end

Class Method Details

.ALLObject



6245
6246
6247
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6245

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



6249
6250
6251
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6249

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



6230
6231
6232
6233
6234
6235
6236
6237
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6230

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



6253
6254
6255
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6253

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

.china_union_payObject



6257
6258
6259
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6257

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

.dankortObject



6261
6262
6263
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6261

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

.diners_clubObject



6265
6266
6267
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6265

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

.discoverObject



6269
6270
6271
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6269

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



6240
6241
6242
6243
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6240

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

.jcbObject



6273
6274
6275
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6273

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

.maestroObject



6277
6278
6279
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6277

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

.mastercardObject



6281
6282
6283
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6281

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

.visaObject



6285
6286
6287
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6285

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

Instance Method Details

#to_hashObject



6289
6290
6291
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6289

def to_hash
  value
end