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.
13954 13955 13956 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13954 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
13952 13953 13954 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13952 def value @value end |
Class Method Details
.ALL ⇒ Object
13974 13975 13976 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13974 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
13978 13979 13980 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13978 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
13959 13960 13961 13962 13963 13964 13965 13966 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13959 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
13982 13983 13984 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13982 def CardType.cartes_bancaires @@_cartes_bancaires ||= CardType.new('cartes_bancaires') end |
.china_union_pay ⇒ Object
13986 13987 13988 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13986 def CardType.china_union_pay @@_china_union_pay ||= CardType.new('china_union_pay') end |
.dankort ⇒ Object
13990 13991 13992 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13990 def CardType.dankort @@_dankort ||= CardType.new('dankort') end |
.diners_club ⇒ Object
13994 13995 13996 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13994 def CardType.diners_club @@_diners_club ||= CardType.new('diners_club') end |
.discover ⇒ Object
13998 13999 14000 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13998 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
13969 13970 13971 13972 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13969 def CardType.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) CardType.ALL.find { |v| v.value == value } end |
.jcb ⇒ Object
14002 14003 14004 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14002 def CardType.jcb @@_jcb ||= CardType.new('jcb') end |
.maestro ⇒ Object
14006 14007 14008 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14006 def CardType.maestro @@_maestro ||= CardType.new('maestro') end |
.mastercard ⇒ Object
14010 14011 14012 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14010 def CardType.mastercard @@_mastercard ||= CardType.new('mastercard') end |
.visa ⇒ Object
14014 14015 14016 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14014 def CardType.visa @@_visa ||= CardType.new('visa') end |
Instance Method Details
#to_hash ⇒ Object
14018 14019 14020 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14018 def to_hash value end |