Class: PaysonAPI::V1::RemoteError
- Inherits:
-
Object
- Object
- PaysonAPI::V1::RemoteError
- Defined in:
- lib/payson_api/v1/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
Returns a new instance of RemoteError.
12 13 14 15 16 |
# File 'lib/payson_api/v1/remote_error.rb', line 12 def initialize(id, , parameter) @id = id = @parameter = parameter end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'lib/payson_api/v1/remote_error.rb', line 8 def id @id end |
#message ⇒ Object
Returns the value of attribute message.
8 9 10 |
# File 'lib/payson_api/v1/remote_error.rb', line 8 def end |
#parameter ⇒ Object
Returns the value of attribute parameter.
8 9 10 |
# File 'lib/payson_api/v1/remote_error.rb', line 8 def parameter @parameter end |
Class Method Details
.parse(data) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/payson_api/v1/remote_error.rb', line 18 def self.parse(data) [].tap do |errors| i = 0 while data[format(FORMAT_STRING, i, 'errorId')] id = data[format(FORMAT_STRING, i, 'errorId')] = CGI.unescape(data[format(FORMAT_STRING, i, 'message')]) parameter = CGI.unescape(data[format(FORMAT_STRING, i, 'parameter')]) errors << new(id, , parameter) i += 1 end end end |
Instance Method Details
#to_s ⇒ Object
31 32 33 |
# File 'lib/payson_api/v1/remote_error.rb', line 31 def to_s "ID: #{@id}, Message: #{@message}, Parameter: #{@parameter}" end |