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.
4912 4913 4914 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4912 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
4910 4911 4912 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4910 def value @value end |
Class Method Details
.ALL ⇒ Object
4932 4933 4934 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4932 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
4936 4937 4938 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4936 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
4917 4918 4919 4920 4921 4922 4923 4924 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4917 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
4940 4941 4942 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4940 def CardType.china_union_pay @@_china_union_pay ||= CardType.new('china_union_pay') end |
.dankort ⇒ Object
4944 4945 4946 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4944 def CardType.dankort @@_dankort ||= CardType.new('dankort') end |
.diners_club ⇒ Object
4948 4949 4950 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4948 def CardType.diners_club @@_diners_club ||= CardType.new('diners_club') end |
.discover ⇒ Object
4952 4953 4954 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4952 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
4927 4928 4929 4930 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4927 def CardType.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) CardType.ALL.find { |v| v.value == value } end |
.jcb ⇒ Object
4956 4957 4958 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4956 def CardType.jcb @@_jcb ||= CardType.new('jcb') end |
.maestro ⇒ Object
4960 4961 4962 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4960 def CardType.maestro @@_maestro ||= CardType.new('maestro') end |
Instance Method Details
#to_hash ⇒ Object
4972 4973 4974 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4972 def to_hash value end |