escobar 0.4.11 → 0.4.12

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
  SHA1:
3
- metadata.gz: 0a88b237a63fcf347b1be8a4d06be5696ecff363
4
- data.tar.gz: 3e60168f02c1fa4840cbb5e83bda9657976a44ac
3
+ metadata.gz: 3f24c13a04bc730c447ff8984760ec43d9b1ced6
4
+ data.tar.gz: fe2bf88e8beaeebf544c7f1c487d8068c734485e
5
5
  SHA512:
6
- metadata.gz: ce7cae5bdfa7d53aa5fbf8e189d5db98d94871bd8dd683f739a7d35297e91ae9834bc009445f2f2bc2d365de48ce5ae5daa4f2a7b1160bb57abbee9f10ad967e
7
- data.tar.gz: cd5f90d1a8bbce07db67fd3f582b2b1365204ed9bbbabf8135dee0b08ab1f1e09ed82917af015bac8552a9011ce02259abd716bae4e7c2db64abcf303ad0fc4f
6
+ metadata.gz: 70ca836c946229e2a1e0f6665bb0402264035fbe27488b9cdc98ef0fc45d8092bc3c90637d6c9680fd6874a221d07e480ddf2d3d8156e2371637c766984878e3
7
+ data.tar.gz: 0f8777f8c6aab0bb64f1b2f6ea175ae6cb6857473e51a235e592a2137d680f4bb487d87587f77dff8008ffd612fdc307f80054ef23f1f66cb54b7475d1108630
@@ -51,6 +51,7 @@ module Escobar
51
51
 
52
52
  module Error
53
53
  class Unauthorized < HTTPError; end
54
+ class SecondFactor < HTTPError; end
54
55
  end
55
56
 
56
57
  def self.from_environment
@@ -60,7 +60,7 @@ module Escobar
60
60
  request.url path
61
61
  request_defaults(request)
62
62
  if second_factor
63
- request.headers["Heroku-Two-Factor-Code"] = second_factor
63
+ request.headers["Heroku-Two-Factor-Code"] = second_factor.to_s
64
64
  end
65
65
  end
66
66
  end
@@ -83,6 +83,9 @@ module Escobar
83
83
  def raise_on_status(resp)
84
84
  case resp.status
85
85
  when 401
86
+ body = JSON.parse(resp.body)
87
+ raise Escobar::Client::Error::SecondFactor.from_response(resp) \
88
+ if body["id"] == "two_factor"
86
89
  raise Escobar::Client::Error::Unauthorized.from_response(resp)
87
90
  end
88
91
  end
@@ -1,3 +1,3 @@
1
1
  module Escobar
2
- VERSION = "0.4.11".freeze
2
+ VERSION = "0.4.12".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: escobar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.11
4
+ version: 0.4.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Donohoe
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-12 00:00:00.000000000 Z
11
+ date: 2017-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday