tamber 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +9 -0
- data/VERSION +1 -1
- data/lib/tamber.rb +31 -3
- data/lib/tamber/tamber_error.rb +7 -0
- data/lib/tamber/version.rb +1 -1
- data/test/test_helper.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8004eba3105bccbba37c06ea731792477a3a6a5
|
4
|
+
data.tar.gz: 4258a7685450ee4e22a553f019917068840c9fa2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a207f215cf2c5fa4a6aa7308b6d4d3bb48ff58856ae5ee7488e60cb41bf6e24078134f603f5370d24fb293fa7612ef440c58b99f836ae2074ca69c7d263d2830
|
7
|
+
data.tar.gz: 0f58d0e36a8c03fb44b6e882829d0a052e7d71538dd2eb5271abdd14b4b4f3c754ffbcae861e84e4034e84fddeae2dfae06095284dfd4e3bf9409df288f4bdbf
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -196,6 +196,15 @@ rescue TamberError => error
|
|
196
196
|
end
|
197
197
|
```
|
198
198
|
|
199
|
+
### Timeout Configuration
|
200
|
+
|
201
|
+
Open and read timeouts are configurable:
|
202
|
+
|
203
|
+
```rb
|
204
|
+
Tamber.open_timeout = 1
|
205
|
+
Tamber.read_timeout = 5
|
206
|
+
```
|
207
|
+
|
199
208
|
See [Tests](https://github.com/tamber/tamber-ruby/tree/master/test) for more examples.
|
200
209
|
|
201
210
|
[homepage]: https://tamber.com
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.10
|
data/lib/tamber.rb
CHANGED
@@ -150,7 +150,35 @@ module Tamber
|
|
150
150
|
end
|
151
151
|
|
152
152
|
def self.handle_restclient_error(e, request_opts)
|
153
|
-
|
153
|
+
case e
|
154
|
+
when Errno::ECONNREFUSED
|
155
|
+
message = "Could not connect to Tamber at #{api_url}. " \
|
156
|
+
"Please check that your internet connection and DNS are working by running " \
|
157
|
+
"'host tamber.com' from the command line and try again. " \
|
158
|
+
"Still borked? Email us at support@tamber.com and we'll get to the bottom of it."
|
159
|
+
|
160
|
+
when RestClient::Timeout
|
161
|
+
message = "Could not connect to Tamber at #{api_url}. " \
|
162
|
+
"Please check your internet connection and try again. " \
|
163
|
+
"Still borked? Email us at support@tamber.com and we'll get to the bottom of it."
|
164
|
+
|
165
|
+
when RestClient::SSLCertificateNotVerified
|
166
|
+
message = "Could not establish a secure connection to Tamber, you may " \
|
167
|
+
"need to upgrade your OpenSSL version. To check, try running " \
|
168
|
+
"'openssl s_client -connect api.tamber.com:443' from the " \
|
169
|
+
"command line."
|
170
|
+
|
171
|
+
when RestClient::ServerBrokeConnection
|
172
|
+
message = "Connection was broken before the request could complete (either by " \
|
173
|
+
"the Tamber server or a network failure)."
|
174
|
+
|
175
|
+
else
|
176
|
+
message = "Unexpected request error. If this problem persists, please let us know by " \
|
177
|
+
"emailing us at support@tamber.com."
|
178
|
+
|
179
|
+
end
|
180
|
+
|
181
|
+
raise NetworkError.new(message + "\n\n(#{e.message})")
|
154
182
|
end
|
155
183
|
|
156
184
|
def self.execute_request(opts)
|
@@ -163,7 +191,7 @@ module Tamber
|
|
163
191
|
if response["success"]
|
164
192
|
response = response["result"]
|
165
193
|
else
|
166
|
-
raise TamberError.new(
|
194
|
+
raise TamberError.new(response["error"])
|
167
195
|
end
|
168
196
|
rescue JSON::ParserError
|
169
197
|
raise general_api_error(response.body)
|
@@ -182,7 +210,7 @@ module Tamber
|
|
182
210
|
rescue NoMethodError => e
|
183
211
|
# Work around RestClient bug
|
184
212
|
if e.message =~ /\WRequestFailed\W/
|
185
|
-
raise TamberError.new('
|
213
|
+
raise TamberError.new('Unexpected HTTP response code')
|
186
214
|
else
|
187
215
|
raise
|
188
216
|
end
|
data/lib/tamber/tamber_error.rb
CHANGED
data/lib/tamber/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tamber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexi Robbins
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-04-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|