action_kit_rest 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.ruby-version +1 -1
- data/.travis.yml +1 -1
- data/Gemfile +2 -3
- data/Gemfile.lock +78 -84
- data/README.md +53 -1
- data/Rakefile +8 -8
- data/VERSION +1 -1
- data/action_kit_rest.gemspec +65 -53
- data/lib/action_kit_rest.rb +10 -0
- data/lib/action_kit_rest/actions/event_create_action.rb +9 -0
- data/lib/action_kit_rest/actions/event_signup_action.rb +9 -0
- data/lib/action_kit_rest/actions/unsubscribe_action.rb +9 -0
- data/lib/action_kit_rest/api.rb +3 -4
- data/lib/action_kit_rest/client.rb +16 -21
- data/lib/action_kit_rest/event.rb +12 -0
- data/lib/action_kit_rest/event_signup.rb +7 -0
- data/lib/action_kit_rest/language.rb +12 -0
- data/lib/action_kit_rest/pages/donation_page.rb +9 -0
- data/lib/action_kit_rest/pages/event_campaign_page.rb +54 -0
- data/lib/action_kit_rest/pages/unsubscribe_page.rb +9 -0
- data/lib/action_kit_rest/phone.rb +7 -0
- data/lib/action_kit_rest/response/raise_error.rb +15 -2
- data/lib/action_kit_rest/user.rb +13 -0
- data/lib/action_kit_rest/version.rb +3 -3
- data/spec/fixtures/page/campaign.json +32 -0
- data/spec/fixtures/phone/object.json +33 -0
- data/spec/fixtures/user/{object.json → object_with_phones.json} +0 -0
- data/spec/fixtures/user/object_without_phones.json +1 -0
- data/spec/{action_kit_rest → lib/action_kit_rest}/logger_spec.rb +0 -0
- data/spec/{action_kit_rest → lib/action_kit_rest}/page_spec.rb +10 -2
- data/spec/lib/action_kit_rest/pages/event_campaign_page_spec.rb +48 -0
- data/spec/{action_kit_rest/pages/input_page_spec.rb → lib/action_kit_rest/pages/import_page_spec.rb} +6 -12
- data/spec/{action_kit_rest → lib/action_kit_rest}/response/collection_spec.rb +0 -0
- data/spec/{action_kit_rest → lib/action_kit_rest}/response/wrapper_spec.rb +0 -0
- data/spec/{action_kit_rest → lib/action_kit_rest}/user_spec.rb +17 -3
- data/spec/support/shared_contexts/stub_logger.rb +9 -0
- metadata +57 -54
data/spec/{action_kit_rest/pages/input_page_spec.rb → lib/action_kit_rest/pages/import_page_spec.rb}
RENAMED
@@ -1,13 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'support/shared_contexts/stub_logger'
|
2
3
|
|
3
4
|
describe ActionKitRest::Pages::ImportPage do
|
4
|
-
|
5
|
-
logger = double
|
6
|
-
logger.stub(:debug).and_return(true)
|
7
|
-
|
8
|
-
ActionKitRest.stub(:logger).and_return(logger)
|
9
|
-
Vertebrae::Base.stub(:logger).and_return(logger)
|
10
|
-
end
|
5
|
+
include_context "stub_logger"
|
11
6
|
|
12
7
|
let(:actionkit) { ActionKitRest.new(host: 'test.com') }
|
13
8
|
let(:status) { 200 }
|
@@ -21,14 +16,13 @@ describe ActionKitRest::Pages::ImportPage do
|
|
21
16
|
stub_post(request_path).with(body: request_body).to_return(:body => body, :status => status,
|
22
17
|
:headers => {location: 'https://test.com/rest/v1/importpage/1093/', content_type: "application/json; charset=utf-8"})
|
23
18
|
|
24
|
-
stub_request(:get, "https://test.com/rest/v1/importpage/1093/").to_return(body: fixture('page/object.json'), status: '200', content_type: "application/json; charset=utf-8")
|
19
|
+
stub_request(:get, "https://test.com/rest/v1/importpage/1093/").to_return(body: fixture('page/object.json'), status: '200', headers: {content_type: "application/json; charset=utf-8"})
|
25
20
|
end
|
26
21
|
|
27
22
|
describe ".create" do
|
28
23
|
it "should allow creation" do
|
29
24
|
resp = actionkit.import_page.create(title: "Title", name: "name")
|
30
|
-
resp.title.
|
31
|
-
|
25
|
+
expect(resp.title).to eq 'Demand a Sustainable USDA'
|
32
26
|
end
|
33
27
|
end
|
34
28
|
end
|
@@ -42,13 +36,13 @@ describe ActionKitRest::Pages::ImportPage do
|
|
42
36
|
stub_put(request_path).with(body: request_body).to_return(:body => body, :status => status,
|
43
37
|
:headers => { content_type: "application/json; charset=utf-8"})
|
44
38
|
|
45
|
-
stub_request(:get, "https://test.com/rest/v1/importpage/1093/").to_return(body: fixture('page/object.json'), status: '200', content_type: "application/json; charset=utf-8")
|
39
|
+
stub_request(:get, "https://test.com/rest/v1/importpage/1093/").to_return(body: fixture('page/object.json'), status: '200', headers: {content_type: "application/json; charset=utf-8"})
|
46
40
|
end
|
47
41
|
|
48
42
|
describe '.update' do
|
49
43
|
it 'should allow updates' do
|
50
44
|
resp = actionkit.import_page.update('1093', title: "Title", name: "name")
|
51
|
-
resp.title.
|
45
|
+
expect(resp.title).to eq 'Demand a Sustainable USDA'
|
52
46
|
end
|
53
47
|
end
|
54
48
|
end
|
File without changes
|
File without changes
|
@@ -21,11 +21,25 @@ describe ActionKitRest::User do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
describe ".get" do
|
24
|
-
let(:body) { fixture('user/object.json') }
|
25
24
|
let(:status) { 200 }
|
26
25
|
|
27
|
-
|
28
|
-
|
26
|
+
context 'without phones' do
|
27
|
+
let(:body) { fixture('user/object_without_phones.json') }
|
28
|
+
|
29
|
+
it 'should return a user object' do
|
30
|
+
expect(@actionkit.user.get(1).email).to eq 'walkers@wawd.com'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'with phones' do
|
35
|
+
let(:body) { fixture('user/object_with_phones.json') }
|
36
|
+
let(:phone_body) { fixture('phone/object.json') }
|
37
|
+
|
38
|
+
it 'should include phones' do
|
39
|
+
stub_get('phone/?user=1').to_return(:body => phone_body, :status => 200)
|
40
|
+
expect(@actionkit.user.get(1).phones.count).to eq 3
|
41
|
+
expect(@actionkit.user.get(1).phones.map(&:phone)).to match_array(['7755555555', '7755555577', '310-310-3310'])
|
42
|
+
end
|
29
43
|
end
|
30
44
|
end
|
31
45
|
|
metadata
CHANGED
@@ -1,168 +1,156 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_kit_rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Woodhull
|
8
|
+
- Diego Marcet
|
9
|
+
- Jacinda Moore
|
8
10
|
autorequire:
|
9
11
|
bindir: bin
|
10
12
|
cert_chain: []
|
11
|
-
date:
|
13
|
+
date: 2017-08-15 00:00:00.000000000 Z
|
12
14
|
dependencies:
|
13
15
|
- !ruby/object:Gem::Dependency
|
14
16
|
name: vertebrae
|
15
17
|
requirement: !ruby/object:Gem::Requirement
|
16
18
|
requirements:
|
17
|
-
- -
|
19
|
+
- - ">="
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: '0'
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
23
25
|
requirements:
|
24
|
-
- -
|
26
|
+
- - ">="
|
25
27
|
- !ruby/object:Gem::Version
|
26
28
|
version: '0'
|
27
29
|
- !ruby/object:Gem::Dependency
|
28
30
|
name: rspec
|
29
31
|
requirement: !ruby/object:Gem::Requirement
|
30
32
|
requirements:
|
31
|
-
- -
|
33
|
+
- - ">="
|
32
34
|
- !ruby/object:Gem::Version
|
33
35
|
version: '0'
|
34
36
|
type: :development
|
35
37
|
prerelease: false
|
36
38
|
version_requirements: !ruby/object:Gem::Requirement
|
37
39
|
requirements:
|
38
|
-
- -
|
40
|
+
- - ">="
|
39
41
|
- !ruby/object:Gem::Version
|
40
42
|
version: '0'
|
41
43
|
- !ruby/object:Gem::Dependency
|
42
44
|
name: webmock
|
43
45
|
requirement: !ruby/object:Gem::Requirement
|
44
46
|
requirements:
|
45
|
-
- -
|
47
|
+
- - ">="
|
46
48
|
- !ruby/object:Gem::Version
|
47
49
|
version: '0'
|
48
50
|
type: :development
|
49
51
|
prerelease: false
|
50
52
|
version_requirements: !ruby/object:Gem::Requirement
|
51
53
|
requirements:
|
52
|
-
- -
|
54
|
+
- - ">="
|
53
55
|
- !ruby/object:Gem::Version
|
54
56
|
version: '0'
|
55
57
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
58
|
+
name: byebug
|
57
59
|
requirement: !ruby/object:Gem::Requirement
|
58
60
|
requirements:
|
59
|
-
- -
|
61
|
+
- - ">="
|
60
62
|
- !ruby/object:Gem::Version
|
61
63
|
version: '0'
|
62
64
|
type: :development
|
63
65
|
prerelease: false
|
64
66
|
version_requirements: !ruby/object:Gem::Requirement
|
65
67
|
requirements:
|
66
|
-
- -
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: pry-debugger
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ! '>='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ! '>='
|
68
|
+
- - ">="
|
81
69
|
- !ruby/object:Gem::Version
|
82
70
|
version: '0'
|
83
71
|
- !ruby/object:Gem::Dependency
|
84
72
|
name: bundler
|
85
73
|
requirement: !ruby/object:Gem::Requirement
|
86
74
|
requirements:
|
87
|
-
- -
|
75
|
+
- - ">="
|
88
76
|
- !ruby/object:Gem::Version
|
89
77
|
version: '0'
|
90
78
|
type: :development
|
91
79
|
prerelease: false
|
92
80
|
version_requirements: !ruby/object:Gem::Requirement
|
93
81
|
requirements:
|
94
|
-
- -
|
82
|
+
- - ">="
|
95
83
|
- !ruby/object:Gem::Version
|
96
84
|
version: '0'
|
97
85
|
- !ruby/object:Gem::Dependency
|
98
86
|
name: eventmachine
|
99
87
|
requirement: !ruby/object:Gem::Requirement
|
100
88
|
requirements:
|
101
|
-
- -
|
89
|
+
- - ">="
|
102
90
|
- !ruby/object:Gem::Version
|
103
91
|
version: '0'
|
104
92
|
type: :development
|
105
93
|
prerelease: false
|
106
94
|
version_requirements: !ruby/object:Gem::Requirement
|
107
95
|
requirements:
|
108
|
-
- -
|
96
|
+
- - ">="
|
109
97
|
- !ruby/object:Gem::Version
|
110
98
|
version: '0'
|
111
99
|
- !ruby/object:Gem::Dependency
|
112
100
|
name: em-synchrony
|
113
101
|
requirement: !ruby/object:Gem::Requirement
|
114
102
|
requirements:
|
115
|
-
- -
|
103
|
+
- - ">="
|
116
104
|
- !ruby/object:Gem::Version
|
117
105
|
version: '0'
|
118
106
|
type: :development
|
119
107
|
prerelease: false
|
120
108
|
version_requirements: !ruby/object:Gem::Requirement
|
121
109
|
requirements:
|
122
|
-
- -
|
110
|
+
- - ">="
|
123
111
|
- !ruby/object:Gem::Version
|
124
112
|
version: '0'
|
125
113
|
- !ruby/object:Gem::Dependency
|
126
114
|
name: em-http-request
|
127
115
|
requirement: !ruby/object:Gem::Requirement
|
128
116
|
requirements:
|
129
|
-
- -
|
117
|
+
- - ">="
|
130
118
|
- !ruby/object:Gem::Version
|
131
119
|
version: '0'
|
132
120
|
type: :development
|
133
121
|
prerelease: false
|
134
122
|
version_requirements: !ruby/object:Gem::Requirement
|
135
123
|
requirements:
|
136
|
-
- -
|
124
|
+
- - ">="
|
137
125
|
- !ruby/object:Gem::Version
|
138
126
|
version: '0'
|
139
127
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
128
|
+
name: juwelier
|
141
129
|
requirement: !ruby/object:Gem::Requirement
|
142
130
|
requirements:
|
143
|
-
- -
|
131
|
+
- - ">="
|
144
132
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
133
|
+
version: '0'
|
146
134
|
type: :development
|
147
135
|
prerelease: false
|
148
136
|
version_requirements: !ruby/object:Gem::Requirement
|
149
137
|
requirements:
|
150
|
-
- -
|
138
|
+
- - ">="
|
151
139
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
140
|
+
version: '0'
|
153
141
|
description: Gem for interacting with the ActionKit API
|
154
|
-
email:
|
142
|
+
email: systems@controlshiftlabs.com
|
155
143
|
executables: []
|
156
144
|
extensions: []
|
157
145
|
extra_rdoc_files:
|
158
146
|
- LICENSE.txt
|
159
147
|
- README.md
|
160
148
|
files:
|
161
|
-
- .document
|
162
|
-
- .rspec
|
163
|
-
- .ruby-gemset
|
164
|
-
- .ruby-version
|
165
|
-
- .travis.yml
|
149
|
+
- ".document"
|
150
|
+
- ".rspec"
|
151
|
+
- ".ruby-gemset"
|
152
|
+
- ".ruby-version"
|
153
|
+
- ".travis.yml"
|
166
154
|
- Gemfile
|
167
155
|
- Gemfile.lock
|
168
156
|
- LICENSE.txt
|
@@ -172,14 +160,24 @@ files:
|
|
172
160
|
- action_kit_rest.gemspec
|
173
161
|
- lib/action_kit_rest.rb
|
174
162
|
- lib/action_kit_rest/action.rb
|
163
|
+
- lib/action_kit_rest/actions/event_create_action.rb
|
164
|
+
- lib/action_kit_rest/actions/event_signup_action.rb
|
165
|
+
- lib/action_kit_rest/actions/unsubscribe_action.rb
|
175
166
|
- lib/action_kit_rest/api.rb
|
176
167
|
- lib/action_kit_rest/base.rb
|
177
168
|
- lib/action_kit_rest/client.rb
|
169
|
+
- lib/action_kit_rest/event.rb
|
170
|
+
- lib/action_kit_rest/event_signup.rb
|
171
|
+
- lib/action_kit_rest/language.rb
|
178
172
|
- lib/action_kit_rest/list.rb
|
179
173
|
- lib/action_kit_rest/page.rb
|
180
174
|
- lib/action_kit_rest/pages/base.rb
|
175
|
+
- lib/action_kit_rest/pages/donation_page.rb
|
176
|
+
- lib/action_kit_rest/pages/event_campaign_page.rb
|
181
177
|
- lib/action_kit_rest/pages/import_page.rb
|
182
178
|
- lib/action_kit_rest/pages/signup_page.rb
|
179
|
+
- lib/action_kit_rest/pages/unsubscribe_page.rb
|
180
|
+
- lib/action_kit_rest/phone.rb
|
183
181
|
- lib/action_kit_rest/railties.rb
|
184
182
|
- lib/action_kit_rest/response/collection.rb
|
185
183
|
- lib/action_kit_rest/response/raise_error.rb
|
@@ -188,17 +186,22 @@ files:
|
|
188
186
|
- lib/action_kit_rest/tag.rb
|
189
187
|
- lib/action_kit_rest/user.rb
|
190
188
|
- lib/action_kit_rest/version.rb
|
191
|
-
- spec/action_kit_rest/logger_spec.rb
|
192
|
-
- spec/action_kit_rest/page_spec.rb
|
193
|
-
- spec/action_kit_rest/pages/input_page_spec.rb
|
194
|
-
- spec/action_kit_rest/response/collection_spec.rb
|
195
|
-
- spec/action_kit_rest/response/wrapper_spec.rb
|
196
|
-
- spec/action_kit_rest/user_spec.rb
|
197
189
|
- spec/fixtures/error.json
|
190
|
+
- spec/fixtures/page/campaign.json
|
198
191
|
- spec/fixtures/page/collection.json
|
199
192
|
- spec/fixtures/page/object.json
|
200
|
-
- spec/fixtures/
|
193
|
+
- spec/fixtures/phone/object.json
|
194
|
+
- spec/fixtures/user/object_with_phones.json
|
195
|
+
- spec/fixtures/user/object_without_phones.json
|
196
|
+
- spec/lib/action_kit_rest/logger_spec.rb
|
197
|
+
- spec/lib/action_kit_rest/page_spec.rb
|
198
|
+
- spec/lib/action_kit_rest/pages/event_campaign_page_spec.rb
|
199
|
+
- spec/lib/action_kit_rest/pages/import_page_spec.rb
|
200
|
+
- spec/lib/action_kit_rest/response/collection_spec.rb
|
201
|
+
- spec/lib/action_kit_rest/response/wrapper_spec.rb
|
202
|
+
- spec/lib/action_kit_rest/user_spec.rb
|
201
203
|
- spec/spec_helper.rb
|
204
|
+
- spec/support/shared_contexts/stub_logger.rb
|
202
205
|
homepage: http://github.com/controlshift/action_kit_rest
|
203
206
|
licenses:
|
204
207
|
- MIT
|
@@ -209,17 +212,17 @@ require_paths:
|
|
209
212
|
- lib
|
210
213
|
required_ruby_version: !ruby/object:Gem::Requirement
|
211
214
|
requirements:
|
212
|
-
- -
|
215
|
+
- - ">="
|
213
216
|
- !ruby/object:Gem::Version
|
214
217
|
version: '0'
|
215
218
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
216
219
|
requirements:
|
217
|
-
- -
|
220
|
+
- - ">="
|
218
221
|
- !ruby/object:Gem::Version
|
219
222
|
version: '0'
|
220
223
|
requirements: []
|
221
224
|
rubyforge_project:
|
222
|
-
rubygems_version: 2.
|
225
|
+
rubygems_version: 2.5.2
|
223
226
|
signing_key:
|
224
227
|
specification_version: 4
|
225
228
|
summary: A wrapper for the ActionKit REST API
|