class DeviantArt::Error

Attributes

error[RW]

:method: status_code This is the HTTP status code of response.

error_code[RW]

:method: status_code This is the HTTP status code of response.

error_description[RW]

:method: status_code This is the HTTP status code of response.

error_details[RW]

:method: status_code This is the HTTP status code of response.

status_code[RW]

:method: status_code This is the HTTP status code of response.

Public Class Methods

new(json, status_code) click to toggle source
Calls superclass method DeviantArt::Base::new
# File lib/deviantart/error.rb, line 30
def initialize(json, status_code)
  super(json)
  @status_code = status_code
end

Public Instance Methods

error() click to toggle source

Error type in JSON. For example: invalid_request, unauthorized and server_error

# File lib/deviantart/error.rb, line 5
    
error_code() click to toggle source

Optional. Some endpoints may provide additional error codes so your application can provide fine grained handling of the error states. Each endpoint will define any additional codes in its documentation, all codes start from zero and are specific to that particular endpoint.

# File lib/deviantart/error.rb, line 18
    
error_description() click to toggle source

The error message. You should NOT parse this as it may change, use error or error_code for conditional logic within your app.

# File lib/deviantart/error.rb, line 9
    
error_details() click to toggle source

Optional. For validation errors, this will be a key/value map containing error information for each field.

# File lib/deviantart/error.rb, line 13
    
to_s() click to toggle source
# File lib/deviantart/error.rb, line 35
def to_s
  messages = []
  messages << self.class.name
  messages << "status_code: #{@status_code}"
  messages << "error_code: #{@error_code}" if @error_code
  messages << "error: #{@error}" if @error
  messages << "error_description: #{@error_description}" if @error_description
  messages << "error_details: #{@error_details}" if @error_details
  messages.join(', ')
end