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.
13032 13033 13034 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13032 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
13030 13031 13032 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13030 def value @value end |
Class Method Details
.ALL ⇒ Object
13052 13053 13054 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13052 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
13056 13057 13058 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13056 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
13037 13038 13039 13040 13041 13042 13043 13044 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13037 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
13060 13061 13062 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13060 def CardType.cartes_bancaires @@_cartes_bancaires ||= CardType.new('cartes_bancaires') end |
.china_union_pay ⇒ Object
13064 13065 13066 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13064 def CardType.china_union_pay @@_china_union_pay ||= CardType.new('china_union_pay') end |
.dankort ⇒ Object
13068 13069 13070 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13068 def CardType.dankort @@_dankort ||= CardType.new('dankort') end |
.diners_club ⇒ Object
13072 13073 13074 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13072 def CardType.diners_club @@_diners_club ||= CardType.new('diners_club') end |
.discover ⇒ Object
13076 13077 13078 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13076 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
13047 13048 13049 13050 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13047 def CardType.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) CardType.ALL.find { |v| v.value == value } end |
.jcb ⇒ Object
13080 13081 13082 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13080 def CardType.jcb @@_jcb ||= CardType.new('jcb') end |
.maestro ⇒ Object
13084 13085 13086 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13084 def CardType.maestro @@_maestro ||= CardType.new('maestro') end |
.mastercard ⇒ Object
13088 13089 13090 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13088 def CardType.mastercard @@_mastercard ||= CardType.new('mastercard') end |
.visa ⇒ Object
13092 13093 13094 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13092 def CardType.visa @@_visa ||= CardType.new('visa') end |
Instance Method Details
#to_hash ⇒ Object
13096 13097 13098 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13096 def to_hash value end |