nationbuilder-rb 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/lib/nationbuilder/client.rb +4 -8
- data/lib/nationbuilder/version.rb +1 -1
- data/nationbuilder-rb.gemspec +1 -1
- data/spec/lib/nationbuilder/client_spec.rb +13 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14a29218206ac57d5dfab65c415aa96556baafab
|
4
|
+
data.tar.gz: 458e780eab970154448bf04728c91f8013074bd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6ee8bea7f26f66286e207800beb8b9e86e206ee0fdc7c92d281319246f20f19d57594cd6639639f8e7065a2c2473df5a66898a1d2f0bf0c17810d07f8e1108f
|
7
|
+
data.tar.gz: 50712c5c46c8da59efafb3313a7bfbef67d6524b869d1f70a39bfee91cf62ddc3bb4744aa305620f7c1efeb1dfb48f2e98f55b71e6b40177929c0e2d36a3caaa
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
|
+
# 1.6.0
|
2
|
+
- [#40] Remove appending `status_code` to the parsed response and ensure
|
3
|
+
the `response` for the last request is always accessible via the client
|
4
|
+
|
1
5
|
# 1.5.0
|
2
|
-
- [#31] Allow for a user provided HTTPClient
|
6
|
+
- [#31] Allow for a user provided HTTPClient
|
3
7
|
|
4
8
|
# 1.4.3
|
5
9
|
- [#34] Fix `Content-Type` header check
|
data/lib/nationbuilder/client.rb
CHANGED
@@ -76,14 +76,13 @@ class NationBuilder::Client
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def perform_request_with_retries(method, url, request_args)
|
79
|
-
raw_response = nil
|
80
79
|
parsed_response = nil
|
81
80
|
exception_to_reraise = nil
|
82
81
|
|
83
82
|
(@retries + 1).times do |i|
|
84
83
|
begin
|
85
|
-
|
86
|
-
parsed_response = parse_response_body(
|
84
|
+
set_response(@http_client.send(method, url, request_args))
|
85
|
+
parsed_response = parse_response_body(response)
|
87
86
|
rescue NationBuilder::RateLimitedError => e
|
88
87
|
exception_to_reraise = e
|
89
88
|
Kernel.sleep(RETRY_DELAY * 2**i)
|
@@ -96,11 +95,8 @@ class NationBuilder::Client
|
|
96
95
|
end
|
97
96
|
|
98
97
|
# If the retry cycle ended with an error, reraise it
|
99
|
-
if exception_to_reraise
|
100
|
-
raise exception_to_reraise
|
101
|
-
end
|
98
|
+
raise exception_to_reraise if exception_to_reraise
|
102
99
|
|
103
|
-
set_response(raw_response)
|
104
100
|
parsed_response
|
105
101
|
end
|
106
102
|
|
@@ -133,7 +129,7 @@ class NationBuilder::Client
|
|
133
129
|
return true
|
134
130
|
end
|
135
131
|
|
136
|
-
parsed_body(response.body)
|
132
|
+
parsed_body(response.body)
|
137
133
|
end
|
138
134
|
|
139
135
|
def print_all_descriptions
|
data/nationbuilder-rb.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.require_paths = ["lib"]
|
9
9
|
s.authors = ["David Huie", "Alexandre Schmitt"]
|
10
|
-
s.date = "
|
10
|
+
s.date = "2017-03-27"
|
11
11
|
s.description = "A Ruby client to the NationBuilder API"
|
12
12
|
s.email = "schmitt@nationbuilder.com"
|
13
13
|
s.executables = ["nbdoc"]
|
@@ -63,7 +63,7 @@ describe NationBuilder::Client do
|
|
63
63
|
it 'should handle a parametered GET' do
|
64
64
|
VCR.use_cassette('parametered_get') do
|
65
65
|
response = client.call(:basic_pages, :index, site_slug: 'organizeralexandreschmitt', limit: 11)
|
66
|
-
expect(response
|
66
|
+
expect(client.response.status).to eq(200)
|
67
67
|
response['results'].each do |result|
|
68
68
|
expect(result['site_slug']).to eq('organizeralexandreschmitt')
|
69
69
|
end
|
@@ -83,10 +83,21 @@ describe NationBuilder::Client do
|
|
83
83
|
client.call(:people, :create, params)
|
84
84
|
end
|
85
85
|
|
86
|
-
expect(response
|
86
|
+
expect(client.response.status).to eq(201)
|
87
87
|
expect(response['person']['first_name']).to eq('Bob')
|
88
88
|
end
|
89
89
|
|
90
|
+
context 'errored request' do
|
91
|
+
it 'sets the response on the client' do
|
92
|
+
VCR.use_cassette('errored_get') do
|
93
|
+
expect do
|
94
|
+
client.call(:people, :show, id: 0)
|
95
|
+
end.to raise_error(NationBuilder::ClientError)
|
96
|
+
expect(client.response.status).to eq(404)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
90
101
|
context 'fire_webhooks' do
|
91
102
|
|
92
103
|
it 'should disable webhooks' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nationbuilder-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Huie
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-03-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httpclient
|
@@ -188,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
188
|
version: '0'
|
189
189
|
requirements: []
|
190
190
|
rubyforge_project:
|
191
|
-
rubygems_version: 2.
|
191
|
+
rubygems_version: 2.6.11
|
192
192
|
signing_key:
|
193
193
|
specification_version: 4
|
194
194
|
summary: A Ruby client to the NationBuilder API
|