docusign_dtr 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e03a52f3bb44e1462024e64b3d3a408c71f63c81565a658606b568cb2fe8848b
4
- data.tar.gz: f1f1a6345ade77d8e31af1641e510ef68147e141baf18fcd57dc2b7c1e57bbcb
3
+ metadata.gz: babf7393da3cdb470a7a0ddbc037b50e3bf282ee6ba121204ca45641dcc30bff
4
+ data.tar.gz: 89c2be6c61dbb4e9739e34e966112159232e037eab6f4d726060eaceb069a6af
5
5
  SHA512:
6
- metadata.gz: 86680ddc00e86f70d75661603302350dbe912458e15824217a75d27225e1c6ee2256c9538e8363133160e59a51e7e9669edef908f4cef6588cc4fdebd4076b27
7
- data.tar.gz: 6e481220000cf8f4afa61ce0aca4895c793ce831b4f1ad0ce995fad7701f1a32ee406b0555dab18111a7146c9bcd0e3ae7fcb6c6abd30daf1e465b1075ad0dc5
6
+ metadata.gz: '049c2d2bc889e2f57ac05ef86b6f312edd2893fc42d53e5879d7cdfe9077cdfd96ac8a91bdfc4674a24e7a967620a71f8e7a8b89322f132f2f1a4b4cc5d6216a'
7
+ data.tar.gz: c41da729edfff39ab6dfacf6f04293917cf24fe26aec512409228df92ae8e7e63270a648ffb51e0b224ad7b0960f1d044214e9a7a92b34180f2dd6cd9019f9cf
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,8 +1,8 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.5.1
5
- before_install: gem install bundler -v 1.15.1
4
+ - 2.5.3
5
+ before_install: gem install bundler -v 1.17.1
6
6
  notifications:
7
7
  slack:
8
8
  secure: JabcnJlmrkhrrCtDTaqoylYn2dmyUP9h9SO/IyVKrIZ0YvTukaKzU2RSHP6PXjv1WC/9zfrmrWiODBZmg3HciOq4C6g+LdPEGtujx4ULSpztyIm8MlC+uODKtNLR7Q4j9cWTNOi6JKmBWJmo00i7OXLiB3njpEza3or3585vL9ffLJTG/9bi61u/ccuDXBKjqOg2Mxa5sWycgl/kAZ1qTgG76RARWFr6f2Cvxu9LG0BeUq0KpMHKToPjTllmYIKoXKStAX8bLnTU0M1JI5O4uc5W/QOaRhrNgSNyn2LVzHos/8+LO8I4kj+ptMYK037pM3ojByYmQOyE8WL/6kCAJbRN5njyENRUpXrGyWjfF7yDBGA5zMoYgC6MyUWiOj66p12tNTrUVkeFc53uYzlfAg8n331aHj+j+zWuT+oOrn0H9Nx1X4QtJleY6qkPHZO2aF9o7rZIeA7Fn9fGrECUvOQyskBHgHyyWnZ1SpZsRBXKCqlPMyf//RUO9Cx580VSTqgjTCcHa5gAhsoiTl5S9NjsTJCrshRxkj0t1tv2tiCbbTLJ9n309wsI2kj+53S4Q4lXgTV4SQEqrqoO7PldQKPiOZDF2ZOZO0Ou6EBEGcIqL54tWjoKXHpPxMuXW0UrXgl1wl+jhiQTzKBlW4raHLYfaL6u1Yjvo1ZKKTlLseg=
@@ -65,7 +65,7 @@ module DocusignDtr
65
65
  end
66
66
 
67
67
  def handle_error(response)
68
- raise DocusignDtr::Auth::Error.new(response: response).build
68
+ DocusignDtr::Auth::Error.new(response: response).build
69
69
  end
70
70
  end
71
71
  end
@@ -26,7 +26,7 @@ module DocusignDtr
26
26
 
27
27
  params = { grant_type: :authorization_code, code: code }
28
28
  response = self.class.post(auth_uri, query: params, headers: headers, timeout: 60)
29
- handle_error(response) if response.code != 200
29
+ handle_error(response)
30
30
  @token_response = DocusignDtr::Models::AuthTokenResponse.new(response.parsed_response)
31
31
  end
32
32
 
@@ -35,7 +35,7 @@ module DocusignDtr
35
35
 
36
36
  params = { grant_type: :refresh_token, refresh_token: @token_response.refresh_token }
37
37
  response = self.class.post("#{base_uri}oauth/token", query: params, headers: headers, timeout: 60)
