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.



7223
7224
7225
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7223

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7221
7222
7223
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7221

def value
  @value
end

Class Method Details

.ALLObject



7243
7244
7245
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7243

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



7247
7248
7249
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7247

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



7228
7229
7230
7231
7232
7233
7234
7235
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7228

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



7251
7252
7253
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7251

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

.china_union_payObject



7255
7256
7257
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7255

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

.dankortObject



7259
7260
7261
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7259

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

.diners_clubObject



7263
7264
7265
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7263

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

.discoverObject



7267
7268
7269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7267

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



7238
7239
7240
7241
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7238

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

.jcbObject



7271
7272
7273
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7271

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

.maestroObject



7275
7276
7277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7275

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

.mastercardObject



7279
7280
7281
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7279

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

.visaObject



7283
7284
7285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7283

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

Instance Method Details

#to_hashObject



7287
7288
7289
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7287

def to_hash
  value
end