productive 0.6.58 → 0.6.60
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/json_api_paginator.rb +6 -58
- data/lib/productive/resources/role.rb +4 -0
- data/lib/productive/version.rb +1 -1
- data/lib/productive.rb +1 -0
- data/productive.gemspec +1 -2
- metadata +15 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b0581cbf5e2dd654905d5cbfb67e5cceca461b3db48757e0e1cae3a569e9a17
|
4
|
+
data.tar.gz: 1771d2708b58d47c891bbc63cd6ab59a17109d6cfbc476b97c8d63928f2ded18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 180bc3286195bac1465b0997353e104c88dbec6a2b98590b791f4799c70548d9236e4aba6509c92116bcfea74dbc7b0962919db03e5f07b4434641d0a1d5c580
|
7
|
+
data.tar.gz: 2969164942aa23e8e6e7b0cd6666a6a273045d0306b8b2e822ea67d711961951fb1db1bae7e1c1ba855cbc1a41d387948b56bdeab734d45b5095dd054dcfa534
|
data/lib/json_api_paginator.rb
CHANGED
@@ -1,67 +1,15 @@
|
|
1
|
-
|
1
|
+
class JsonApiPaginator < JsonApiClient::Paginating::NestedParamPaginator
|
2
|
+
self.page_param = 'number'
|
3
|
+
self.per_page_param = 'size'
|
2
4
|
|
3
|
-
|
4
|
-
attr_reader :params, :result_set, :links, :meta
|
5
|
+
attr_reader :meta
|
5
6
|
|
6
7
|
def initialize(result_set, data)
|
7
|
-
|
8
|
-
@result_set = result_set
|
9
|
-
@links = data['links'] || {}
|
8
|
+
super
|
10
9
|
@meta = data['meta'] || {}
|
11
10
|
end
|
12
11
|
|
13
|
-
def next
|
14
|
-
links['next'] ? result_set.links.fetch_link('next') : nil
|
15
|
-
end
|
16
|
-
|
17
|
-
def prev
|
18
|
-
links['prev'] ? result_set.links.fetch_link('prev') : nil
|
19
|
-
end
|
20
|
-
|
21
|
-
def first
|
22
|
-
links['first'] ? result_set.links.fetch_link('first') : nil
|
23
|
-
end
|
24
|
-
|
25
|
-
def last
|
26
|
-
links['last'] ? result_set.links.fetch_link('last') : nil
|
27
|
-
end
|
28
|
-
|
29
|
-
def total_pages
|
30
|
-
if links['last']
|
31
|
-
uri = result_set.links.link_url_for('last')
|
32
|
-
last_params = params_for_uri(uri)
|
33
|
-
last_params['page']['number'].to_i
|
34
|
-
else
|
35
|
-
current_page
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
12
|
def total_entries
|
40
|
-
meta['total_count'].to_i ||
|
41
|
-
end
|
42
|
-
alias_method :total_count, :total_entries
|
43
|
-
|
44
|
-
def per_page
|
45
|
-
params['page']['size'].to_i
|
46
|
-
end
|
47
|
-
|
48
|
-
def current_page
|
49
|
-
(params['page']['number'] || 1).to_i
|
50
|
-
end
|
51
|
-
|
52
|
-
def previous_page
|
53
|
-
current_page > 1 ? (current_page - 1) : nil
|
54
|
-
end
|
55
|
-
|
56
|
-
def next_page
|
57
|
-
current_page < total_pages ? (current_page + 1) : nil
|
58
|
-
end
|
59
|
-
|
60
|
-
private
|
61
|
-
|
62
|
-
def params_for_uri(uri)
|
63
|
-
return {} unless uri
|
64
|
-
uri = Addressable::URI.parse(uri)
|
65
|
-
Rack::Utils.parse_nested_query(uri.query || '')
|
13
|
+
meta['total_count'].to_i || super
|
66
14
|
end
|
67
15
|
end
|
data/lib/productive/version.rb
CHANGED
data/lib/productive.rb
CHANGED
@@ -72,6 +72,7 @@ require 'productive/resources/reports/project_report'
|
|
72
72
|
require 'productive/resources/reports/service_report'
|
73
73
|
require 'productive/resources/reports/task_report'
|
74
74
|
require 'productive/resources/reports/time_entry_report'
|
75
|
+
require 'productive/resources/role'
|
75
76
|
require 'productive/resources/salary'
|
76
77
|
require 'productive/resources/salary_report'
|
77
78
|
require 'productive/resources/sales_report'
|
data/productive.gemspec
CHANGED
@@ -13,7 +13,6 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.license = 'MIT'
|
14
14
|
s.files = `git ls-files`.split("\n")
|
15
15
|
|
16
|
-
s.add_dependency '
|
17
|
-
s.add_dependency 'json_api_client', '>= 1.5.2'
|
16
|
+
s.add_dependency 'json_api_client', '>= 1.13.0', "<= 1.21.0"
|
18
17
|
s.add_dependency 'request_store', '~> 1.3'
|
19
18
|
end
|
metadata
CHANGED
@@ -1,43 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: productive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.60
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josip Bišćan
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rack
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: json_api_client
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - ">="
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
19
|
+
version: 1.13.0
|
20
|
+
- - "<="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.21.0
|
34
23
|
type: :runtime
|
35
24
|
prerelease: false
|
36
25
|
version_requirements: !ruby/object:Gem::Requirement
|
37
26
|
requirements:
|
38
27
|
- - ">="
|
39
28
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
29
|
+
version: 1.13.0
|
30
|
+
- - "<="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.21.0
|
41
33
|
- !ruby/object:Gem::Dependency
|
42
34
|
name: request_store
|
43
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -139,6 +131,7 @@ files:
|
|
139
131
|
- lib/productive/resources/reports/service_report.rb
|
140
132
|
- lib/productive/resources/reports/task_report.rb
|
141
133
|
- lib/productive/resources/reports/time_entry_report.rb
|
134
|
+
- lib/productive/resources/role.rb
|
142
135
|
- lib/productive/resources/salary.rb
|
143
136
|
- lib/productive/resources/salary_report.rb
|
144
137
|
- lib/productive/resources/sales_report.rb
|
@@ -165,7 +158,7 @@ homepage: https://github.com/productiveio/api_client
|
|
165
158
|
licenses:
|
166
159
|
- MIT
|
167
160
|
metadata: {}
|
168
|
-
post_install_message:
|
161
|
+
post_install_message:
|
169
162
|
rdoc_options: []
|
170
163
|
require_paths:
|
171
164
|
- lib
|
@@ -180,8 +173,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
173
|
- !ruby/object:Gem::Version
|
181
174
|
version: '0'
|
182
175
|
requirements: []
|
183
|
-
rubygems_version: 3.
|
184
|
-
signing_key:
|
176
|
+
rubygems_version: 3.3.7
|
177
|
+
signing_key:
|
185
178
|
specification_version: 4
|
186
179
|
summary: A JSONAPI-based client to consume Productive API
|
187
180
|
test_files: []
|