agra_api 0.3.4 → 1.0.0
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/.ruby-version +1 -1
- data/CHANGELOG.md +11 -0
- data/Gemfile +3 -13
- data/Rakefile +7 -44
- data/VERSION +1 -1
- data/lib/agra_api/client.rb +21 -9
- metadata +63 -70
- data/.document +0 -5
- data/agra_api.gemspec +0 -79
- data/spec/agra_api_spec.rb +0 -12
- data/spec/client_spec.rb +0 -16
- data/spec/fixtures/organisation.json +0 -51
- data/spec/organisation_spec.rb +0 -57
- data/spec/signature_spec.rb +0 -29
- data/spec/spec_helper.rb +0 -44
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fcfd4038ba326a60dd4478cb4875e7ceebcc5afb671d96036a8c3ba37a575e2a
|
|
4
|
+
data.tar.gz: 7e45c05cd0c02d1e7a03ce485caf4e124464462bcb549762824433eaa6d27f59
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 37e6f5ba08f45852ad3add359fae0657ffcb211e69db132f1c10f31573a1250fa7580fd7251e8da51458eacec5a66f7377692ab58a477aa2cfbcb35446cce851
|
|
7
|
+
data.tar.gz: b18017665a06a76249155a3eef8d88534f9dd0b2f847a25f2661566593fd0157b0116aa89a197bd1bd2f1e2c370355a995e268833762797588326f605358d221
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4.0.1
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [1.0.0] - 2026-02-09
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
- Upgraded to Ruby 4.0.1 compatibility
|
|
7
|
+
- Upgraded Faraday from 1.x to 2.14.1 for Ruby 4.0+ support
|
|
8
|
+
- Upgraded Vertebrae from 0.8.0 to 1.0.5
|
|
9
|
+
- Removed juwelier dependency in favor of standard Bundler gem tasks
|
|
10
|
+
- Updated Faraday middleware to use Faraday 2.x API
|
|
11
|
+
- Simplified Gemfile to use gemspec for dependency management
|
data/Gemfile
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
source "
|
|
1
|
+
source "https://rubygems.org"
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
# Add dependencies to develop your gem here.
|
|
6
|
-
# Include everything needed to run rake, tests, features, etc.
|
|
7
|
-
group :development do
|
|
8
|
-
gem 'rspec', '~> 3.6'
|
|
9
|
-
gem 'webmock', '~> 3.0', '>= 3.0.1'
|
|
10
|
-
gem 'pry', '~> 0.10', '>= 0.10.4'
|
|
11
|
-
gem 'pry-byebug', '~> 3.4', '>= 3.4.2'
|
|
12
|
-
gem 'bundler', '~> 1.16', '>= 1.16.1'
|
|
13
|
-
gem 'juwelier', '~> 2.4', '>= 2.4.7'
|
|
14
|
-
end
|
|
3
|
+
# Specify your gem's dependencies in agra_api.gemspec
|
|
4
|
+
gemspec
|
data/Rakefile
CHANGED
|
@@ -1,49 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require '
|
|
4
|
-
require 'bundler'
|
|
5
|
-
begin
|
|
6
|
-
Bundler.setup(:default, :development)
|
|
7
|
-
rescue Bundler::BundlerError => e
|
|
8
|
-
$stderr.puts e.message
|
|
9
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
|
10
|
-
exit e.status_code
|
|
11
|
-
end
|
|
12
|
-
require 'rake'
|
|
13
|
-
|
|
14
|
-
require 'juwelier'
|
|
15
|
-
Juwelier::Tasks.new do |gem|
|
|
16
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
|
17
|
-
gem.name = "agra_api"
|
|
18
|
-
gem.homepage = "http://github.com/controlshift/agra_api"
|
|
19
|
-
gem.license = "MIT"
|
|
20
|
-
gem.summary = "A very basic agra client gem"
|
|
21
|
-
gem.description = "Agra is a distributed petitions platform, this is a gem for talking to it's API"
|
|
22
|
-
gem.email = "nathan@controlshiftlabs.com"
|
|
23
|
-
gem.authors = ["Nathan Woodhull"]
|
|
24
|
-
# dependencies defined in Gemfile
|
|
25
|
-
end
|
|
26
|
-
Juwelier::RubygemsDotOrgTasks.new
|
|
27
|
-
|
|
28
|
-
require 'rspec/core'
|
|
3
|
+
require 'bundler/gem_tasks'
|
|
29
4
|
require 'rspec/core/rake_task'
|
|
30
|
-
RSpec::Core::RakeTask.new(:spec) do |spec|
|
|
31
|
-
spec.pattern = FileList['spec/**/*_spec.rb']
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
|
35
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
|
36
|
-
spec.rcov = true
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
task :default => :spec
|
|
40
5
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
|
6
|
+
desc 'Default: run specs.'
|
|
7
|
+
task default: :spec
|
|
44
8
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
9
|
+
desc 'Run specs'
|
|
10
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
|
11
|
+
t.pattern = 'spec/**/*_spec.rb'
|
|
49
12
|
end
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
1.0.0
|
data/lib/agra_api/client.rb
CHANGED
|
@@ -38,20 +38,32 @@ module AgraApi
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def setup
|
|
41
|
-
connection.
|
|
42
|
-
|
|
43
|
-
builder.use Faraday::Request::UrlEncoded
|
|
41
|
+
# Override the faraday connection to use Faraday 2.x API
|
|
42
|
+
connection.faraday_connection = Faraday.new(connection.configuration.faraday_options) do |f|
|
|
44
43
|
if connection.configuration.authenticated?
|
|
45
|
-
|
|
44
|
+
f.request :authorization, :basic, connection.configuration.username, connection.configuration.password
|
|
46
45
|
end
|
|
46
|
+
f.request :multipart
|
|
47
|
+
f.request :url_encoded
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
f.response :logger if ENV['DEBUG']
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
unless initialisation_options[:raw]
|
|
52
|
+
f.response :mashify
|
|
53
|
+
f.response :json
|
|
54
|
+
end
|
|
52
55
|
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
f.use Vertebrae::Response::RaiseError
|
|
57
|
+
|
|
58
|
+
# Handle adapter registration - some adapters need to be required separately in Faraday 2.x
|
|
59
|
+
adapter_name = connection.configuration.adapter
|
|
60
|
+
begin
|
|
61
|
+
f.adapter adapter_name
|
|
62
|
+
rescue Faraday::Error => e
|
|
63
|
+
# Fall back to default adapter if the requested one isn't available
|
|
64
|
+
warn "Adapter #{adapter_name} not available (#{e.message}), falling back to default"
|
|
65
|
+
f.adapter Faraday.default_adapter
|
|
66
|
+
end
|
|
55
67
|
end
|
|
56
68
|
end
|
|
57
69
|
end
|
metadata
CHANGED
|
@@ -1,178 +1,173 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: agra_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nathan Woodhull
|
|
8
|
-
|
|
8
|
+
- Grey Moore
|
|
9
|
+
- Diego Marcet
|
|
10
|
+
- Owens Ehimen
|
|
9
11
|
bindir: bin
|
|
10
12
|
cert_chain: []
|
|
11
|
-
date:
|
|
13
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
14
|
dependencies:
|
|
13
15
|
- !ruby/object:Gem::Dependency
|
|
14
16
|
name: vertebrae
|
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
|
18
|
+
requirements:
|
|
19
|
+
- - ">="
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: 1.0.5
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
requirements:
|
|
26
|
+
- - ">="
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
version: 1.0.5
|
|
29
|
+
- !ruby/object:Gem::Dependency
|
|
30
|
+
name: faraday
|
|
15
31
|
requirement: !ruby/object:Gem::Requirement
|
|
16
32
|
requirements:
|
|
17
33
|
- - "~>"
|
|
18
34
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
35
|
+
version: '2.0'
|
|
20
36
|
type: :runtime
|
|
21
37
|
prerelease: false
|
|
22
38
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
39
|
requirements:
|
|
24
40
|
- - "~>"
|
|
25
41
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
42
|
+
version: '2.0'
|
|
27
43
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
44
|
+
name: faraday-mashify
|
|
29
45
|
requirement: !ruby/object:Gem::Requirement
|
|
30
46
|
requirements:
|
|
31
47
|
- - "~>"
|
|
32
48
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
34
|
-
type: :
|
|
49
|
+
version: '1.0'
|
|
50
|
+
type: :runtime
|
|
35
51
|
prerelease: false
|
|
36
52
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
53
|
requirements:
|
|
38
54
|
- - "~>"
|
|
39
55
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
56
|
+
version: '1.0'
|
|
41
57
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
58
|
+
name: bundler
|
|
43
59
|
requirement: !ruby/object:Gem::Requirement
|
|
44
60
|
requirements:
|
|
45
61
|
- - ">="
|
|
46
62
|
- !ruby/object:Gem::Version
|
|
47
|
-
version:
|
|
48
|
-
- - "~>"
|
|
49
|
-
- !ruby/object:Gem::Version
|
|
50
|
-
version: '3.0'
|
|
63
|
+
version: '2.0'
|
|
51
64
|
type: :development
|
|
52
65
|
prerelease: false
|
|
53
66
|
version_requirements: !ruby/object:Gem::Requirement
|
|
54
67
|
requirements:
|
|
55
68
|
- - ">="
|
|
56
69
|
- !ruby/object:Gem::Version
|
|
57
|
-
version:
|
|
58
|
-
- - "~>"
|
|
59
|
-
- !ruby/object:Gem::Version
|
|
60
|
-
version: '3.0'
|
|
70
|
+
version: '2.0'
|
|
61
71
|
- !ruby/object:Gem::Dependency
|
|
62
72
|
name: pry
|
|
63
73
|
requirement: !ruby/object:Gem::Requirement
|
|
64
74
|
requirements:
|
|
65
75
|
- - ">="
|
|
66
76
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: 0
|
|
68
|
-
- - "~>"
|
|
69
|
-
- !ruby/object:Gem::Version
|
|
70
|
-
version: '0.10'
|
|
77
|
+
version: '0'
|
|
71
78
|
type: :development
|
|
72
79
|
prerelease: false
|
|
73
80
|
version_requirements: !ruby/object:Gem::Requirement
|
|
74
81
|
requirements:
|
|
75
82
|
- - ">="
|
|
76
83
|
- !ruby/object:Gem::Version
|
|
77
|
-
version: 0
|
|
78
|
-
- - "~>"
|
|
79
|
-
- !ruby/object:Gem::Version
|
|
80
|
-
version: '0.10'
|
|
84
|
+
version: '0'
|
|
81
85
|
- !ruby/object:Gem::Dependency
|
|
82
86
|
name: pry-byebug
|
|
83
87
|
requirement: !ruby/object:Gem::Requirement
|
|
84
88
|
requirements:
|
|
85
89
|
- - ">="
|
|
86
90
|
- !ruby/object:Gem::Version
|
|
87
|
-
version:
|
|
88
|
-
- - "~>"
|
|
89
|
-
- !ruby/object:Gem::Version
|
|
90
|
-
version: '3.4'
|
|
91
|
+
version: '0'
|
|
91
92
|
type: :development
|
|
92
93
|
prerelease: false
|
|
93
94
|
version_requirements: !ruby/object:Gem::Requirement
|
|
94
95
|
requirements:
|
|
95
96
|
- - ">="
|
|
96
97
|
- !ruby/object:Gem::Version
|
|
97
|
-
version:
|
|
98
|
-
- - "~>"
|
|
99
|
-
- !ruby/object:Gem::Version
|
|
100
|
-
version: '3.4'
|
|
98
|
+
version: '0'
|
|
101
99
|
- !ruby/object:Gem::Dependency
|
|
102
|
-
name:
|
|
100
|
+
name: rake
|
|
103
101
|
requirement: !ruby/object:Gem::Requirement
|
|
104
102
|
requirements:
|
|
105
103
|
- - ">="
|
|
106
104
|
- !ruby/object:Gem::Version
|
|
107
|
-
version:
|
|
108
|
-
- - "~>"
|
|
109
|
-
- !ruby/object:Gem::Version
|
|
110
|
-
version: '1.16'
|
|
105
|
+
version: '0'
|
|
111
106
|
type: :development
|
|
112
107
|
prerelease: false
|
|
113
108
|
version_requirements: !ruby/object:Gem::Requirement
|
|
114
109
|
requirements:
|
|
115
110
|
- - ">="
|
|
116
111
|
- !ruby/object:Gem::Version
|
|
117
|
-
version:
|
|
112
|
+
version: '0'
|
|
113
|
+
- !ruby/object:Gem::Dependency
|
|
114
|
+
name: rspec
|
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
|
116
|
+
requirements:
|
|
117
|
+
- - "~>"
|
|
118
|
+
- !ruby/object:Gem::Version
|
|
119
|
+
version: '3.6'
|
|
120
|
+
type: :development
|
|
121
|
+
prerelease: false
|
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
123
|
+
requirements:
|
|
118
124
|
- - "~>"
|
|
119
125
|
- !ruby/object:Gem::Version
|
|
120
|
-
version: '
|
|
126
|
+
version: '3.6'
|
|
121
127
|
- !ruby/object:Gem::Dependency
|
|
122
|
-
name:
|
|
128
|
+
name: webmock
|
|
123
129
|
requirement: !ruby/object:Gem::Requirement
|
|
124
130
|
requirements:
|
|
125
|
-
- - ">="
|
|
126
|
-
- !ruby/object:Gem::Version
|
|
127
|
-
version: 2.4.7
|
|
128
131
|
- - "~>"
|
|
129
132
|
- !ruby/object:Gem::Version
|
|
130
|
-
version: '
|
|
133
|
+
version: '3.0'
|
|
131
134
|
type: :development
|
|
132
135
|
prerelease: false
|
|
133
136
|
version_requirements: !ruby/object:Gem::Requirement
|
|
134
137
|
requirements:
|
|
135
|
-
- - ">="
|
|
136
|
-
- !ruby/object:Gem::Version
|
|
137
|
-
version: 2.4.7
|
|
138
138
|
- - "~>"
|
|
139
139
|
- !ruby/object:Gem::Version
|
|
140
|
-
version: '
|
|
140
|
+
version: '3.0'
|
|
141
141
|
description: Agra is a distributed petitions platform, this is a gem for talking to
|
|
142
|
-
|
|
143
|
-
email:
|
|
142
|
+
its API
|
|
143
|
+
email:
|
|
144
|
+
- talk@controlshiftlabs.com
|
|
144
145
|
executables: []
|
|
145
146
|
extensions: []
|
|
146
|
-
extra_rdoc_files:
|
|
147
|
-
- LICENSE.txt
|
|
148
|
-
- README.rdoc
|
|
147
|
+
extra_rdoc_files: []
|
|
149
148
|
files:
|
|
150
|
-
- ".document"
|
|
151
149
|
- ".rspec"
|
|
152
150
|
- ".ruby-gemset"
|
|
153
151
|
- ".ruby-version"
|
|
152
|
+
- CHANGELOG.md
|
|
154
153
|
- Gemfile
|
|
155
154
|
- LICENSE.txt
|
|
156
155
|
- README.rdoc
|
|
157
156
|
- Rakefile
|
|
158
157
|
- VERSION
|
|
159
|
-
- agra_api.gemspec
|
|
160
158
|
- lib/agra_api.rb
|
|
161
159
|
- lib/agra_api/base.rb
|
|
162
160
|
- lib/agra_api/client.rb
|
|
163
161
|
- lib/agra_api/organisation.rb
|
|
164
162
|
- lib/agra_api/signature.rb
|
|
165
|
-
|
|
166
|
-
- spec/client_spec.rb
|
|
167
|
-
- spec/fixtures/organisation.json
|
|
168
|
-
- spec/organisation_spec.rb
|
|
169
|
-
- spec/signature_spec.rb
|
|
170
|
-
- spec/spec_helper.rb
|
|
171
|
-
homepage: http://github.com/controlshift/agra_api
|
|
163
|
+
homepage: https://github.com/controlshift/agra_api
|
|
172
164
|
licenses:
|
|
173
165
|
- MIT
|
|
174
|
-
metadata:
|
|
175
|
-
|
|
166
|
+
metadata:
|
|
167
|
+
homepage_uri: https://github.com/controlshift/agra_api
|
|
168
|
+
source_code_uri: https://github.com/controlshift/agra_api
|
|
169
|
+
rubygems_mfa_required: 'true'
|
|
170
|
+
changelog_uri: https://github.com/controlshift/agra_api/blob/main/CHANGELOG.md
|
|
176
171
|
rdoc_options: []
|
|
177
172
|
require_paths:
|
|
178
173
|
- lib
|
|
@@ -180,16 +175,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
180
175
|
requirements:
|
|
181
176
|
- - ">="
|
|
182
177
|
- !ruby/object:Gem::Version
|
|
183
|
-
version:
|
|
178
|
+
version: 4.0.0
|
|
184
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
180
|
requirements:
|
|
186
181
|
- - ">="
|
|
187
182
|
- !ruby/object:Gem::Version
|
|
188
183
|
version: '0'
|
|
189
184
|
requirements: []
|
|
190
|
-
|
|
191
|
-
rubygems_version: 2.7.6
|
|
192
|
-
signing_key:
|
|
185
|
+
rubygems_version: 4.0.3
|
|
193
186
|
specification_version: 4
|
|
194
187
|
summary: A very basic agra client gem
|
|
195
188
|
test_files: []
|
data/.document
DELETED
data/agra_api.gemspec
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
# Generated by juwelier
|
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
-
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
|
-
# -*- encoding: utf-8 -*-
|
|
5
|
-
# stub: agra_api 0.3.4 ruby lib
|
|
6
|
-
|
|
7
|
-
Gem::Specification.new do |s|
|
|
8
|
-
s.name = "agra_api".freeze
|
|
9
|
-
s.version = "0.3.4"
|
|
10
|
-
|
|
11
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
12
|
-
s.require_paths = ["lib".freeze]
|
|
13
|
-
s.authors = ["Nathan Woodhull".freeze]
|
|
14
|
-
s.date = "2018-12-04"
|
|
15
|
-
s.description = "Agra is a distributed petitions platform, this is a gem for talking to it's API".freeze
|
|
16
|
-
s.email = "nathan@controlshiftlabs.com".freeze
|
|
17
|
-
s.extra_rdoc_files = [
|
|
18
|
-
"LICENSE.txt",
|
|
19
|
-
"README.rdoc"
|
|
20
|
-
]
|
|
21
|
-
s.files = [
|
|
22
|
-
".document",
|
|
23
|
-
".rspec",
|
|
24
|
-
".ruby-gemset",
|
|
25
|
-
".ruby-version",
|
|
26
|
-
"Gemfile",
|
|
27
|
-
"LICENSE.txt",
|
|
28
|
-
"README.rdoc",
|
|
29
|
-
"Rakefile",
|
|
30
|
-
"VERSION",
|
|
31
|
-
"agra_api.gemspec",
|
|
32
|
-
"lib/agra_api.rb",
|
|
33
|
-
"lib/agra_api/base.rb",
|
|
34
|
-
"lib/agra_api/client.rb",
|
|
35
|
-
"lib/agra_api/organisation.rb",
|
|
36
|
-
"lib/agra_api/signature.rb",
|
|
37
|
-
"spec/agra_api_spec.rb",
|
|
38
|
-
"spec/client_spec.rb",
|
|
39
|
-
"spec/fixtures/organisation.json",
|
|
40
|
-
"spec/organisation_spec.rb",
|
|
41
|
-
"spec/signature_spec.rb",
|
|
42
|
-
"spec/spec_helper.rb"
|
|
43
|
-
]
|
|
44
|
-
s.homepage = "http://github.com/controlshift/agra_api".freeze
|
|
45
|
-
s.licenses = ["MIT".freeze]
|
|
46
|
-
s.rubygems_version = "2.7.6".freeze
|
|
47
|
-
s.summary = "A very basic agra client gem".freeze
|
|
48
|
-
|
|
49
|
-
if s.respond_to? :specification_version then
|
|
50
|
-
s.specification_version = 4
|
|
51
|
-
|
|
52
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
53
|
-
s.add_runtime_dependency(%q<vertebrae>.freeze, ["~> 0.5.0"])
|
|
54
|
-
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.6"])
|
|
55
|
-
s.add_development_dependency(%q<webmock>.freeze, [">= 3.0.1", "~> 3.0"])
|
|
56
|
-
s.add_development_dependency(%q<pry>.freeze, [">= 0.10.4", "~> 0.10"])
|
|
57
|
-
s.add_development_dependency(%q<pry-byebug>.freeze, [">= 3.4.2", "~> 3.4"])
|
|
58
|
-
s.add_development_dependency(%q<bundler>.freeze, [">= 1.16.1", "~> 1.16"])
|
|
59
|
-
s.add_development_dependency(%q<juwelier>.freeze, [">= 2.4.7", "~> 2.4"])
|
|
60
|
-
else
|
|
61
|
-
s.add_dependency(%q<vertebrae>.freeze, ["~> 0.5.0"])
|
|
62
|
-
s.add_dependency(%q<rspec>.freeze, ["~> 3.6"])
|
|
63
|
-
s.add_dependency(%q<webmock>.freeze, [">= 3.0.1", "~> 3.0"])
|
|
64
|
-
s.add_dependency(%q<pry>.freeze, [">= 0.10.4", "~> 0.10"])
|
|
65
|
-
s.add_dependency(%q<pry-byebug>.freeze, [">= 3.4.2", "~> 3.4"])
|
|
66
|
-
s.add_dependency(%q<bundler>.freeze, [">= 1.16.1", "~> 1.16"])
|
|
67
|
-
s.add_dependency(%q<juwelier>.freeze, [">= 2.4.7", "~> 2.4"])
|
|
68
|
-
end
|
|
69
|
-
else
|
|
70
|
-
s.add_dependency(%q<vertebrae>.freeze, ["~> 0.5.0"])
|
|
71
|
-
s.add_dependency(%q<rspec>.freeze, ["~> 3.6"])
|
|
72
|
-
s.add_dependency(%q<webmock>.freeze, [">= 3.0.1", "~> 3.0"])
|
|
73
|
-
s.add_dependency(%q<pry>.freeze, [">= 0.10.4", "~> 0.10"])
|
|
74
|
-
s.add_dependency(%q<pry-byebug>.freeze, [">= 3.4.2", "~> 3.4"])
|
|
75
|
-
s.add_dependency(%q<bundler>.freeze, [">= 1.16.1", "~> 1.16"])
|
|
76
|
-
s.add_dependency(%q<juwelier>.freeze, [">= 2.4.7", "~> 2.4"])
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
data/spec/agra_api_spec.rb
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
-
|
|
3
|
-
describe AgraApi do
|
|
4
|
-
before(:each) do
|
|
5
|
-
allow(AgraApi::Client).to receive(:setup_client)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
specify { expect(subject).to respond_to(:organisation) }
|
|
9
|
-
specify { expect(subject.new).to be_a(AgraApi::Client)}
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
|
data/spec/client_spec.rb
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
-
|
|
3
|
-
describe AgraApi::Client do
|
|
4
|
-
|
|
5
|
-
describe "instantiated" do
|
|
6
|
-
subject { described_class.new(options) }
|
|
7
|
-
|
|
8
|
-
context 'process_basic_auth' do
|
|
9
|
-
let(:options) { { :basic_auth => 'login:password' } }
|
|
10
|
-
let(:config) { subject.connection.configuration }
|
|
11
|
-
specify { expect(config.username).to eq 'login' }
|
|
12
|
-
specify { expect(config.password).to eq 'password' }
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
end
|
|
16
|
-
end
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
{"admin_email": "info@controlshiftlabs.com", "blog_link": "", "campaigner_feedback_link": "", "contact_email": "info@controlshiftlabs.com", "created_at": "2013-04-15T13:31:49-04:00", "facebook_url": "", "google_analytics_tracking_id": "", "host": "localhost", "id": 1, "name": "Default Org", "parent_name": "", "parent_url": "", "placeholder_content_type": null, "placeholder_file_name": null, "placeholder_file_size": null, "placeholder_updated_at": null, "preferred_locale": "en", "sendgrid_password": null, "sendgrid_username": null, "settings": {
|
|
2
|
-
"show_petition_category_on_creation": "0",
|
|
3
|
-
"requires_user_confirmation_on_sign_up": "0",
|
|
4
|
-
"requires_location_for_campaign": "1",
|
|
5
|
-
"always_join_parent_org_when_sign_up": "0",
|
|
6
|
-
"hide_signatures_csv_download_link": "0",
|
|
7
|
-
"hide_phone_number_on_signature_form": "0",
|
|
8
|
-
"show_categories_as_dropdown": "0",
|
|
9
|
-
"list_petitions_under_map": "0",
|
|
10
|
-
"expose_broadcast_emails": "1",
|
|
11
|
-
"home_link_override": "",
|
|
12
|
-
"signature_disclaimer": "",
|
|
13
|
-
"new_account_disclaimer": "",
|
|
14
|
-
"join_label": "",
|
|
15
|
-
"country": "",
|
|
16
|
-
"google_maps_key": "",
|
|
17
|
-
"enable_facebook_login": "1",
|
|
18
|
-
"fb_app_id": "bar",
|
|
19
|
-
"fb_app_secret": "foo",
|
|
20
|
-
"notifiers": "actionkit",
|
|
21
|
-
"bsd_host": "",
|
|
22
|
-
"bsd_api_id": "",
|
|
23
|
-
"bsd_api_secret": "",
|
|
24
|
-
"salesforce_host": "",
|
|
25
|
-
"salesforce_consumer_key": "",
|
|
26
|
-
"salesforce_consumer_secret": "",
|
|
27
|
-
"salesforce_username": "",
|
|
28
|
-
"salesforce_security_token": "",
|
|
29
|
-
"action_kit_host": "foo.com",
|
|
30
|
-
"action_kit_username": "bar",
|
|
31
|
-
"action_kit_password": "foo",
|
|
32
|
-
"action_kit_country": "",
|
|
33
|
-
"action_kit_signature_page": "",
|
|
34
|
-
"action_kit_petition_page": "",
|
|
35
|
-
"long_name": "long name",
|
|
36
|
-
"phone_number_not_mandatory_on_registration": "0",
|
|
37
|
-
"action_kit_tag_id": [1, 4],
|
|
38
|
-
"action_kit_tag_ids": [
|
|
39
|
-
[1, 4]
|
|
40
|
-
],
|
|
41
|
-
"preferred_language": "en",
|
|
42
|
-
"tijuana_host": "test",
|
|
43
|
-
"tijuana_username": "test",
|
|
44
|
-
"tijuana_password": "test",
|
|
45
|
-
"supported_languages": ["en"],
|
|
46
|
-
"signature_fields_override": "",
|
|
47
|
-
"purpose_host": "host",
|
|
48
|
-
"purpose_username": "usern",
|
|
49
|
-
"purpose_password": "pass",
|
|
50
|
-
"purpose_movement_id": "movement"
|
|
51
|
-
}, "slug": "gsanetwork", "time_zone": "Eastern Time (US & Canada)", "twitter_account_name": "", "updated_at": "2013-10-18T14:43:03-04:00", "user_feedback_link": "", "uservoice_widget_link": ""}
|
data/spec/organisation_spec.rb
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
-
|
|
3
|
-
describe AgraApi::Organisation do
|
|
4
|
-
subject { AgraApi.new(host: 'test.com') }
|
|
5
|
-
|
|
6
|
-
describe 'configuration' do
|
|
7
|
-
it 'should propagate the host' do
|
|
8
|
-
expect(subject.organisation.client.connection.configuration.host).to eq('test.com')
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
describe 'find_by_host' do
|
|
13
|
-
let(:body) { fixture('organisation.json') }
|
|
14
|
-
let(:request_path) { '/api/organisations/?host=foo.com' }
|
|
15
|
-
|
|
16
|
-
before(:each) do
|
|
17
|
-
stub_get(request_path).to_return(body: body, status: status, headers: {content_type: "application/json; charset=utf-8"})
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
describe 'success' do
|
|
21
|
-
let(:status) { 200 }
|
|
22
|
-
let(:organisation) { subject.organisation.find_by_host('foo.com') }
|
|
23
|
-
|
|
24
|
-
it 'should find an organisation' do
|
|
25
|
-
expect(organisation.settings.action_kit_host).to eq('foo.com')
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
describe 'an error' do
|
|
30
|
-
let(:status) { 500 }
|
|
31
|
-
|
|
32
|
-
it 'should raise' do
|
|
33
|
-
expect { subject.organisation.find_by_host('foo.com') }.to raise_exception(StandardError)
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
describe "basic authentication" do
|
|
39
|
-
subject { AgraApi.new(host: 'test.com', username: 'username', password: 'password')}
|
|
40
|
-
let(:request_path) { '/api/organisations/?host=foo.com' }
|
|
41
|
-
let(:body) { "" }
|
|
42
|
-
|
|
43
|
-
before(:each) do
|
|
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"})
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
describe "unauthorized" do
|
|
50
|
-
let(:status) { 401 }
|
|
51
|
-
|
|
52
|
-
it "should raise" do
|
|
53
|
-
expect { subject.organisation.find_by_host('foo.com') }.to raise_exception(StandardError)
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
data/spec/signature_spec.rb
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
-
|
|
3
|
-
describe AgraApi::Signature do
|
|
4
|
-
let(:petition_id) { 999 }
|
|
5
|
-
let(:email_address) { 'pedro@test.com' }
|
|
6
|
-
|
|
7
|
-
subject { AgraApi.new(host: 'test.com', username: 'username', password: 'password').signature(petition_id) }
|
|
8
|
-
|
|
9
|
-
describe 'configuration' do
|
|
10
|
-
it 'should propagate the host' do
|
|
11
|
-
expect(subject.client.connection.configuration.host).to eq('test.com')
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
describe '#find_by_email' do
|
|
16
|
-
it 'should perform lookup on agra' do
|
|
17
|
-
stub_request(:get, "https://test.com/api/petitions/#{petition_id}/signatures/lookup?email=#{email_address}")
|
|
18
|
-
.with(basic_auth: ['username', 'password'])
|
|
19
|
-
.to_return(:body => {id: 1000, email: email_address}.to_json, :status => 200,
|
|
20
|
-
:headers => { content_type: "application/json; charset=utf-8"})
|
|
21
|
-
|
|
22
|
-
signature = subject.find_by_email(email_address)
|
|
23
|
-
|
|
24
|
-
expect(signature).not_to be_nil
|
|
25
|
-
expect(signature.id).to eq 1000
|
|
26
|
-
expect(signature.email).to eq email_address
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
data/spec/spec_helper.rb
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
2
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
3
|
-
require 'rspec'
|
|
4
|
-
require 'webmock/rspec'
|
|
5
|
-
require 'agra_api'
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
# Requires supporting files with custom matchers and macros, etc,
|
|
9
|
-
# in ./support/ and its subdirectories.
|
|
10
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
RSpec.configure do |config|
|
|
14
|
-
config.include WebMock::API
|
|
15
|
-
|
|
16
|
-
config.before(:each) do
|
|
17
|
-
WebMock.reset!
|
|
18
|
-
end
|
|
19
|
-
config.after(:each) do
|
|
20
|
-
WebMock.reset!
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def stub_get(path)
|
|
26
|
-
stub_agra_request(:get, path)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def stub_post(path)
|
|
30
|
-
stub_agra_request(:post, path)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def stub_agra_request(method, path)
|
|
34
|
-
prefix = AgraApi.new.connection.configuration.prefix.to_s
|
|
35
|
-
stub_request(method, "https://test.com" + prefix + path)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def fixture_path
|
|
39
|
-
File.expand_path("../fixtures", __FILE__)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def fixture(file)
|
|
43
|
-
File.new(File.join(fixture_path, '/', file))
|
|
44
|
-
end
|