productive 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/productive/resources/base.rb +29 -0
- data/lib/productive/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77f29b8aec3d5246bfa8c47324367f71a8d89fe1
|
4
|
+
data.tar.gz: 164de5a9592b69346d43d62afd5810722f7e2275
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cfbcdea8b7ed820c83c954b23b482fc9c9fbfc4909fc4818c8c505af790c826b34c9f1f13d6f9ae56b903dba771163bae7c8592ff821dcfadd44bda626b5b10
|
7
|
+
data.tar.gz: 7cff7c8493628f0d22f9919e9448328a33d0d9c9e25ac4125352e534e2acd048da64d6e7e9a7750090785522551a80392dcb48ef8abcfa25d1ae89f6f6e3cde1
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Productive
|
2
2
|
class Base < JsonApiClient::Resource
|
3
|
+
PER_PAGE = 1000
|
4
|
+
|
3
5
|
def self.setup(config)
|
4
6
|
site_setup config
|
5
7
|
connection_options_setup config
|
@@ -17,5 +19,32 @@ module Productive
|
|
17
19
|
def self.paginator_setup(config)
|
18
20
|
self.paginator = config.paginator
|
19
21
|
end
|
22
|
+
|
23
|
+
def self.all(args = {})
|
24
|
+
arr = []
|
25
|
+
page = 1
|
26
|
+
|
27
|
+
loop do
|
28
|
+
results = paginate(per_page: PER_PAGE, page: page).find(args)
|
29
|
+
raise StopIteration if results.empty?
|
30
|
+
arr += results
|
31
|
+
page += 1
|
32
|
+
end
|
33
|
+
|
34
|
+
arr
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.lazy_all
|
38
|
+
Enumerator.new do |yielder|
|
39
|
+
page = 1
|
40
|
+
|
41
|
+
loop do
|
42
|
+
results = paginate(per_page: PER_PAGE, page: page).find(args)
|
43
|
+
raise StopIteration if results.empty?
|
44
|
+
results.each { |item| yielder << item }
|
45
|
+
page += 1
|
46
|
+
end
|
47
|
+
end.lazy
|
48
|
+
end
|
20
49
|
end
|
21
50
|
end
|
data/lib/productive/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: productive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josip Bišćan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: '0'
|
109
109
|
requirements: []
|
110
110
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.
|
111
|
+
rubygems_version: 2.6.7
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: A JSONAPI-based client to consume Productive API
|