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
- .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.
4243 4244 4245 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4243 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
4241 4242 4243 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4241 def value @value end |
Class Method Details
.ALL ⇒ Object
4263 4264 4265 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4263 def CardType.ALL @@all ||= [CardType.visa, CardType.mastercard, CardType.american_express, CardType.dankort, CardType.diners_club, CardType.discover, CardType.jcb, CardType.china_union_pay] end |
.american_express ⇒ Object
4275 4276 4277 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4275 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
4248 4249 4250 4251 4252 4253 4254 4255 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4248 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
4295 4296 4297 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4295 def CardType.china_union_pay @@_china_union_pay ||= CardType.new('china_union_pay') end |
.dankort ⇒ Object
4279 4280 4281 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4279 def CardType.dankort @@_dankort ||= CardType.new('dankort') end |
.diners_club ⇒ Object
4283 4284 4285 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4283 def CardType.diners_club @@_diners_club ||= CardType.new('diners_club') end |
.discover ⇒ Object
4287 4288 4289 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4287 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
4258 4259 4260 4261 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4258 def CardType.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) CardType.ALL.find { |v| v.value == value } end |
.jcb ⇒ Object
4291 4292 4293 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4291 def CardType.jcb @@_jcb ||= CardType.new('jcb') end |
.mastercard ⇒ Object
4271 4272 4273 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4271 def CardType.mastercard @@_mastercard ||= CardType.new('mastercard') end |
.visa ⇒ Object
4267 4268 4269 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4267 def CardType.visa @@_visa ||= CardType.new('visa') end |
Instance Method Details
#to_hash ⇒ Object
4299 4300 4301 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4299 def to_hash value end |