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.
7022 7023 7024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7022 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
7020 7021 7022 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7020 def value @value end |
Class Method Details
.ALL ⇒ Object
7042 7043 7044 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7042 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
7046 7047 7048 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7046 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
7027 7028 7029 7030 7031 7032 7033 7034 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7027 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
7050 7051 7052 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7050 def CardType.cartes_bancaires @@_cartes_bancaires ||= CardType.new('cartes_bancaires') end |
.china_union_pay ⇒ Object
7054 7055 7056 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7054 def CardType.china_union_pay @@_china_union_pay ||= CardType.new('china_union_pay') end |
.dankort ⇒ Object
7058 7059 7060 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7058 def CardType.dankort @@_dankort ||= CardType.new('dankort') end |
.diners_club ⇒ Object
7062 7063 7064 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7062 def CardType.diners_club @@_diners_club ||= CardType.new('diners_club') end |
.discover ⇒ Object
7066 7067 7068 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7066 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
7037 7038 7039 7040 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7037 def CardType.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) CardType.ALL.find { |v| v.value == value } end |
.jcb ⇒ Object
7070 7071 7072 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7070 def CardType.jcb @@_jcb ||= CardType.new('jcb') end |
.maestro ⇒ Object
7074 7075 7076 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7074 def CardType.maestro @@_maestro ||= CardType.new('maestro') end |
Instance Method Details
#to_hash ⇒ Object
7086 7087 7088 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7086 def to_hash value end |