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.
6777 6778 6779 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6777 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
6775 6776 6777 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6775 def value @value end |
Class Method Details
.ALL ⇒ Object
6797 6798 6799 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6797 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
6801 6802 6803 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6801 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
6782 6783 6784 6785 6786 6787 6788 6789 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6782 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
6805 6806 6807 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6805 def CardType.cartes_bancaires @@_cartes_bancaires ||= CardType.new('cartes_bancaires') end |
.china_union_pay ⇒ Object
6809 6810 6811 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6809 def CardType.china_union_pay @@_china_union_pay ||= CardType.new('china_union_pay') end |
.dankort ⇒ Object
6813 6814 6815 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6813 def CardType.dankort @@_dankort ||= CardType.new('dankort') end |
.diners_club ⇒ Object
6817 6818 6819 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6817 def CardType.diners_club @@_diners_club ||= CardType.new('diners_club') end |
.discover ⇒ Object
6821 6822 6823 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6821 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
6792 6793 6794 6795 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6792 def CardType.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) CardType.ALL.find { |v| v.value == value } end |
.jcb ⇒ Object
6825 6826 6827 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6825 def CardType.jcb @@_jcb ||= CardType.new('jcb') end |
.maestro ⇒ Object
6829 6830 6831 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6829 def CardType.maestro @@_maestro ||= CardType.new('maestro') end |
.mastercard ⇒ Object
6833 6834 6835 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6833 def CardType.mastercard @@_mastercard ||= CardType.new('mastercard') end |
.visa ⇒ Object
6837 6838 6839 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6837 def CardType.visa @@_visa ||= CardType.new('visa') end |
Instance Method Details
#to_hash ⇒ Object
6841 6842 6843 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6841 def to_hash value end |