38
- handle_error(response) if response.code != 200
38
+ handle_error(response)
39
39
  @token_response = DocusignDtr::Models::AuthTokenResponse.new(response.parsed_response)
40
40
  end
41
41
 
@@ -43,7 +43,7 @@ module DocusignDtr
43
43
  raise 'No token to obtain userinfo' unless @token_response&.access_token
44
44
 
45
45
  response = self.class.get("#{base_uri}oauth/userinfo", headers: user_info_headers, timeout: 60)
46
- handle_error(response) if response.code != 200
46
+ handle_error(response)
47
47
  @userinfo = DocusignDtr::Models::Userinfo.new(response.parsed_response)
48
48
  end
49
49
 
@@ -8,11 +8,7 @@ module DocusignDtr
8
8
  def build
9
9
  return nil if @response.code == 200
10
10
 
11
- exception.new(full_message)
12
- end
13
-
14
- def full_message
15
- "Error communicating: Response code #{@response.code}"
11
+ raise exception.new(standard_error_message)
16
12
  end
17
13
 
18
14
  def exception
@@ -35,8 +31,9 @@ module DocusignDtr
35
31
  def general_error
36
32
  return DocusignDtr::InvalidGrant if error_code.match?(/grant/)
37
33
  return DocusignDtr::ApiLimitExceeded if error_code.match?(/HOURLY_APIINVOCATION_LIMIT_EXCEEDED/)
34
+ return DocusignDtr::ConsentRequired if error_code.match?(/consent_required/)
38
35
 
39
- DocusignDtr::ConsentRequired
36
+ StandardError
40
37
  end
41
38
 
42
39
  def error_code
@@ -45,8 +42,16 @@ module DocusignDtr
45
42
  @error_code ||= parsed_response.fetch(:error, nil) || parsed_response.fetch(:errorCode, '')
46
43
  end
47
44
 
45
+ def error_message
46
+ parsed_response.fetch(:message, nil) || parsed_response.fetch(:errorDetails, '')
47
+ end
48
+
48
49
  def parsed_response
49
- @parsed_response ||= @response.parsed_response&.transform_keys(&:to_sym)
50
+ @parsed_response ||= @response.parsed_response&.transform_keys(&:to_sym) || {}
51
+ end
52
+
53
+ def standard_error_message
54
+ [error_code, error_message].compact.reject(&:empty?).join(': ')
50
55
  end
51
56
  end
52
57
  end
@@ -23,7 +23,7 @@ module DocusignDtr
23
23
 
24
24
  def request_token
25
25
  response = self.class.post(auth_uri, query: access_token_params, headers: base_headers, timeout: 60)
26
- handle_error(response) if response.code != 200
26
+ handle_error(response)
27
27
  @token_response = DocusignDtr::Models::AuthTokenResponse.new(response.parsed_response)
28
28
  end
29
29
 
@@ -18,12 +18,12 @@ module DocusignDtr
18
18
  def raw(page, params = {})
19
19
  full_path = [base_uri, page].join
20
20
  response = self.class.get(full_path, query: params, headers: headers, timeout: 60)
21
- handle_error(response) if response.code != 200
21
+ handle_error(response)
22
22
  response.parsed_response
23
23
  end
24
24
 
25
25
  def handle_error(response)
26
- raise DocusignDtr::Auth::Error.new(response: response).build
26
+ DocusignDtr::Auth::Error.new(response: response).build
27
27
  end
28
28
 
29
29
  def Document # rubocop:disable Naming/MethodName
@@ -1,3 +1,3 @@
1
1
  module DocusignDtr
2
- VERSION = '0.3.4'.freeze
2
+ VERSION = '0.3.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docusign_dtr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Loft47
@@ -34,7 +34,7 @@ cert_chain:
34
34
  WPTyTwBv5qAL48mT3OBIV99mY13XurTi2s2OCJAgkQZIQlGsFzmT/4IDYivCoABO
35
35
  QVWtuf6LfMkXYW5shBsTlpiGbXeVlm0QW2Av3w==
36
36
  -----END CERTIFICATE-----
37
- date: 2018-11-02 00:00:00.000000000 Z
37
+ date: 2018-11-13 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: coveralls
@@ -333,7 +333,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
333
333
  version: '0'
334
334
  requirements: []
335
335
  rubyforge_project:
336
- rubygems_version: 2.7.6
336
+ rubygems_version: 2.7.7
337
337
  signing_key:
338
338
  specification_version: 4
339
339
  summary: Docusign DTR library
metadata.gz.sig CHANGED
Binary file