actionkit_connector 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/actionkit_connector.rb +16 -0
- data/lib/actionkit_connector/version.rb +1 -1
- data/spec/connector_spec.rb +17 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16ad1f54b24f621e1e9e3bd79467999bb48ee97d
|
4
|
+
data.tar.gz: b81c3cc71b8cb8a4aa93ccb34f172c0aad935ce9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c84dcd7d9c6ca74a284d58d2cbea4f7754c7b10ab9c9c18987319798d4a0100e6395655706e3499ec60d785cdb9de470689f15f7db89b9c35ba3d2c50a654bb8
|
7
|
+
data.tar.gz: d6a9ec75681105af05b7b3c029031f6a5958731a5a26e3892a1ea118d4e7f3a0ec71184f8eb65d84b7c45c22fd23e8b8133ffdf1075ac748bbf78d8f2838e249
|
data/lib/actionkit_connector.rb
CHANGED
@@ -162,6 +162,22 @@ module ActionKitConnector
|
|
162
162
|
self.class.get(target, {basic_auth: self.auth})
|
163
163
|
end
|
164
164
|
|
165
|
+
# Lists users in your instance.
|
166
|
+
#
|
167
|
+
# @param [Int] offset The number of records to skip.
|
168
|
+
# @param [Int] limit The maximum number of results to return.
|
169
|
+
def list_users(offset=0, limit=20)
|
170
|
+
target = "#{self.base_url}/user/"
|
171
|
+
options = {
|
172
|
+
basic_auth: self.auth,
|
173
|
+
query: {
|
174
|
+
_limit: limit,
|
175
|
+
_offset: offset
|
176
|
+
}
|
177
|
+
}
|
178
|
+
self.class.get(target, options)
|
179
|
+
end
|
180
|
+
|
165
181
|
def parse_action_options(options)
|
166
182
|
included_options = {}
|
167
183
|
acceptable_options = [
|
data/spec/connector_spec.rb
CHANGED
@@ -52,6 +52,23 @@ describe 'Connector' do
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
+
describe '#list_users' do
|
56
|
+
before do
|
57
|
+
stub_request(:get, 'http://username:password@api.example.com/user/?_limit=20&_offset=0')
|
58
|
+
stub_request(:get, 'http://username:password@api.example.com/user/?_limit=50&_offset=100')
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'finds a list of pages with default params' do
|
62
|
+
client.list_users
|
63
|
+
expect(WebMock).to have_requested(:get, 'http://username:password@api.example.com/user/?_limit=20&_offset=0')
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'correctly changes params' do
|
67
|
+
client.list_users 100, 50
|
68
|
+
expect(WebMock).to have_requested(:get, 'http://username:password@api.example.com/user/?_limit=50&_offset=100')
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
55
72
|
describe '#petition_page' do
|
56
73
|
before do
|
57
74
|
stub_request(:get, 'http://username:password@api.example.com/petitionpage/100/')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionkit_connector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Boersma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|