Exception: RegApi2::ApiError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/reg_api2/api_error.rb

Overview

API Error from REG.API provider. Please refer to common error codes.

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (ApiError) initialize(code, description, params)

Returns a new instance of ApiError



13
14
15
16
17
# File 'lib/reg_api2/api_error.rb', line 13

def initialize code,  description, params
  super code
  @description = description
  @params = params ||  {}
end

Instance Attribute Details

- (String) description (readonly)

Returns Localized error description.

Returns:

  • (String)

    Localized error description.



8
9
10
# File 'lib/reg_api2/api_error.rb', line 8

def description
  @description
end

- (Hash) params (readonly)

Returns Optional error params.

Returns:

  • (Hash)

    Optional error params.



11
12
13
# File 'lib/reg_api2/api_error.rb', line 11

def params
  @params
end

Class Method Details

+ (ApiError) from_json(json)

Extracts error arguments from specified json.

Parameters:

  • json (Hash)

Returns:

  • (ApiError)

    Initialized error object.



22
23
24
25
26
27
28
# File 'lib/reg_api2/api_error.rb', line 22

def self.from_json json
  new(
    json['error_code'],
    json['error_text'],
    json['error_params']
  )
end