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.
- .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.
4624 4625 4626 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4624 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
4622 4623 4624 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4622 def value @value end |
Class Method Details
.ALL ⇒ Object
4644 4645 4646 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4644 def CardType.ALL @@all ||= [CardType.american_express, CardType.china_union_pay, CardType.dankort, CardType.diners_club, CardType.discover, CardType.jcb, CardType.maestro, CardType.mastercard, CardType.visa] end |
.american_express ⇒ Object
4648 4649 4650 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4648 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
4629 4630 4631 4632 4633 4634 4635 4636 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4629 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 |
.china_union_pay ⇒ Object
4652 4653 4654 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4652 def CardType.china_union_pay @@_china_union_pay ||= CardType.new('china_union_pay') end |
.dankort ⇒ Object
4656 4657 4658 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4656 def CardType.dankort @@_dankort ||= CardType.new('dankort') end |
.diners_club ⇒ Object
4660 4661 4662 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4660 def CardType.diners_club @@_diners_club ||= CardType.new('diners_club') end |
.discover ⇒ Object
4664 4665 4666 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4664 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
4639 4640 4641 4642 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4639 def CardType.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) CardType.ALL.find { |v| v.value == value } end |
.jcb ⇒ Object
4668 4669 4670 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4668 def CardType.jcb @@_jcb ||= CardType.new('jcb') end |
.maestro ⇒ Object
4672 4673 4674 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4672 def CardType.maestro @@_maestro ||= CardType.new('maestro') end |
Instance Method Details
#to_hash ⇒ Object
4684 4685 4686 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4684 def to_hash value end |