Exception: TeleSign::TeleSignError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/telesign/telesign_error.rb

Direct Known Subclasses

AuthorizationError, ValidationError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_json, http_response) ⇒ TeleSignError

Returns a new instance of TeleSignError.



14
15
16
17
18
19
20
# File 'lib/telesign/telesign_error.rb', line 14

def initialize response_json, http_response
  @errors = response_json['errors']
  @headers = http_response.headers
  @status = http_response.status
  @data = http_response.body
  super()
end

Instance Attribute Details

#dataObject

    • Attributes

      -
      
      • data

      • The data returned by the service, in a dictionary form.

      • http_response

      • The full HTTP Response object, including the HTTP status code, headers, and raw returned data.



12
13
14
# File 'lib/telesign/telesign_error.rb', line 12

def data
  @data
end

#errorsObject

    • Attributes

      -
      
      • data

      • The data returned by the service, in a dictionary form.

      • http_response

      • The full HTTP Response object, including the HTTP status code, headers, and raw returned data.



12
13
14
# File 'lib/telesign/telesign_error.rb', line 12

def errors
  @errors
end

#headersObject

    • Attributes

      -
      
      • data

      • The data returned by the service, in a dictionary form.

      • http_response

      • The full HTTP Response object, including the HTTP status code, headers, and raw returned data.



12
13
14
# File 'lib/telesign/telesign_error.rb', line 12

def headers
  @headers
end

#statusObject

    • Attributes

      -
      
      • data

      • The data returned by the service, in a dictionary form.

      • http_response

      • The full HTTP Response object, including the HTTP status code, headers, and raw returned data.



12
13
14
# File 'lib/telesign/telesign_error.rb', line 12

def status
  @status
end

Instance Method Details

#to_sObject



22
23
24
# File 'lib/telesign/telesign_error.rb', line 22

def to_s
  @errors.inject(''){|ret, x| ret += "#{x['description']}\n" }
end