Class: DocusignDtr::Auth::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/docusign_dtr/auth/error.rb

Instance Method Summary collapse

Constructor Details

#initialize(response:) ⇒ Error

Returns a new instance of Error.



4
5
6
# File 'lib/docusign_dtr/auth/error.rb', line 4

def initialize(response:)
  @response = response
end

Instance Method Details

#buildObject

Raises:



8
9
10
11
12
# File 'lib/docusign_dtr/auth/error.rb', line 8

def build
  return nil if @response.code == 200

  raise exception.new(standard_error_message)
end

#exceptionObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/docusign_dtr/auth/error.rb', line 14

def exception
  case @response.code
  when 400
    general_error
  when 401
    DocusignDtr::Unauthorized
  when 403
    DocusignDtr::Forbidden
  when 204
    DocusignDtr::NoContent
  else
    StandardError
  end
end