Exception: Epayco::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Epayco::Error
- Includes:
- Enumerable
- Defined in:
- lib/epayco.rb
Overview
Set custom error
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(code, lang) ⇒ Error
constructor
Get code, lang and show custom error.
Constructor Details
#initialize(code, lang) ⇒ Error
Get code, lang and show custom error
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/epayco.rb', line 18 def initialize code, lang file = open("https://multimedia.epayco.co/message-api/errors.json").read data_hash = JSON.parse(file) error = "Error" if(data_hash[code.to_s]) error = [data_hash[code.to_s][lang]] else error = [code, lang] end super error @errors = error end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
15 16 17 |
# File 'lib/epayco.rb', line 15 def errors @errors end |
Instance Method Details
#each ⇒ Object
31 32 33 |
# File 'lib/epayco.rb', line 31 def each @errors.each { |e| yield *e } end |