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.
7223 7224 7225 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7223 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
7221 7222 7223 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7221 def value @value end |
Class Method Details
.ALL ⇒ Object
7243 7244 7245 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7243 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
7247 7248 7249 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7247 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
7228 7229 7230 7231 7232 7233 7234 7235 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7228 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
7251 7252 7253 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7251 def CardType.cartes_bancaires @@_cartes_bancaires ||= CardType.new('cartes_bancaires') end |
.china_union_pay ⇒ Object
7255 7256 7257 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7255 def CardType.china_union_pay @@_china_union_pay ||= CardType.new('china_union_pay') end |
.dankort ⇒ Object
7259 7260 7261 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7259 def CardType.dankort @@_dankort ||= CardType.new('dankort') end |
.diners_club ⇒ Object
7263 7264 7265 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7263 def CardType.diners_club @@_diners_club ||= CardType.new('diners_club') end |
.discover ⇒ Object
7267 7268 7269 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7267 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
7238 7239 7240 7241 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7238 def CardType.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) CardType.ALL.find { |v| v.value == value } end |
.jcb ⇒ Object
7271 7272 7273 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7271 def CardType.jcb @@_jcb ||= CardType.new('jcb') end |
.maestro ⇒ Object
7275 7276 7277 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7275 def CardType.maestro @@_maestro ||= CardType.new('maestro') end |
Instance Method Details
#to_hash ⇒ Object
7287 7288 7289 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7287 def to_hash value end |