actionkit_connector 0.1.3 → 0.1.4
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 +20 -0
- data/lib/actionkit_connector/version.rb +1 -1
- data/spec/connector_spec.rb +14 -1
- 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: e16a7ee6f6fa3884352858162d9e633191c65a78
|
4
|
+
data.tar.gz: 1993fbb2afe1cba96fbdb876497be2e234af7193
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b6d0a6854ae046da9da1a5356d17ead15e6a026e56319ebba3f408594d8f4315ea5eafc548b303ac4724a11aa7f31a29a0c8b45d7bd5d0f7cf4e0698dd90534
|
7
|
+
data.tar.gz: aacd7d4f95e0e5269d86a33dc9a9681ce4805036749163d467f1208b82b3fd2fde23f17f47abd6214cdaa9a97cb023f57534a07c0681f1d609d5e6c83034403a
|
data/lib/actionkit_connector.rb
CHANGED
@@ -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.
|
data/spec/connector_spec.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2015-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|