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.
13287 13288 13289 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13287 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
13285 13286 13287 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13285 def value @value end |
Class Method Details
.ALL ⇒ Object
13307 13308 13309 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13307 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
13311 13312 13313 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13311 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
13292 13293 13294 13295 13296 13297 13298 13299 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13292 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
13315 13316 13317 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13315 def CardType.cartes_bancaires @@_cartes_bancaires ||= CardType.new('cartes_bancaires') end |
.china_union_pay ⇒ Object
13319 13320 13321 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13319 def CardType.china_union_pay @@_china_union_pay ||= CardType.new('china_union_pay') end |
.dankort ⇒ Object
13323 13324 13325 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13323 def CardType.dankort @@_dankort ||= CardType.new('dankort') end |
.diners_club ⇒ Object
13327 13328 13329 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13327 def CardType.diners_club @@_diners_club ||= CardType.new('diners_club') end |
.discover ⇒ Object
13331 13332 13333 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13331 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
13302 13303 13304 13305 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13302 def CardType.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) CardType.ALL.find { |v| v.value == value } end |
.jcb ⇒ Object
13335 13336 13337 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13335 def CardType.jcb @@_jcb ||= CardType.new('jcb') end |
.maestro ⇒ Object
13339 13340 13341 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13339 def CardType.maestro @@_maestro ||= CardType.new('maestro') end |
Instance Method Details
#to_hash ⇒ Object
13351 13352 13353 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13351 def to_hash value end |