nation_builder 0.0.17 → 0.1.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/README.md +5 -1
- data/lib/nation_builder/version.rb +3 -0
- data/lib/nation_builder.rb +1 -0
- metadata +21 -126
- data/.document +0 -5
- data/.github/workflows/ci.yml +0 -14
- data/.rspec +0 -1
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/Gemfile +0 -14
- data/Rakefile +0 -49
- data/VERSION +0 -1
- data/nation_builder.gemspec +0 -80
- data/spec/client_spec.rb +0 -113
- data/spec/fixtures/not_found +0 -1
- data/spec/fixtures/people_list_empty +0 -1
- data/spec/fixtures/people_list_success +0 -1
- data/spec/nation_builder_spec.rb +0 -10
- data/spec/people_spec.rb +0 -36
- data/spec/spec_helper.rb +0 -46
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 76dac9cb65a18a1de882d3c09d8ee877b12f262587a98ecbb919daae289b97c0
|
|
4
|
+
data.tar.gz: ed38716af07051c5533e1d1e8e0d77041a2a5cedab180f01e804c8a7d5997dae
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fbcb1dec8a06e33f499bc66813c9297cf9675b130fe44ae45f11efc4ff47f0660528683b6f2fef0b2ca1b5c58b9cf5d7c892ec984ffa0de4b17b67eb212001cb
|
|
7
|
+
data.tar.gz: 6605e5f4355acaccd03f3cfb9b03c29245efa06912a765a9c23145ff0a029666222fddc80f55e7410d40803da7aa411290e781dc1ee8c9850928febede036bf1
|
data/README.md
CHANGED
|
@@ -10,7 +10,7 @@ http://nationbuilder.com/api_documentation
|
|
|
10
10
|
require 'nation_builder'
|
|
11
11
|
client = NationBuilder.new(hostname: 'whatever.nationbuilder.com', client_id: 'id', client_secret: 'secret', username: 'you@nation.com', password: 'pass')
|
|
12
12
|
client.people.create('person' => {'first_name' => 'George', 'last_name' => 'Washington', 'email' => 'george@washington.com'})
|
|
13
|
-
client.people.match('email' => 'george@washington.com) # either a person hash or nil.
|
|
13
|
+
client.people.match('email' => 'george@washington.com') # either a person hash or nil.
|
|
14
14
|
client.people.list # returns people in nation
|
|
15
15
|
client.tags.list # all tags.
|
|
16
16
|
```
|
|
@@ -21,6 +21,10 @@ The current gem is minimalist -- but we'd welcome pull requests with additional
|
|
|
21
21
|
|
|
22
22
|
[](https://github.com/controlshift/nation_builder/actions/workflows/ci.yml)
|
|
23
23
|
|
|
24
|
+
### Release
|
|
25
|
+
|
|
26
|
+
Bump `NationBuilder::VERSION` in `lib/nation_builder/version.rb`, merge to main, then run `bundle exec rake release`.
|
|
27
|
+
|
|
24
28
|
### Copyright
|
|
25
29
|
|
|
26
30
|
Copyright (c) 2013 ControlShift Ltd. See LICENSE.txt for
|
data/lib/nation_builder.rb
CHANGED
metadata
CHANGED
|
@@ -1,164 +1,66 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nation_builder
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nathan Woodhull
|
|
8
8
|
- Dan Schneiderman
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
|
-
name:
|
|
14
|
+
name: activesupport
|
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
|
17
16
|
requirements:
|
|
18
17
|
- - ">="
|
|
19
18
|
- !ruby/object:Gem::Version
|
|
20
|
-
version: '0'
|
|
19
|
+
version: '7.0'
|
|
21
20
|
type: :runtime
|
|
22
21
|
prerelease: false
|
|
23
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
23
|
requirements:
|
|
25
24
|
- - ">="
|
|
26
25
|
- !ruby/object:Gem::Version
|
|
27
|
-
version: '0'
|
|
26
|
+
version: '7.0'
|
|
28
27
|
- !ruby/object:Gem::Dependency
|
|
29
28
|
name: json
|
|
30
29
|
requirement: !ruby/object:Gem::Requirement
|
|
31
30
|
requirements:
|
|
32
|
-
- - "
|
|
33
|
-
- !ruby/object:Gem::Version
|
|
34
|
-
version: '2.1'
|
|
35
|
-
type: :runtime
|
|
36
|
-
prerelease: false
|
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
38
|
-
requirements:
|
|
39
|
-
- - "~>"
|
|
31
|
+
- - ">="
|
|
40
32
|
- !ruby/object:Gem::Version
|
|
41
33
|
version: '2.1'
|
|
42
|
-
- !ruby/object:Gem::Dependency
|
|
43
|
-
name: activesupport
|
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
|
45
|
-
requirements:
|
|
46
|
-
- - ">"
|
|
47
|
-
- !ruby/object:Gem::Version
|
|
48
|
-
version: 3.0.0
|
|
49
34
|
type: :runtime
|
|
50
35
|
prerelease: false
|
|
51
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
52
37
|
requirements:
|
|
53
|
-
- - ">"
|
|
54
|
-
- !ruby/object:Gem::Version
|
|
55
|
-
version: 3.0.0
|
|
56
|
-
- !ruby/object:Gem::Dependency
|
|
57
|
-
name: webmock
|
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
|
59
|
-
requirements:
|
|
60
|
-
- - "~>"
|
|
61
|
-
- !ruby/object:Gem::Version
|
|
62
|
-
version: '3.0'
|
|
63
|
-
- - ">="
|
|
64
|
-
- !ruby/object:Gem::Version
|
|
65
|
-
version: 3.0.1
|
|
66
|
-
type: :development
|
|
67
|
-
prerelease: false
|
|
68
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
69
|
-
requirements:
|
|
70
|
-
- - "~>"
|
|
71
|
-
- !ruby/object:Gem::Version
|
|
72
|
-
version: '3.0'
|
|
73
38
|
- - ">="
|
|
74
39
|
- !ruby/object:Gem::Version
|
|
75
|
-
version:
|
|
76
|
-
- !ruby/object:Gem::Dependency
|
|
77
|
-
name: byebug
|
|
78
|
-
requirement: !ruby/object:Gem::Requirement
|
|
79
|
-
requirements:
|
|
80
|
-
- - "~>"
|
|
81
|
-
- !ruby/object:Gem::Version
|
|
82
|
-
version: '9.0'
|
|
83
|
-
- - ">="
|
|
84
|
-
- !ruby/object:Gem::Version
|
|
85
|
-
version: 9.0.6
|
|
86
|
-
type: :development
|
|
87
|
-
prerelease: false
|
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
89
|
-
requirements:
|
|
90
|
-
- - "~>"
|
|
91
|
-
- !ruby/object:Gem::Version
|
|
92
|
-
version: '9.0'
|
|
93
|
-
- - ">="
|
|
94
|
-
- !ruby/object:Gem::Version
|
|
95
|
-
version: 9.0.6
|
|
96
|
-
- !ruby/object:Gem::Dependency
|
|
97
|
-
name: rspec
|
|
98
|
-
requirement: !ruby/object:Gem::Requirement
|
|
99
|
-
requirements:
|
|
100
|
-
- - "~>"
|
|
101
|
-
- !ruby/object:Gem::Version
|
|
102
|
-
version: '3.6'
|
|
103
|
-
type: :development
|
|
104
|
-
prerelease: false
|
|
105
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
106
|
-
requirements:
|
|
107
|
-
- - "~>"
|
|
108
|
-
- !ruby/object:Gem::Version
|
|
109
|
-
version: '3.6'
|
|
110
|
-
- !ruby/object:Gem::Dependency
|
|
111
|
-
name: bundler
|
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
|
113
|
-
requirements:
|
|
114
|
-
- - ">="
|
|
115
|
-
- !ruby/object:Gem::Version
|
|
116
|
-
version: '0'
|
|
117
|
-
type: :development
|
|
118
|
-
prerelease: false
|
|
119
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
120
|
-
requirements:
|
|
121
|
-
- - ">="
|
|
122
|
-
- !ruby/object:Gem::Version
|
|
123
|
-
version: '0'
|
|
40
|
+
version: '2.1'
|
|
124
41
|
- !ruby/object:Gem::Dependency
|
|
125
|
-
name:
|
|
42
|
+
name: oauth2
|
|
126
43
|
requirement: !ruby/object:Gem::Requirement
|
|
127
44
|
requirements:
|
|
128
45
|
- - "~>"
|
|
129
46
|
- !ruby/object:Gem::Version
|
|
130
|
-
version: '2.
|
|
131
|
-
|
|
132
|
-
- !ruby/object:Gem::Version
|
|
133
|
-
version: 2.4.7
|
|
134
|
-
type: :development
|
|
47
|
+
version: '2.0'
|
|
48
|
+
type: :runtime
|
|
135
49
|
prerelease: false
|
|
136
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
137
51
|
requirements:
|
|
138
52
|
- - "~>"
|
|
139
53
|
- !ruby/object:Gem::Version
|
|
140
|
-
version: '2.
|
|
141
|
-
- - ">="
|
|
142
|
-
- !ruby/object:Gem::Version
|
|
143
|
-
version: 2.4.7
|
|
54
|
+
version: '2.0'
|
|
144
55
|
description: Ruby wrapper for NationBuilder API
|
|
145
|
-
email:
|
|
56
|
+
email:
|
|
57
|
+
- nathan@controlshiftlabs.com
|
|
146
58
|
executables: []
|
|
147
59
|
extensions: []
|
|
148
|
-
extra_rdoc_files:
|
|
149
|
-
- LICENSE.txt
|
|
150
|
-
- README.md
|
|
60
|
+
extra_rdoc_files: []
|
|
151
61
|
files:
|
|
152
|
-
- ".document"
|
|
153
|
-
- ".github/workflows/ci.yml"
|
|
154
|
-
- ".rspec"
|
|
155
|
-
- ".ruby-gemset"
|
|
156
|
-
- ".ruby-version"
|
|
157
|
-
- Gemfile
|
|
158
62
|
- LICENSE.txt
|
|
159
63
|
- README.md
|
|
160
|
-
- Rakefile
|
|
161
|
-
- VERSION
|
|
162
64
|
- lib/nation_builder.rb
|
|
163
65
|
- lib/nation_builder/actions/create.rb
|
|
164
66
|
- lib/nation_builder/actions/list.rb
|
|
@@ -169,19 +71,13 @@ files:
|
|
|
169
71
|
- lib/nation_builder/people.rb
|
|
170
72
|
- lib/nation_builder/remote_controller.rb
|
|
171
73
|
- lib/nation_builder/tags.rb
|
|
172
|
-
- nation_builder.
|
|
173
|
-
|
|
174
|
-
- spec/fixtures/not_found
|
|
175
|
-
- spec/fixtures/people_list_empty
|
|
176
|
-
- spec/fixtures/people_list_success
|
|
177
|
-
- spec/nation_builder_spec.rb
|
|
178
|
-
- spec/people_spec.rb
|
|
179
|
-
- spec/spec_helper.rb
|
|
180
|
-
homepage: http://github.com/controlshift/nation_builder
|
|
74
|
+
- lib/nation_builder/version.rb
|
|
75
|
+
homepage: https://github.com/controlshift/nation_builder
|
|
181
76
|
licenses:
|
|
182
77
|
- MIT
|
|
183
|
-
metadata:
|
|
184
|
-
|
|
78
|
+
metadata:
|
|
79
|
+
source_code_uri: https://github.com/controlshift/nation_builder
|
|
80
|
+
rubygems_mfa_required: 'true'
|
|
185
81
|
rdoc_options: []
|
|
186
82
|
require_paths:
|
|
187
83
|
- lib
|
|
@@ -189,15 +85,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
189
85
|
requirements:
|
|
190
86
|
- - ">="
|
|
191
87
|
- !ruby/object:Gem::Version
|
|
192
|
-
version: '
|
|
88
|
+
version: '3.3'
|
|
193
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
90
|
requirements:
|
|
195
91
|
- - ">="
|
|
196
92
|
- !ruby/object:Gem::Version
|
|
197
93
|
version: '0'
|
|
198
94
|
requirements: []
|
|
199
|
-
rubygems_version:
|
|
200
|
-
signing_key:
|
|
95
|
+
rubygems_version: 4.0.20
|
|
201
96
|
specification_version: 4
|
|
202
97
|
summary: NationBuilder API wrapper
|
|
203
98
|
test_files: []
|
data/.document
DELETED
data/.github/workflows/ci.yml
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
on: [push]
|
|
3
|
-
|
|
4
|
-
jobs:
|
|
5
|
-
test:
|
|
6
|
-
runs-on: ubuntu-latest
|
|
7
|
-
steps:
|
|
8
|
-
- uses: actions/checkout@v2
|
|
9
|
-
- uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
|
|
10
|
-
with:
|
|
11
|
-
ruby-version: 2.7
|
|
12
|
-
bundler-cache: true
|
|
13
|
-
- run: bundle install
|
|
14
|
-
- run: bundle exec rspec
|
data/.rspec
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
--color
|
data/.ruby-gemset
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
nation_builder
|
data/.ruby-version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2.7.4
|
data/Gemfile
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
source 'http://rubygems.org'
|
|
2
|
-
|
|
3
|
-
# NationBuilder puts error messages in a different location.
|
|
4
|
-
gem 'oauth2', git: 'https://github.com/controlshift/oauth2.git'
|
|
5
|
-
gem 'json', '~> 2.1'
|
|
6
|
-
gem 'activesupport', '>3.0.0'
|
|
7
|
-
|
|
8
|
-
group :development do
|
|
9
|
-
gem 'webmock', '~> 3.0', '>= 3.0.1'
|
|
10
|
-
gem 'byebug', '~> 9.0', '>= 9.0.6'
|
|
11
|
-
gem 'rspec', '~> 3.6'
|
|
12
|
-
gem 'bundler', '>= 0'
|
|
13
|
-
gem 'juwelier', '~> 2.4', '>= 2.4.7'
|
|
14
|
-
end
|
data/Rakefile
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
|
-
require 'rubygems'
|
|
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://guides.rubygems.org/specification-reference/ for more options
|
|
17
|
-
gem.name = "nation_builder"
|
|
18
|
-
gem.homepage = "http://github.com/controlshift/nation_builder"
|
|
19
|
-
gem.license = "MIT"
|
|
20
|
-
gem.summary = "NationBuilder API wrapper"
|
|
21
|
-
gem.description = %Q{Ruby wrapper for NationBuilder API}
|
|
22
|
-
gem.email = "nathan@controlshiftlabs.com"
|
|
23
|
-
gem.authors = ["Nathan Woodhull", "Dan Schneiderman"]
|
|
24
|
-
# dependencies defined in Gemfile
|
|
25
|
-
end
|
|
26
|
-
Juwelier::RubygemsDotOrgTasks.new
|
|
27
|
-
|
|
28
|
-
require 'rspec/core'
|
|
29
|
-
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
|
-
|
|
41
|
-
require 'rdoc/task'
|
|
42
|
-
Rake::RDocTask.new do |rdoc|
|
|
43
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
|
44
|
-
|
|
45
|
-
rdoc.rdoc_dir = 'rdoc'
|
|
46
|
-
rdoc.title = "nation_builder #{version}"
|
|
47
|
-
rdoc.rdoc_files.include('README*')
|
|
48
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
49
|
-
end
|
data/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.0.17
|
data/nation_builder.gemspec
DELETED
|
@@ -1,80 +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: nation_builder 0.0.17 ruby lib
|
|
6
|
-
|
|
7
|
-
Gem::Specification.new do |s|
|
|
8
|
-
s.name = "nation_builder".freeze
|
|
9
|
-
s.version = "0.0.17"
|
|
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, "Dan Schneiderman".freeze]
|
|
14
|
-
s.date = "2021-09-27"
|
|
15
|
-
s.description = "Ruby wrapper for NationBuilder API".freeze
|
|
16
|
-
s.email = "nathan@controlshiftlabs.com".freeze
|
|
17
|
-
s.extra_rdoc_files = [
|
|
18
|
-
"LICENSE.txt",
|
|
19
|
-
"README.md"
|
|
20
|
-
]
|
|
21
|
-
s.files = [
|
|
22
|
-
".document",
|
|
23
|
-
".github/workflows/ci.yml",
|
|
24
|
-
".rspec",
|
|
25
|
-
".ruby-gemset",
|
|
26
|
-
".ruby-version",
|
|
27
|
-
"Gemfile",
|
|
28
|
-
"LICENSE.txt",
|
|
29
|
-
"README.md",
|
|
30
|
-
"Rakefile",
|
|
31
|
-
"VERSION",
|
|
32
|
-
"lib/nation_builder.rb",
|
|
33
|
-
"lib/nation_builder/actions/create.rb",
|
|
34
|
-
"lib/nation_builder/actions/list.rb",
|
|
35
|
-
"lib/nation_builder/actions/show.rb",
|
|
36
|
-
"lib/nation_builder/actions/update.rb",
|
|
37
|
-
"lib/nation_builder/client.rb",
|
|
38
|
-
"lib/nation_builder/exceptions/validation_error.rb",
|
|
39
|
-
"lib/nation_builder/people.rb",
|
|
40
|
-
"lib/nation_builder/remote_controller.rb",
|
|
41
|
-
"lib/nation_builder/tags.rb",
|
|
42
|
-
"nation_builder.gemspec",
|
|
43
|
-
"spec/client_spec.rb",
|
|
44
|
-
"spec/fixtures/not_found",
|
|
45
|
-
"spec/fixtures/people_list_empty",
|
|
46
|
-
"spec/fixtures/people_list_success",
|
|
47
|
-
"spec/nation_builder_spec.rb",
|
|
48
|
-
"spec/people_spec.rb",
|
|
49
|
-
"spec/spec_helper.rb"
|
|
50
|
-
]
|
|
51
|
-
s.homepage = "http://github.com/controlshift/nation_builder".freeze
|
|
52
|
-
s.licenses = ["MIT".freeze]
|
|
53
|
-
s.rubygems_version = "3.1.6".freeze
|
|
54
|
-
s.summary = "NationBuilder API wrapper".freeze
|
|
55
|
-
|
|
56
|
-
if s.respond_to? :specification_version then
|
|
57
|
-
s.specification_version = 4
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
if s.respond_to? :add_runtime_dependency then
|
|
61
|
-
s.add_runtime_dependency(%q<oauth2>.freeze, [">= 0"])
|
|
62
|
-
s.add_runtime_dependency(%q<json>.freeze, ["~> 2.1"])
|
|
63
|
-
s.add_runtime_dependency(%q<activesupport>.freeze, ["> 3.0.0"])
|
|
64
|
-
s.add_development_dependency(%q<webmock>.freeze, ["~> 3.0", ">= 3.0.1"])
|
|
65
|
-
s.add_development_dependency(%q<byebug>.freeze, ["~> 9.0", ">= 9.0.6"])
|
|
66
|
-
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.6"])
|
|
67
|
-
s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
|
|
68
|
-
s.add_development_dependency(%q<juwelier>.freeze, ["~> 2.4", ">= 2.4.7"])
|
|
69
|
-
else
|
|
70
|
-
s.add_dependency(%q<oauth2>.freeze, [">= 0"])
|
|
71
|
-
s.add_dependency(%q<json>.freeze, ["~> 2.1"])
|
|
72
|
-
s.add_dependency(%q<activesupport>.freeze, ["> 3.0.0"])
|
|
73
|
-
s.add_dependency(%q<webmock>.freeze, ["~> 3.0", ">= 3.0.1"])
|
|
74
|
-
s.add_dependency(%q<byebug>.freeze, ["~> 9.0", ">= 9.0.6"])
|
|
75
|
-
s.add_dependency(%q<rspec>.freeze, ["~> 3.6"])
|
|
76
|
-
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
|
77
|
-
s.add_dependency(%q<juwelier>.freeze, ["~> 2.4", ">= 2.4.7"])
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
|
data/spec/client_spec.rb
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
-
|
|
3
|
-
describe NationBuilder::Client do
|
|
4
|
-
shared_examples 'request' do
|
|
5
|
-
let(:client) { double }
|
|
6
|
-
|
|
7
|
-
subject { NationBuilder::Client.new(hostname: 'nationbuilder.com') }
|
|
8
|
-
|
|
9
|
-
before :each do
|
|
10
|
-
expect(subject).to receive(:client).and_return(client)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
context 'request path does not include ID' do
|
|
14
|
-
let(:request_path) { 'foo/bar' }
|
|
15
|
-
|
|
16
|
-
before :each do
|
|
17
|
-
expect(client).to receive(request_type).with('https://nationbuilder.com/foo/bar', hash_including(headers: subject.send(:headers)))
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it 'should perform instrumented request if instrumentation set' do
|
|
21
|
-
instrumentation = double
|
|
22
|
-
expect(instrumentation).to receive(:call).with(hash_including(path: request_path, request_type: request_type))
|
|
23
|
-
expect(subject).to receive(:instrumentation).at_least(:once).and_return(instrumentation)
|
|
24
|
-
|
|
25
|
-
subject.send(request_type, request_path)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it 'should perform uninstrumented request if instrumentation not set' do
|
|
29
|
-
expect(subject).to receive(:instrumentation).and_return(nil)
|
|
30
|
-
|
|
31
|
-
subject.send(request_type, request_path)
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
context 'request path includes ID' do
|
|
36
|
-
let(:request_path) { 'foo/123/bar' }
|
|
37
|
-
|
|
38
|
-
before :each do
|
|
39
|
-
expect(client).to receive(request_type).with('https://nationbuilder.com/foo/123/bar', hash_including(headers: subject.send(:headers)))
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
it 'should perform instrumented request normalizing path' do
|
|
43
|
-
instrumentation = double
|
|
44
|
-
expect(instrumentation).to receive(:call).with(hash_including(path: 'foo/_/bar', request_type: request_type))
|
|
45
|
-
expect(subject).to receive(:instrumentation).at_least(:once).and_return(instrumentation)
|
|
46
|
-
|
|
47
|
-
subject.send(request_type, request_path)
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
describe 'error handling' do
|
|
52
|
-
let(:error_response) { double(parsed: nil, body: 'This is an error') }
|
|
53
|
-
let(:oauth_exception) { OAuth2::Error.new(error_response) }
|
|
54
|
-
|
|
55
|
-
before :each do
|
|
56
|
-
allow(error_response).to receive(:error=)
|
|
57
|
-
expect(client).to receive(request_type).and_raise(oauth_exception)
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
context 'error code is "rate_limited"' do
|
|
61
|
-
before :each do
|
|
62
|
-
expect(oauth_exception).to receive(:code).at_least(:once).and_return('rate_limited')
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
it 'should raise RateLimitedError' do
|
|
66
|
-
limit_reset = Time.parse('2017-01-01 12:00 +0000')
|
|
67
|
-
allow(error_response).to receive(:headers).and_return({'x-ratelimit-limit' => '100', 'x-ratelimit-remaining' => '0', 'x-ratelimit-reset' => limit_reset.to_i})
|
|
68
|
-
|
|
69
|
-
error_message = "NationBuilder rate limit error. Current values:\nLimit: 100\nRemaining: 0\nReset: #{Time.at(limit_reset.to_i)}\nBody: This is an error"
|
|
70
|
-
|
|
71
|
-
expect { subject.send(request_type, 'foo/bar') }.to raise_error NationBuilder::RateLimitedError, error_message
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
it 'should not fail if "x-ratelimit-reset" header not present' do
|
|
75
|
-
allow(error_response).to receive(:headers).and_return({'x-ratelimit-limit' => '100', 'x-ratelimit-remaining' => '0'})
|
|
76
|
-
error_message = "NationBuilder rate limit error. Current values:\nLimit: 100\nRemaining: 0\nReset: #{Time.at(0)}\nBody: This is an error"
|
|
77
|
-
|
|
78
|
-
expect { subject.send(request_type, 'foo/bar') }.to raise_error NationBuilder::RateLimitedError, error_message
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
context 'error message includes rate_limited but code is nil' do
|
|
83
|
-
before :each do
|
|
84
|
-
allow(oauth_exception).to receive(:code).and_return(nil)
|
|
85
|
-
allow(oauth_exception).to receive(:message).and_return('{"code":"rate_limited","You have been rate limited."}')
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
it 'should raise RateLimitedError' do
|
|
89
|
-
limit_reset = Time.parse('2017-01-01 12:00 +0000')
|
|
90
|
-
allow(error_response).to receive(:headers).and_return({'x-ratelimit-limit' => '100', 'x-ratelimit-remaining' => '0', 'x-ratelimit-reset' => limit_reset.to_i})
|
|
91
|
-
|
|
92
|
-
error_message = "NationBuilder rate limit error. Current values:\nLimit: 100\nRemaining: 0\nReset: #{Time.at(limit_reset.to_i)}\nBody: This is an error"
|
|
93
|
-
|
|
94
|
-
expect { subject.send(request_type, 'foo/bar') }.to raise_error NationBuilder::RateLimitedError, error_message
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
it 'should raise generic exception if code is not "rate_limited"' do
|
|
99
|
-
expect(oauth_exception).to receive(:code).at_least(:once).and_return('another_error')
|
|
100
|
-
|
|
101
|
-
expect { subject.send(request_type, 'foo/bar') }.to raise_error oauth_exception
|
|
102
|
-
end
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
[:get, :post, :put, :delete].each do |request|
|
|
107
|
-
describe "##{request}" do
|
|
108
|
-
it_behaves_like 'request' do
|
|
109
|
-
let(:request_type) { request }
|
|
110
|
-
end
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
end
|
data/spec/fixtures/not_found
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"code"=>"not_found", "message"=>"Record not found"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{\"page\":20,\"total_pages\":1,\"per_page\":10,\"total\":4,\"results\":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{\"page\":1,\"total_pages\":1,\"per_page\":10,\"total\":4,\"results\":[{\"id\":4,\"external_id\":null,\"support_level\":null,\"first_name\":\"John\",\"last_name\":\"Doe\",\"email\":\"johndoe@gmail.com\",\"phone\":null,\"mobile\":null,\"birthdate\":null,\"sex\":null,\"note\":null,\"primary_address\":null,\"tags\":[],\"recruiter_id\":null,\"created_at\":\"2013-09-17T15:23:44-07:00\",\"updated_at\":\"2013-09-17T15:23:44-07:00\",\"mobile_opt_in\":true,\"email_opt_in\":true,\"is_volunteer\":false,\"is_twitter_follower\":false,\"has_facebook\":false,\"state_file_id\":null,\"nbec_guid\":null,\"van_id\":null,\"dw_id\":null,\"ngp_id\":null,\"pf_strat_id\":null,\"county_file_id\":null,\"twitter_name\":null,\"twitter_id\":null,\"salesforce_id\":null,\"civicrm_id\":null,\"linkedin_id\":null,\"employer\":null,\"occupation\":null,\"supranational_district\":null,\"federal_district\":null,\"labour_region\":null,\"state_upper_district\":null,\"state_lower_district\":null,\"city_district\":null,\"county_district\":null,\"judicial_district\":null,\"school_district\":null,\"school_sub_district\":null,\"village_district\":null,\"fire_district\":null,\"precinct_id\":null},{\"id\":3,\"external_id\":null,\"support_level\":null,\"first_name\":\"Nathan\",\"last_name\":\"Woodhull\",\"email\":\"woodhull@gmail.com\",\"phone\":null,\"mobile\":null,\"birthdate\":null,\"sex\":null,\"note\":null,\"primary_address\":{\"address1\":null,\"address2\":null,\"city\":\"Brooklyn\",\"state\":\"NY\",\"country_code\":\"US\",\"zip\":null,\"lat\":\"40.6528762\",\"lng\":\"-73.959494\"},\"tags\":[],\"recruiter_id\":null,\"created_at\":\"2013-09-16T07:39:14-07:00\",\"updated_at\":\"2013-09-16T07:40:34-07:00\",\"mobile_opt_in\":true,\"email_opt_in\":true,\"is_volunteer\":false,\"is_twitter_follower\":false,\"has_facebook\":true,\"state_file_id\":null,\"nbec_guid\":null,\"van_id\":null,\"dw_id\":null,\"ngp_id\":null,\"pf_strat_id\":null,\"county_file_id\":null,\"twitter_name\":null,\"twitter_id\":null,\"salesforce_id\":null,\"civicrm_id\":null,\"linkedin_id\":null,\"employer\":null,\"occupation\":null,\"supranational_district\":null,\"federal_district\":null,\"labour_region\":null,\"state_upper_district\":null,\"state_lower_district\":null,\"city_district\":null,\"county_district\":null,\"judicial_district\":null,\"school_district\":null,\"school_sub_district\":null,\"village_district\":null,\"fire_district\":null,\"precinct_id\":null},{\"id\":2,\"external_id\":null,\"support_level\":null,\"first_name\":\"Nathan\",\"last_name\":\"Woodhull\",\"email\":\"nathan@controlshiftlabs.com\",\"phone\":\"518-207-6768\",\"mobile\":null,\"birthdate\":null,\"sex\":null,\"note\":null,\"primary_address\":null,\"tags\":[\"customer - signed in\"],\"recruiter_id\":null,\"created_at\":\"2012-09-20T07:03:26-07:00\",\"updated_at\":\"2013-09-16T14:11:28-07:00\",\"mobile_opt_in\":true,\"email_opt_in\":true,\"is_volunteer\":false,\"is_twitter_follower\":false,\"has_facebook\":false,\"state_file_id\":null,\"nbec_guid\":null,\"van_id\":null,\"dw_id\":null,\"ngp_id\":null,\"pf_strat_id\":null,\"county_file_id\":null,\"twitter_name\":null,\"twitter_id\":null,\"salesforce_id\":null,\"civicrm_id\":null,\"linkedin_id\":null,\"employer\":null,\"occupation\":null,\"supranational_district\":null,\"federal_district\":null,\"labour_region\":null,\"state_upper_district\":null,\"state_lower_district\":null,\"city_district\":null,\"county_district\":null,\"judicial_district\":null,\"school_district\":null,\"school_sub_district\":null,\"village_district\":null,\"fire_district\":null,\"precinct_id\":null},{\"id\":1,\"external_id\":null,\"support_level\":null,\"first_name\":\"NationBuilder\",\"last_name\":\"Support\",\"email\":\"help@nationbuilder.com\",\"phone\":null,\"mobile\":null,\"birthdate\":null,\"sex\":null,\"note\":null,\"primary_address\":null,\"tags\":[],\"recruiter_id\":null,\"created_at\":\"2012-09-20T07:03:26-07:00\",\"updated_at\":\"2013-09-16T11:18:53-07:00\",\"mobile_opt_in\":true,\"email_opt_in\":false,\"is_volunteer\":false,\"is_twitter_follower\":false,\"has_facebook\":false,\"state_file_id\":null,\"nbec_guid\":null,\"van_id\":null,\"dw_id\":null,\"ngp_id\":null,\"pf_strat_id\":null,\"county_file_id\":null,\"twitter_name\":null,\"twitter_id\":null,\"salesforce_id\":null,\"civicrm_id\":null,\"linkedin_id\":null,\"employer\":null,\"occupation\":null,\"supranational_district\":null,\"federal_district\":null,\"labour_region\":null,\"state_upper_district\":null,\"state_lower_district\":null,\"city_district\":null,\"county_district\":null,\"judicial_district\":null,\"school_district\":null,\"school_sub_district\":null,\"village_district\":null,\"fire_district\":null,\"precinct_id\":null}]}
|
data/spec/nation_builder_spec.rb
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
-
|
|
3
|
-
describe NationBuilder do
|
|
4
|
-
before(:each) do
|
|
5
|
-
allow_any_instance_of(NationBuilder::Client).to receive(:setup_client).and_return(true)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
specify { expect(subject).to respond_to :people }
|
|
9
|
-
specify { expect(subject.new).to be_a(NationBuilder::Client)}
|
|
10
|
-
end
|
data/spec/people_spec.rb
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
-
|
|
3
|
-
describe 'People' do
|
|
4
|
-
describe 'list' do
|
|
5
|
-
|
|
6
|
-
let(:body) { fixture('people_get') }
|
|
7
|
-
let(:request_path) { '/api/v1/people' }
|
|
8
|
-
let(:status) { 200 }
|
|
9
|
-
let(:client) { NationBuilder::Client.new(hostname: 'controlshifttest.nationbuilder.com', client_id: 'be4e96f9c1c664b1903764cc425f522e4adbc3f26f0e6b52603f7e68e1ed025e', client_secret: '3dbafb54fb670fb6b2323a617d3cafbee7a83943cf5340347dcbe40fe13d93f7', username: 'nathan@controlshiftlabs.com', password: '9WRv9pZRwaUJuv') }
|
|
10
|
-
before(:each) do
|
|
11
|
-
stub_get(request_path).to_return(:body => body, :status => status,
|
|
12
|
-
:headers => { content_type: "application/json; charset=utf-8"})
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
describe 'on success' do
|
|
16
|
-
describe 'empty list' do
|
|
17
|
-
let(:body) { fixture('people_list_empty') }
|
|
18
|
-
it 'should return an empty result set if the nation is empty' do
|
|
19
|
-
pending "figure out how to stub oauth2"
|
|
20
|
-
client.people.list.should be_a(Hash)
|
|
21
|
-
client.people.list['results'].should be_empty
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
describe 'succesful response' do
|
|
26
|
-
let(:body) { fixture('people_list_success') }
|
|
27
|
-
it 'should return a list of people in the nation' do
|
|
28
|
-
pending "figure out how to stub oauth2"
|
|
29
|
-
|
|
30
|
-
client.people.list.should be_a(Hash)
|
|
31
|
-
client.people.list.should_not be_empty
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
data/spec/spec_helper.rb
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
2
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
3
|
-
require 'rspec'
|
|
4
|
-
require 'nation_builder'
|
|
5
|
-
require 'webmock/rspec'
|
|
6
|
-
require 'json'
|
|
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
|
-
WebMock.allow_net_connect!
|
|
19
|
-
end
|
|
20
|
-
config.after(:each) do
|
|
21
|
-
WebMock.reset!
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
# Allow real connections
|
|
27
|
-
|
|
28
|
-
def stub_get(path)
|
|
29
|
-
stub_nation_builder_request(:get, path)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def stub_post(path)
|
|
33
|
-
stub_nation_builder_request(:post, path)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def stub_nation_builder_request(method, path)
|
|
37
|
-
stub_request(method, "https://test.com" + path)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def fixture_path
|
|
41
|
-
File.expand_path("../fixtures", __FILE__)
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def fixture(file)
|
|
45
|
-
File.new(File.join(fixture_path, '/', file))
|
|
46
|
-
end
|