nationbuilder-rb 1.2.0 → 1.2.1
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 +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +2 -2
- data/VERSION +1 -1
- data/lib/nationbuilder/paginator.rb +2 -2
- data/nationbuilder-rb.gemspec +2 -2
- data/spec/nationbuilder_paginator_spec.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed83c1a7ea3f4620237f7e8ac24a6a735f53040c
|
4
|
+
data.tar.gz: 9de67b51d069fd267fe51a3eece11b58c7fab9cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38cc6c6a51d1b5a51b47c87afc334d1fb6d6855df1abbf1280edc7b63ab81c56c4df128ab17927afce489724f82e0868f6fe39c4070732d422ee2e7168cb0610
|
7
|
+
data.tar.gz: e8fad6eb21f0662b11c7dbf5dec13166ec7fec1f9f7937bfaa724f4a29a4cffb66e690822340df84009a130b299a879f7e3551b39fe8d86c60a3effb9e5a259b
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -80,12 +80,12 @@ A call can be paginated by creating a new instance of the `Paginator` class. Thi
|
|
80
80
|
```ruby
|
81
81
|
response = client.call(:people, :index)
|
82
82
|
|
83
|
-
paginated = Paginator.new(client, response)
|
83
|
+
paginated = NationBuilder::Paginator.new(client, response)
|
84
84
|
page1 = paginated
|
85
85
|
page2 = page1.next
|
86
86
|
page3 = page2.next
|
87
87
|
```
|
88
|
-
Methods `#next` and `#prev` return the results of the next or previous page of results, nil if none. `#next?` and `#prev?`
|
88
|
+
Methods `#next` and `#prev` return the results of the next or previous page of results, nil if none. `#next?` and `#prev?` alert the caller to whether other pages of results exist. The JSON results of a page can be accessed by calling `#body` on a page: in the above example, `page1.body` returns the same hash as `response`.
|
89
89
|
|
90
90
|
## Documentation
|
91
91
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.1
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Paginator
|
1
|
+
class NationBuilder::Paginator
|
2
2
|
attr_reader :body
|
3
3
|
|
4
4
|
def initialize(client, body)
|
@@ -15,7 +15,7 @@ class Paginator
|
|
15
15
|
return nil unless send(:"#{page_type}?")
|
16
16
|
path = send(:"#{page_type}?").split('/api/v1').last
|
17
17
|
results = @client.raw_call(path, :get)
|
18
|
-
return
|
18
|
+
return self.class.new(@client, results)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
data/nationbuilder-rb.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: nationbuilder-rb 1.2.
|
5
|
+
# stub: nationbuilder-rb 1.2.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "nationbuilder-rb"
|
9
|
-
s.version = "1.2.
|
9
|
+
s.version = "1.2.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Paginator do
|
3
|
+
describe NationBuilder::Paginator do
|
4
4
|
|
5
5
|
let(:client) do
|
6
6
|
NationBuilder::Client.new('organizeralexandreschmitt',
|
@@ -14,7 +14,7 @@ describe Paginator do
|
|
14
14
|
|
15
15
|
describe '#pagination' do
|
16
16
|
before do
|
17
|
-
@page1 = Paginator.new(client, response)
|
17
|
+
@page1 = NationBuilder::Paginator.new(client, response)
|
18
18
|
@page2 = VCR.use_cassette('paginated_get_page2') { @page1.next }
|
19
19
|
end
|
20
20
|
|