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.



7163
7164
7165
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7163

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7161
7162
7163
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7161

def value
  @value
end

Class Method Details

.ALLObject



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

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



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

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



7168
7169
7170
7171
7172
7173
7174
7175
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7168

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



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

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

.china_union_payObject



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

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

.dankortObject



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

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

.diners_clubObject



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

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

.discoverObject



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

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



7178
7179
7180
7181
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7178

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

.jcbObject



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

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

.maestroObject



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

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

.mastercardObject



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

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

.visaObject



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

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

Instance Method Details

#to_hashObject



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

def to_hash
  value
end