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.
7439 7440 7441 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7439 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
7437 7438 7439 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7437 def value @value end |
Class Method Details
.ALL ⇒ Object
7459 7460 7461 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7459 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
7463 7464 7465 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7463 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
7444 7445 7446 7447 7448 7449 7450 7451 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7444 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
7467 7468 7469 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7467 def CardType.cartes_bancaires @@_cartes_bancaires ||= CardType.new('cartes_bancaires') end |
.china_union_pay ⇒ Object
7471 7472 7473 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7471 def CardType.china_union_pay @@_china_union_pay ||= CardType.new('china_union_pay') end |
.dankort ⇒ Object
7475 7476 7477 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7475 def CardType.dankort @@_dankort ||= CardType.new('dankort') end |
.diners_club ⇒ Object
7479 7480 7481 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7479 def CardType.diners_club @@_diners_club ||= CardType.new('diners_club') end |
.discover ⇒ Object
7483 7484 7485 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7483 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
7454 7455 7456 7457 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7454 def CardType.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) CardType.ALL.find { |v| v.value == value } end |
.jcb ⇒ Object
7487 7488 7489 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7487 def CardType.jcb @@_jcb ||= CardType.new('jcb') end |
.maestro ⇒ Object
7491 7492 7493 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7491 def CardType.maestro @@_maestro ||= CardType.new('maestro') end |
Instance Method Details
#to_hash ⇒ Object
7503 7504 7505 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7503 def to_hash value end |