Class: PaysonAPI::RemoteError
- Inherits:
-
Object
- Object
- PaysonAPI::RemoteError
- Defined in:
- lib/payson_api/remote_error.rb
Constant Summary collapse
- FORMAT_STRING =
"errorList.error(%d).%s"
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#message ⇒ Object
Returns the value of attribute message.
-
#parameter ⇒ Object
Returns the value of attribute parameter.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id, message, parameter) ⇒ RemoteError
constructor
A new instance of RemoteError.
- #to_s ⇒ Object
Constructor Details
#initialize(id, message, parameter) ⇒ RemoteError
8 9 10 11 12 |
# File 'lib/payson_api/remote_error.rb', line 8 def initialize(id, , parameter) @id = id = @parameter = parameter end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/payson_api/remote_error.rb', line 5 def id @id end |
#message ⇒ Object
Returns the value of attribute message.
5 6 7 |
# File 'lib/payson_api/remote_error.rb', line 5 def end |
#parameter ⇒ Object
Returns the value of attribute parameter.
5 6 7 |
# File 'lib/payson_api/remote_error.rb', line 5 def parameter @parameter end |
Class Method Details
.parse(data) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/payson_api/remote_error.rb', line 14 def self.parse(data) [].tap do |errors| i = 0 while data[FORMAT_STRING % [i, 'errorId']] id = data[FORMAT_STRING % [i, 'errorId']] = CGI.unescape(data[FORMAT_STRING % [i, 'message']]) parameter = CGI.unescape(data[FORMAT_STRING % [i, 'parameter']]) errors << self.new(id, , parameter) i += 1 end end end |
Instance Method Details
#to_s ⇒ Object
27 28 29 |
# File 'lib/payson_api/remote_error.rb', line 27 def to_s "ID: #{@id}, Message: #{@message}, Parameter: #{@parameter}" end |