escobar 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/escobar/github/client.rb +4 -0
- data/lib/escobar/heroku/client.rb +20 -19
- data/lib/escobar/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bed76fa019336ccd8f401df62b43d859f103e89
|
4
|
+
data.tar.gz: 2cb3b526239b70ca434128d71eb1c566bffa10a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 731b0a552e481ad657f2dd53bd3b9f985fe419fa5aa3571fcf88bbc32c2fc53fdb1dcf2162f1347d1cbd484679ace5821510f3c987a9251c3011746f5fcf579b
|
7
|
+
data.tar.gz: a188f2251e311d1c34a9b67306321e57e45201eb62604646ef718b3e81d1317c13feb25b095875ec296fe1f4514f790440b4da72c1ef2aeab08b2a4a25a99284
|
@@ -92,6 +92,8 @@ module Escobar
|
|
92
92
|
request.headers["Accept"] = accept_headers
|
93
93
|
request.headers["Content-Type"] = "application/json"
|
94
94
|
request.headers["Authorization"] = "token #{token}"
|
95
|
+
request.options.timeout = 5
|
96
|
+
request.options.open_timeout = 2
|
95
97
|
end
|
96
98
|
end
|
97
99
|
|
@@ -101,6 +103,8 @@ module Escobar
|
|
101
103
|
request.headers["Accept"] = accept_headers
|
102
104
|
request.headers["Content-Type"] = "application/json"
|
103
105
|
request.headers["Authorization"] = "token #{token}"
|
106
|
+
request.options.timeout = 5
|
107
|
+
request.options.open_timeout = 2
|
104
108
|
request.body = body.to_json
|
105
109
|
end
|
106
110
|
|
@@ -15,13 +15,14 @@ module Escobar
|
|
15
15
|
inspected
|
16
16
|
end
|
17
17
|
|
18
|
+
def user_information
|
19
|
+
get("/account")
|
20
|
+
end
|
21
|
+
|
18
22
|
def get(path, version = 3)
|
19
23
|
response = client.get do |request|
|
20
24
|
request.url path
|
21
|
-
request
|
22
|
-
request.headers["Accept-Encoding"] = ""
|
23
|
-
request.headers["Content-Type"] = "application/json"
|
24
|
-
request.headers["Authorization"] = "Bearer #{token}"
|
25
|
+
request_defaults(request, version)
|
25
26
|
end
|
26
27
|
|
27
28
|
JSON.parse(response.body)
|
@@ -32,11 +33,8 @@ module Escobar
|
|
32
33
|
def get_range(path, range, version = 3)
|
33
34
|
response = client.get do |request|
|
34
35
|
request.url path
|
35
|
-
request
|
36
|
-
request.headers["
|
37
|
-
request.headers["Content-Type"] = "application/json"
|
38
|
-
request.headers["Authorization"] = "Bearer #{token}"
|
39
|
-
request.headers["Range"] = range
|
36
|
+
request_defaults(request, version)
|
37
|
+
request.headers["Range"] = range
|
40
38
|
end
|
41
39
|
|
42
40
|
JSON.parse(response.body)
|
@@ -47,12 +45,7 @@ module Escobar
|
|
47
45
|
def post(path, body)
|
48
46
|
response = client.post do |request|
|
49
47
|
request.url path
|
50
|
-
request
|
51
|
-
request.headers["Accept-Encoding"] = ""
|
52
|
-
request.headers["Content-Type"] = "application/json"
|
53
|
-
if token
|
54
|
-
request.headers["Authorization"] = "Bearer #{token}"
|
55
|
-
end
|
48
|
+
request_defaults(request)
|
56
49
|
request.body = body.to_json
|
57
50
|
end
|
58
51
|
|
@@ -64,10 +57,7 @@ module Escobar
|
|
64
57
|
def put(path, second_factor = nil)
|
65
58
|
response = client.put do |request|
|
66
59
|
request.url path
|
67
|
-
request
|
68
|
-
request.headers["Accept-Encoding"] = ""
|
69
|
-
request.headers["Content-Type"] = "application/json"
|
70
|
-
request.headers["Authorization"] = "Bearer #{token}"
|
60
|
+
request_defaults(request)
|
71
61
|
if second_factor
|
72
62
|
request.headers["Heroku-Two-Factor-Code"] = second_factor
|
73
63
|
end
|
@@ -80,6 +70,17 @@ module Escobar
|
|
80
70
|
|
81
71
|
private
|
82
72
|
|
73
|
+
def request_defaults(request, version = 3)
|
74
|
+
request.headers["Accept"] = heroku_accept_header(version)
|
75
|
+
request.headers["Accept-Encoding"] = ""
|
76
|
+
request.headers["Content-Type"] = "application/json"
|
77
|
+
if token
|
78
|
+
request.headers["Authorization"] = "Bearer #{token}"
|
79
|
+
end
|
80
|
+
request.options.timeout = 5
|
81
|
+
request.options.open_timeout = 2
|
82
|
+
end
|
83
|
+
|
83
84
|
def heroku_accept_header(version)
|
84
85
|
"application/vnd.heroku+json; version=#{version}"
|
85
86
|
end
|
data/lib/escobar/version.rb
CHANGED