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.



4243
4244
4245
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4243

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



4241
4242
4243
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4241

def value
  @value
end

Class Method Details

.ALLObject



4263
4264
4265
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4263

def CardType.ALL
  @@all ||= [CardType.visa, CardType.mastercard, CardType.american_express, CardType.dankort, CardType.diners_club, CardType.discover, CardType.jcb, CardType.china_union_pay]
end

.american_expressObject



4275
4276
4277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4275

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



4248
4249
4250
4251
4252
4253
4254
4255
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4248

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

.china_union_payObject



4295
4296
4297
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4295

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

.dankortObject



4279
4280
4281
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4279

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

.diners_clubObject



4283
4284
4285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4283

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

.discoverObject



4287
4288
4289
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4287

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



4258
4259
4260
4261
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4258

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

.jcbObject



4291
4292
4293
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4291

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

.mastercardObject



4271
4272
4273
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4271

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

.visaObject



4267
4268
4269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4267

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

Instance Method Details

#to_hashObject



4299
4300
4301
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4299

def to_hash
  value
end