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.



10126
10127
10128
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10126

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10124
10125
10126
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10124

def value
  @value
end

Class Method Details

.ALLObject



10146
10147
10148
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10146

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



10150
10151
10152
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10150

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



10131
10132
10133
10134
10135
10136
10137
10138
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10131

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



10154
10155
10156
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10154

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

.china_union_payObject



10158
10159
10160
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10158

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

.dankortObject



10162
10163
10164
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10162

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

.diners_clubObject



10166
10167
10168
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10166

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

.discoverObject



10170
10171
10172
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10170

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



10141
10142
10143
10144
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10141

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

.jcbObject



10174
10175
10176
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10174

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

.maestroObject



10178
10179
10180
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10178

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

.mastercardObject



10182
10183
10184
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10182

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

.visaObject



10186
10187
10188
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10186

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

Instance Method Details

#to_hashObject



10190
10191
10192
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10190

def to_hash
  value
end