Class: Io::Flow::V0::Models::CardType
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::CardType
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
- .ALL ⇒ Object
- .american_express ⇒ Object
-
.apply(value) ⇒ Object
Returns the instance of CardType for this value, creating a new instance for an unknown value.
- .cartes_bancaires ⇒ Object
- .china_union_pay ⇒ Object
- .dankort ⇒ Object
- .diners_club ⇒ Object
- .discover ⇒ Object
-
.from_string(value) ⇒ Object
Returns the instance of CardType for this value, or nil if not found.
- .jcb ⇒ Object
- .maestro ⇒ Object
- .mastercard ⇒ Object
- .visa ⇒ Object
Instance Method Summary collapse
-
#initialize(value) ⇒ CardType
constructor
A new instance of CardType.
- #to_hash ⇒ Object
Constructor Details
#initialize(value) ⇒ CardType
Returns a new instance of CardType.
11256 11257 11258 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11256 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
11254 11255 11256 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11254 def value @value end |
Class Method Details
.ALL ⇒ Object
11276 11277 11278 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11276 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_express ⇒ Object
11280 11281 11282 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11280 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
11261 11262 11263 11264 11265 11266 11267 11268 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11261 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_bancaires ⇒ Object
11284 11285 11286 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11284 def CardType.cartes_bancaires @@_cartes_bancaires ||= CardType.new('cartes_bancaires') end |
.china_union_pay ⇒ Object
11288 11289 11290 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11288 def CardType.china_union_pay @@_china_union_pay ||= CardType.new('china_union_pay') end |
.dankort ⇒ Object
11292 11293 11294 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11292 def CardType.dankort @@_dankort ||= CardType.new('dankort') end |
.diners_club ⇒ Object
11296 11297 11298 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11296 def CardType.diners_club @@_diners_club ||= CardType.new('diners_club') end |
.discover ⇒ Object
11300 11301 11302 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11300 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
11271 11272 11273 11274 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11271 def CardType.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) CardType.ALL.find { |v| v.value == value } end |
.jcb ⇒ Object
11304 11305 11306 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11304 def CardType.jcb @@_jcb ||= CardType.new('jcb') end |
.maestro ⇒ Object
11308 11309 11310 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11308 def CardType.maestro @@_maestro ||= CardType.new('maestro') end |
Instance Method Details
#to_hash ⇒ Object
11320 11321 11322 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11320 def to_hash value end |