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.
7936 7937 7938 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7936 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
7934 7935 7936 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7934 def value @value end |
Class Method Details
.ALL ⇒ Object
7956 7957 7958 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7956 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
7960 7961 7962 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7960 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
7941 7942 7943 7944 7945 7946 7947 7948 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7941 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
7964 7965 7966 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7964 def CardType.cartes_bancaires @@_cartes_bancaires ||= CardType.new('cartes_bancaires') end |
.china_union_pay ⇒ Object
7968 7969 7970 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7968 def CardType.china_union_pay @@_china_union_pay ||= CardType.new('china_union_pay') end |
.dankort ⇒ Object
7972 7973 7974 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7972 def CardType.dankort @@_dankort ||= CardType.new('dankort') end |
.diners_club ⇒ Object
7976 7977 7978 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7976 def CardType.diners_club @@_diners_club ||= CardType.new('diners_club') end |
.discover ⇒ Object
7980 7981 7982 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7980 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
7951 7952 7953 7954 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7951 def CardType.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) CardType.ALL.find { |v| v.value == value } end |
.jcb ⇒ Object
7984 7985 7986 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7984 def CardType.jcb @@_jcb ||= CardType.new('jcb') end |
.maestro ⇒ Object
7988 7989 7990 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7988 def CardType.maestro @@_maestro ||= CardType.new('maestro') end |
Instance Method Details
#to_hash ⇒ Object
8000 8001 8002 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8000 def to_hash value end |