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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2dcf75b896f9dbafbc1c5594cf2690ef907dcd39456524ec64ea0f36981e24d4
4
- data.tar.gz: 88e0f39a837d61161d22c7674a85c6cdefbb63f9fcc95eee5724aa88d26f7941
3
+ metadata.gz: aaf282bc7f816f9c0d883d5df1bf9b545f7254761c5ff95bc9f10356a16ecd76
4
+ data.tar.gz: 99d5ab5e129ef8623a4d69fc99300c207ce640fa09bbef2c19edb6dbf65526fa
5
5
  SHA512:
6
- metadata.gz: e22615eefd513c9a7f51e1da33bca010df5f0e3b3eaa06f1122dbf5fe29de832d7d5fc1f14c54de95cefc1262f0b8016286fe223aeb2875ca60902e3211a000a
7
- data.tar.gz: 4418576daf8b6013c7c95e1516fff56d41d190708bc10d04656685a27f8a12aed6c9db291acb72fa07e64309fa70fbe502faf182451a386a5124dbb3d750d9ed
6
+ metadata.gz: e9323992b635979e28f25dc8439e6e365cbee5d26b5289d693722efae330eac616ff9e82965ef4e63050cacadba477ad6ef09aa1ab7cae2c5398b061e045d47a
7
+ data.tar.gz: 927b5c4e90cc1d10e818ff3fbe2e2ae65097bf5d9cdf7b12dca78e07547ceabd6c29682ede711c1e84510a4e7291809c431500c00dfd5365e153fd60412b2e14
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem 'vertebrae', '~> 0.4.3'
3
+ gem 'vertebrae', '~> 0.5.0'
4
4
 
5
5
  # Add dependencies to develop your gem here.
6
6
  # Include everything needed to run rake, tests, features, etc.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.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.3 ruby lib
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.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-03"
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.4.3"])
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.4.3"])
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.4.3"])
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"])
@@ -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
- builder.use Vertebrae::Request::BasicAuth, connection.configuration.authentication if connection.configuration.authenticated?
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
@@ -3,12 +3,12 @@ module AgraApi
3
3
  attr_accessor :petition_id
4
4
 
5
5
  def base_path
6
- "/petitions/#{petition_id}/signatures"
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}/lookup", email: email_address)
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
@@ -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(:body => body, :status => status,
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://username:password@test.com#{request_path}").to_return(:body => body, :status => status,
46
- :headers => { content_type: "application/json; charset=utf-8"})
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
 
@@ -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://username:password@test.com/api/petitions/#{petition_id}/signatures/lookup?email=#{email_address}")
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
@@ -1,7 +1,7 @@
1
1
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  $LOAD_PATH.unshift(File.dirname(__FILE__))
3
3
  require 'rspec'
4
- require 'webmock'
4
+ require 'webmock/rspec'
5
5
  require 'agra_api'
6
6
 
7
7
 
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.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-03 00:00:00.000000000 Z
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.4.3
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.4.3
26
+ version: 0.5.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement