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.



7167
7168
7169
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7167

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7165
7166
7167
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7165

def value
  @value
end

Class Method Details

.ALLObject



7187
7188
7189
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7187

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



7191
7192
7193
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7191

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



7172
7173
7174
7175
7176
7177
7178
7179
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7172

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



7195
7196
7197
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7195

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

.china_union_payObject



7199
7200
7201
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7199

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

.dankortObject



7203
7204
7205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7203

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

.diners_clubObject



7207
7208
7209
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7207

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

.discoverObject



7211
7212
7213
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7211

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



7182
7183
7184
7185
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7182

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

.jcbObject



7215
7216
7217
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7215

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

.maestroObject



7219
7220
7221
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7219

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

.mastercardObject



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

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

.visaObject



7227
7228
7229
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7227

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

Instance Method Details

#to_hashObject



7231
7232
7233
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7231

def to_hash
  value
end