agra_api 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/agra_api.gemspec +6 -6
- data/lib/agra_api/client.rb +4 -2
- data/lib/agra_api/signature.rb +2 -2
- data/spec/organisation_spec.rb +3 -4
- data/spec/signature_spec.rb +2 -1
- data/spec/spec_helper.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aaf282bc7f816f9c0d883d5df1bf9b545f7254761c5ff95bc9f10356a16ecd76
|
4
|
+
data.tar.gz: 99d5ab5e129ef8623a4d69fc99300c207ce640fa09bbef2c19edb6dbf65526fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9323992b635979e28f25dc8439e6e365cbee5d26b5289d693722efae330eac616ff9e82965ef4e63050cacadba477ad6ef09aa1ab7cae2c5398b061e045d47a
|
7
|
+
data.tar.gz: 927b5c4e90cc1d10e818ff3fbe2e2ae65097bf5d9cdf7b12dca78e07547ceabd6c29682ede711c1e84510a4e7291809c431500c00dfd5365e153fd60412b2e14
|
data/Gemfile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.4
|
data/agra_api.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: agra_api 0.3.
|
5
|
+
# stub: agra_api 0.3.4 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "agra_api".freeze
|
9
|
-
s.version = "0.3.
|
9
|
+
s.version = "0.3.4"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Nathan Woodhull".freeze]
|
14
|
-
s.date = "2018-12-
|
14
|
+
s.date = "2018-12-04"
|
15
15
|
s.description = "Agra is a distributed petitions platform, this is a gem for talking to it's API".freeze
|
16
16
|
s.email = "nathan@controlshiftlabs.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
@@ -50,7 +50,7 @@ Gem::Specification.new do |s|
|
|
50
50
|
s.specification_version = 4
|
51
51
|
|
52
52
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
53
|
-
s.add_runtime_dependency(%q<vertebrae>.freeze, ["~> 0.
|
53
|
+
s.add_runtime_dependency(%q<vertebrae>.freeze, ["~> 0.5.0"])
|
54
54
|
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.6"])
|
55
55
|
s.add_development_dependency(%q<webmock>.freeze, [">= 3.0.1", "~> 3.0"])
|
56
56
|
s.add_development_dependency(%q<pry>.freeze, [">= 0.10.4", "~> 0.10"])
|
@@ -58,7 +58,7 @@ Gem::Specification.new do |s|
|
|
58
58
|
s.add_development_dependency(%q<bundler>.freeze, [">= 1.16.1", "~> 1.16"])
|
59
59
|
s.add_development_dependency(%q<juwelier>.freeze, [">= 2.4.7", "~> 2.4"])
|
60
60
|
else
|
61
|
-
s.add_dependency(%q<vertebrae>.freeze, ["~> 0.
|
61
|
+
s.add_dependency(%q<vertebrae>.freeze, ["~> 0.5.0"])
|
62
62
|
s.add_dependency(%q<rspec>.freeze, ["~> 3.6"])
|
63
63
|
s.add_dependency(%q<webmock>.freeze, [">= 3.0.1", "~> 3.0"])
|
64
64
|
s.add_dependency(%q<pry>.freeze, [">= 0.10.4", "~> 0.10"])
|
@@ -67,7 +67,7 @@ Gem::Specification.new do |s|
|
|
67
67
|
s.add_dependency(%q<juwelier>.freeze, [">= 2.4.7", "~> 2.4"])
|
68
68
|
end
|
69
69
|
else
|
70
|
-
s.add_dependency(%q<vertebrae>.freeze, ["~> 0.
|
70
|
+
s.add_dependency(%q<vertebrae>.freeze, ["~> 0.5.0"])
|
71
71
|
s.add_dependency(%q<rspec>.freeze, ["~> 3.6"])
|
72
72
|
s.add_dependency(%q<webmock>.freeze, [">= 3.0.1", "~> 3.0"])
|
73
73
|
s.add_dependency(%q<pry>.freeze, [">= 0.10.4", "~> 0.10"])
|
data/lib/agra_api/client.rb
CHANGED
@@ -41,7 +41,9 @@ module AgraApi
|
|
41
41
|
connection.stack do |builder|
|
42
42
|
builder.use Faraday::Request::Multipart
|
43
43
|
builder.use Faraday::Request::UrlEncoded
|
44
|
-
|
44
|
+
if connection.configuration.authenticated?
|
45
|
+
builder.use Faraday::Request::BasicAuthentication, connection.configuration.username, connection.configuration.password
|
46
|
+
end
|
45
47
|
|
46
48
|
builder.use Faraday::Response::Logger if ENV['DEBUG']
|
47
49
|
|
@@ -53,4 +55,4 @@ module AgraApi
|
|
53
55
|
end
|
54
56
|
end
|
55
57
|
end
|
56
|
-
end
|
58
|
+
end
|
data/lib/agra_api/signature.rb
CHANGED
@@ -3,12 +3,12 @@ module AgraApi
|
|
3
3
|
attr_accessor :petition_id
|
4
4
|
|
5
5
|
def base_path
|
6
|
-
"
|
6
|
+
"petitions/#{petition_id}/signatures"
|
7
7
|
end
|
8
8
|
|
9
9
|
def find_by_email(email_address)
|
10
10
|
begin
|
11
|
-
response = client.get_request("#{normalized_base_path}
|
11
|
+
response = client.get_request("#{normalized_base_path}lookup", email: email_address)
|
12
12
|
response.body
|
13
13
|
rescue Vertebrae::ResponseError => e
|
14
14
|
if e.status_code == 404
|
data/spec/organisation_spec.rb
CHANGED
@@ -14,8 +14,7 @@ describe AgraApi::Organisation do
|
|
14
14
|
let(:request_path) { '/api/organisations/?host=foo.com' }
|
15
15
|
|
16
16
|
before(:each) do
|
17
|
-
stub_get(request_path).to_return(:
|
18
|
-
:headers => { content_type: "application/json; charset=utf-8"})
|
17
|
+
stub_get(request_path).to_return(body: body, status: status, headers: {content_type: "application/json; charset=utf-8"})
|
19
18
|
end
|
20
19
|
|
21
20
|
describe 'success' do
|
@@ -42,8 +41,8 @@ describe AgraApi::Organisation do
|
|
42
41
|
let(:body) { "" }
|
43
42
|
|
44
43
|
before(:each) do
|
45
|
-
stub_request(:get, "https://
|
46
|
-
|
44
|
+
stub_request(:get, "https://test.com#{request_path}").with(basic_auth: ['username', 'password'])
|
45
|
+
.to_return(body: body, status: status, headers: { content_type: "application/json; charset=utf-8"})
|
47
46
|
end
|
48
47
|
|
49
48
|
|
data/spec/signature_spec.rb
CHANGED
@@ -14,7 +14,8 @@ describe AgraApi::Signature do
|
|
14
14
|
|
15
15
|
describe '#find_by_email' do
|
16
16
|
it 'should perform lookup on agra' do
|
17
|
-
stub_request(:get, "https://
|
17
|
+
stub_request(:get, "https://test.com/api/petitions/#{petition_id}/signatures/lookup?email=#{email_address}")
|
18
|
+
.with(basic_auth: ['username', 'password'])
|
18
19
|
.to_return(:body => {id: 1000, email: email_address}.to_json, :status => 200,
|
19
20
|
:headers => { content_type: "application/json; charset=utf-8"})
|
20
21
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agra_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Woodhull
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: vertebrae
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.5.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.5.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|