norad_beacon 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/norad_beacon/api.rb +15 -1
- data/lib/norad_beacon/version.rb +1 -1
- 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: 06a0d09aff0900b871ff00a2eeb25bdd35d72065
|
4
|
+
data.tar.gz: babfaa874a2af2162d46e0e7d72cdd80fcb64ab9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5286b79e17b95bd90585f66fc64ad447312cf2e348300cb1a5fb775f66ecf7db5e75f10301e85eb3dafe069755d81ffe4066ad388d8d4e01bebbdfefc76771ef
|
7
|
+
data.tar.gz: 24bc8699f52abe828566b8b280d93686ea08fb3dc3bbc39fb08ab70a904fd163a776efcd59f0fb210c4985aeb8d5719e6e93f44ff6cf1f8124b033e30f66dd8e
|
data/lib/norad_beacon/api.rb
CHANGED
@@ -7,6 +7,8 @@ module NoradBeacon
|
|
7
7
|
class NoradAPI
|
8
8
|
include HTTParty
|
9
9
|
@norad_root = ENV.fetch('NORAD_ROOT')
|
10
|
+
MAX_ATTEMPTS = 10
|
11
|
+
RETRY_BACKOFF = 2
|
10
12
|
|
11
13
|
class << self
|
12
14
|
def post_payload(http_payload)
|
@@ -25,8 +27,20 @@ module NoradBeacon
|
|
25
27
|
|
26
28
|
private
|
27
29
|
|
30
|
+
def http_req_with_retry(verb, uri, payload)
|
31
|
+
retries ||= 0
|
32
|
+
send(verb, uri, payload)
|
33
|
+
rescue SystemCallError, EOFError, Timeout::Error, SocketError
|
34
|
+
sleep(RETRY_BACKOFF**retries) && retry if (retries += 1) < MAX_ATTEMPTS
|
35
|
+
raise
|
36
|
+
end
|
37
|
+
|
28
38
|
def http_req(http_payload, verb)
|
29
|
-
httpparty_response =
|
39
|
+
httpparty_response = http_req_with_retry(
|
40
|
+
verb,
|
41
|
+
@norad_root + http_payload.url,
|
42
|
+
http_req_options(http_payload)
|
43
|
+
)
|
30
44
|
error_msg = unsuccessful_http_response_msg(httpparty_response)
|
31
45
|
puts error_msg if error_msg
|
32
46
|
httpparty_response
|
data/lib/norad_beacon/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: norad_beacon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blake Hitchcock
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-
|
13
|
+
date: 2018-05-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: httparty
|