bearcat 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/bearcat/api_array.rb +12 -0
- data/lib/bearcat/version.rb +1 -1
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8825a9f6eed62312304510363c55d68948e868120b7eadd78c549c530b83f94a
|
4
|
+
data.tar.gz: 72a33b5db750fe482564c58bf0f45ce41a3e5373c8b0eec21d3d663c48f1b63a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c64052484c4736f63a2a1cfcc9cb7d2ca2576bca0d1913fa9c39d741019f16c19adb6f7599ce9a8e8d6458414d05a3c2e584f88c5169b80715faf19e886de42
|
7
|
+
data.tar.gz: aa70d1e1e0d2e835f2393fff665440b950c672cf1bfc1f2463e5d3316f3106110cdbbf2465ad8c3af82e0f2954bfc989c86a2103b9e8268a13bb8d1d25b11f93
|
data/lib/bearcat/api_array.rb
CHANGED
@@ -59,6 +59,14 @@ module Bearcat
|
|
59
59
|
@link_hash['next'] || @link_hash['prev']
|
60
60
|
end
|
61
61
|
|
62
|
+
def page_count
|
63
|
+
return nil unless @link_hash['last']
|
64
|
+
|
65
|
+
uri = URI.parse(@link_hash['last'])
|
66
|
+
params = CGI.parse(uri.query)
|
67
|
+
params.dig('page', 0)&.to_i || 1
|
68
|
+
end
|
69
|
+
|
62
70
|
%w[next prev first last].each do |rel|
|
63
71
|
define_method :"#{rel}_page" do
|
64
72
|
load_page(rel)
|
@@ -66,6 +74,8 @@ module Bearcat
|
|
66
74
|
end
|
67
75
|
|
68
76
|
def each_page(page_count = nil, &block)
|
77
|
+
return to_enum(:each_page, page_count) unless block_given?
|
78
|
+
|
69
79
|
if pages?
|
70
80
|
iterate_pages(page_count) do |page_response|
|
71
81
|
@members = process_body(page_response)
|
@@ -78,6 +88,8 @@ module Bearcat
|
|
78
88
|
end
|
79
89
|
|
80
90
|
def all_pages_each(page_count = nil, &block)
|
91
|
+
return to_enum(:all_pages_each, page_count) unless block_given?
|
92
|
+
|
81
93
|
each_page(page_count) do |page|
|
82
94
|
page.each &block
|
83
95
|
end
|
data/lib/bearcat/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bearcat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Mills, Jake Sorce
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -362,10 +362,10 @@ files:
|
|
362
362
|
- spec/fixtures/user_page_views.json
|
363
363
|
- spec/fixtures/user_profile.json
|
364
364
|
- spec/helper.rb
|
365
|
-
homepage:
|
365
|
+
homepage:
|
366
366
|
licenses: []
|
367
367
|
metadata: {}
|
368
|
-
post_install_message:
|
368
|
+
post_install_message:
|
369
369
|
rdoc_options: []
|
370
370
|
require_paths:
|
371
371
|
- lib
|
@@ -380,9 +380,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
380
380
|
- !ruby/object:Gem::Version
|
381
381
|
version: '0'
|
382
382
|
requirements: []
|
383
|
-
|
384
|
-
|
385
|
-
signing_key:
|
383
|
+
rubygems_version: 3.1.2
|
384
|
+
signing_key:
|
386
385
|
specification_version: 4
|
387
386
|
summary: Canvas API
|
388
387
|
test_files:
|