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.
7015 7016 7017 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7015 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
7013 7014 7015 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7013 def value @value end |
Class Method Details
.ALL ⇒ Object
7035 7036 7037 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7035 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
7039 7040 7041 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7039 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
7020 7021 7022 7023 7024 7025 7026 7027 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7020 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
7043 7044 7045 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7043 def CardType.cartes_bancaires @@_cartes_bancaires ||= CardType.new('cartes_bancaires') end |
.china_union_pay ⇒ Object
7047 7048 7049 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7047 def CardType.china_union_pay @@_china_union_pay ||= CardType.new('china_union_pay') end |
.dankort ⇒ Object
7051 7052 7053 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7051 def CardType.dankort @@_dankort ||= CardType.new('dankort') end |
.diners_club ⇒ Object
7055 7056 7057 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7055 def CardType.diners_club @@_diners_club ||= CardType.new('diners_club') end |
.discover ⇒ Object
7059 7060 7061 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7059 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
7030 7031 7032 7033 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7030 def CardType.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) CardType.ALL.find { |v| v.value == value } end |
.jcb ⇒ Object
7063 7064 7065 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7063 def CardType.jcb @@_jcb ||= CardType.new('jcb') end |
.maestro ⇒ Object
7067 7068 7069 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7067 def CardType.maestro @@_maestro ||= CardType.new('maestro') end |
Instance Method Details
#to_hash ⇒ Object
7079 7080 7081 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7079 def to_hash value end |