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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0536a04809c61a01c4c92e70b45e3c2bd52a4fe
4
- data.tar.gz: 30ee7add2c690f34d8de58dc59875e5057c5596f
3
+ metadata.gz: 16ad1f54b24f621e1e9e3bd79467999bb48ee97d
4
+ data.tar.gz: b81c3cc71b8cb8a4aa93ccb34f172c0aad935ce9
5
5
  SHA512:
6
- metadata.gz: b87f08e2acf123cc58f1baf4e7e440fbaf69484f5a342284fb391ccc8080e06c82aefd423f43215565cc7ce9085354d9c1405b047058ba36159d5b836363251c
7
- data.tar.gz: dec39a590b90edb6c6024791b9a7296fc9a75e2dcd01e5ea328f955cdecd7c019e532cbd4000437a3fadcda673873571e490771afb0ffa2fd55588fb5a203343
6
+ metadata.gz: c84dcd7d9c6ca74a284d58d2cbea4f7754c7b10ab9c9c18987319798d4a0100e6395655706e3499ec60d785cdb9de470689f15f7db89b9c35ba3d2c50a654bb8
7
+ data.tar.gz: d6a9ec75681105af05b7b3c029031f6a5958731a5a26e3892a1ea118d4e7f3a0ec71184f8eb65d84b7c45c22fd23e8b8133ffdf1075ac748bbf78d8f2838e249
@@ -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 = [
@@ -1,3 +1,3 @@
1
1
  module ActionkitConnector
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
@@ -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.0
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-03 00:00:00.000000000 Z
11
+ date: 2016-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty