blurb 0.4.2 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/blurb.gemspec +1 -1
- data/lib/blurb/errors/failed_request.rb +3 -0
- data/lib/blurb/errors/invalid_report_request.rb +3 -0
- data/lib/blurb/errors/request_throttled.rb +3 -0
- data/lib/blurb/request.rb +13 -5
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 208217ad096230ae4cb116feb1efe8d4a0f8c9e517375ae0f6ab1a115590ab7c
|
4
|
+
data.tar.gz: 4c96990aaf4c712f7b8bfd296b02d83676cafe9559062e04cd5fef03a8cc6213
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57ffa4d5db76fb62a6c0c1ce15dd74ba9d7fd88f9a2a1b307994e993934806c78c7fdc337d414fae79726b3ca200e44a163b085d5065f38f2c94c519099dd646
|
7
|
+
data.tar.gz: 43464648f13a853d55e9de629d6931c68cff1016b9caa85a60df5515cd22aa56f780afede01a6e69fb8736215900af1d93d8554e3ff705f67433a9408fc6f7a5
|
data/blurb.gemspec
CHANGED
data/lib/blurb/request.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
require 'active_support/core_ext/string'
|
2
2
|
require "rest-client"
|
3
3
|
require "blurb/base_class"
|
4
|
+
require "blurb/errors/request_throttled"
|
5
|
+
require "blurb/errors/invalid_report_request"
|
6
|
+
require "blurb/errors/failed_request"
|
4
7
|
|
5
8
|
class Blurb
|
6
9
|
class Request < BaseClass
|
@@ -32,13 +35,18 @@ class Blurb
|
|
32
35
|
def make_request
|
33
36
|
begin
|
34
37
|
resp = RestClient::Request.execute(request_config())
|
35
|
-
rescue RestClient::
|
36
|
-
|
37
|
-
|
38
|
-
|
38
|
+
rescue RestClient::TooManyRequests => err
|
39
|
+
raise RequestThrottled.new(JSON.parse(err.response.body))
|
40
|
+
rescue RestClient::TemporaryRedirect => err
|
41
|
+
return RestClient.get(err.response.headers[:location]) # If this happens, then we are downloading a report from the api, so we can simply download the location
|
42
|
+
rescue RestClient::NotAcceptable => err
|
43
|
+
if @url.include?("report")
|
44
|
+
raise InvalidReportRequest.new(JSON.parse(err.response.body))
|
39
45
|
else
|
40
|
-
|
46
|
+
raise err
|
41
47
|
end
|
48
|
+
rescue RestClient::ExceptionWithResponse => err
|
49
|
+
raise FailedRequest.new(JSON.parse(err.response.body))
|
42
50
|
end
|
43
51
|
resp = convert_response(resp)
|
44
52
|
return resp
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blurb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dlbunker
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-10-
|
12
|
+
date: 2019-10-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -176,6 +176,9 @@ files:
|
|
176
176
|
- lib/blurb/base_class.rb
|
177
177
|
- lib/blurb/campaign_requests.rb
|
178
178
|
- lib/blurb/client.rb
|
179
|
+
- lib/blurb/errors/failed_request.rb
|
180
|
+
- lib/blurb/errors/invalid_report_request.rb
|
181
|
+
- lib/blurb/errors/request_throttled.rb
|
179
182
|
- lib/blurb/profile.rb
|
180
183
|
- lib/blurb/report_requests.rb
|
181
184
|
- lib/blurb/request.rb
|