actionkit_connector 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66c6d4e06d07ad8303c143426e51e8c0fb2844cc
4
- data.tar.gz: f801966a83a141ff070cc4b6b2401d657267779b
3
+ metadata.gz: e16a7ee6f6fa3884352858162d9e633191c65a78
4
+ data.tar.gz: 1993fbb2afe1cba96fbdb876497be2e234af7193
5
5
  SHA512:
6
- metadata.gz: 4b1ce2ae3d4680ceda22efd518ddc868e39488bc48f5620949069fd72e7192c9f74922db054ea958e570d61dcb4872c8ce320b74e8868fda2648c5a1f9c26c2a
7
- data.tar.gz: 92e8494b16687bd2b3c1bd036b01f564182e2fe875c3fd525ac1e4736ed5bde57ccc267dd4b5409383202b6b7e90dc3fa0a652c468f899d1a35dfe9c6f171968
6
+ metadata.gz: 4b6d0a6854ae046da9da1a5356d17ead15e6a026e56319ebba3f408594d8f4315ea5eafc548b303ac4724a11aa7f31a29a0c8b45d7bd5d0f7cf4e0698dd90534
7
+ data.tar.gz: aacd7d4f95e0e5269d86a33dc9a9681ce4805036749163d467f1208b82b3fd2fde23f17f47abd6214cdaa9a97cb023f57534a07c0681f1d609d5e6c83034403a
@@ -42,6 +42,26 @@ module ActionKitConnector
42
42
  self.class.get(target, options)
43
43
  end
44
44
 
45
+ # Find petition pages matching a given name.
46
+ #
47
+ # @param [Int] offset The number of records to skip.
48
+ # @param [Int] limit The maximum number of results to return.
49
+ # @param [String] name The string to match against name.
50
+ def find_petition_pages(name, limit: 10, offset: 0)
51
+ target = "#{self.base_url}/petitionpage/"
52
+
53
+ options = {
54
+ basic_auth: self.auth,
55
+ query: {
56
+ _limit: limit,
57
+ _offset: offset,
58
+ name: name
59
+ }
60
+ }
61
+
62
+ self.class.get(target, options)
63
+ end
64
+
45
65
  # Returns the information for a single PetitionPage.
46
66
  #
47
67
  # @param [Int] id The ID of the page to return.
@@ -1,3 +1,3 @@
1
1
  module ActionkitConnector
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
@@ -2,6 +2,8 @@ require 'spec_helper'
2
2
  require_relative '../lib/actionkit_connector'
3
3
 
4
4
  describe 'Connector' do
5
+ let(:client) { ActionKitConnector::Connector.new('username', 'password', 'http://api.example.com') }
6
+
5
7
  before :each do
6
8
  @connector = ActionKitConnector::Connector.new 'username', 'password', 'url'
7
9
  end
@@ -27,8 +29,19 @@ describe 'Connector' do
27
29
  expect(@connector.parse_action_options({'action_foo' => 'test', not_an_action: 'bad'})).to eq({action_foo: 'test'})
28
30
  end
29
31
 
32
+ describe '#find_petition_pages' do
33
+ before do
34
+ stub_request(:get, "http://username:password@api.example.com/petitionpage/?_limit=10&_offset=0&name=foo-bar")
35
+ end
36
+
37
+ it "finds petition pages matching a given name" do
38
+ client.find_petition_pages("foo-bar")
39
+
40
+ expect(WebMock).to have_requested(:get, "http://username:password@api.example.com/petitionpage/?_limit=10&_offset=0&name=foo-bar")
41
+ end
42
+ end
43
+
30
44
  describe "#create_petition_page" do
31
- let(:client) { ActionKitConnector::Connector.new('username', 'password', 'http://api.example.com') }
32
45
 
33
46
  let(:request_body) do
34
47
  { type: 'petitionpage',
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.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Boersma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-08 00:00:00.000000000 Z
11
+ date: 2015-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty