sfctl 1.0.0 → 1.0.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/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +5 -0
- data/lib/sfctl/toggl/sync.rb +25 -10
- data/lib/sfctl/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b7cfd503a3b18b2441f5cff3c07e2fbfa595abb035b93d4ecba4acb9765ff29
|
4
|
+
data.tar.gz: 7c73df09e0f4b7b1b9093744e09ea662165612e468efd9e0c850f81725d61af4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc9efd5ac1521f8d519dfde47a46366995b9ecb5a8ed40db41ba0b8e419689f785f6a9c1f148022db78e6794840ceade2de4c9ee192b3a6c4d0e24acf91bee23
|
7
|
+
data.tar.gz: cd16f04c78c00f8b54e1e45e201a32f93cc1733040934a2a2aa1dfdc9ca36bcddc630c53995f526518e9f33bbc8fbc3df0c99de83515a24d5ef8fabce4faa477
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# sfctl [](https://buildkite.com/starfish/sf-control)
|
2
|
+
[](https://app.fossa.io/projects/git%2Bgithub.com%2Falphatier-works%2Fsfctl?ref=badge_shield)
|
2
3
|
|
3
4
|
```
|
4
5
|
sfctl is a command line interface for the Starfish API.
|
@@ -270,3 +271,7 @@ Uploading to starfish.team: [IN PROGRESS|DONE]
|
|
270
271
|
|
271
272
|
[NEXT CONNECTION]
|
272
273
|
```
|
274
|
+
|
275
|
+
|
276
|
+
## License
|
277
|
+
[](https://app.fossa.io/projects/git%2Bgithub.com%2Falphatier-works%2Fsfctl?ref=badge_large)
|
data/lib/sfctl/toggl/sync.rb
CHANGED
@@ -20,31 +20,45 @@ module Sfctl
|
|
20
20
|
output.puts
|
21
21
|
output.puts
|
22
22
|
|
23
|
-
time_entries
|
23
|
+
time_entries
|
24
24
|
end
|
25
25
|
|
26
26
|
def self.time_entries_table_rows(time_entries)
|
27
|
-
rows = time_entries
|
27
|
+
rows = time_entries.sort_by { |te| te['start'] }.map do |te|
|
28
28
|
[
|
29
29
|
Date.parse(te['start']).to_s,
|
30
30
|
te['description'],
|
31
31
|
"#{humanize_duration(te['dur'])}h"
|
32
32
|
]
|
33
33
|
end
|
34
|
-
|
34
|
+
total_grand = time_entries.sum { |te| te['dur'] }
|
35
|
+
rows.push(['Total:', '', "#{humanize_duration(total_grand)}h"])
|
35
36
|
rows
|
36
37
|
end
|
37
38
|
|
38
39
|
def self.get_time_entries(connection, toggl_config, report_interval)
|
39
|
-
|
40
|
-
toggl_config['access_token'],
|
41
|
-
time_entries_params(connection, report_interval)
|
42
|
-
)
|
40
|
+
entries_list = []
|
43
41
|
|
44
|
-
|
42
|
+
page = 1
|
43
|
+
loop do
|
44
|
+
_success, body = Toggl::Client.time_entries(
|
45
|
+
toggl_config['access_token'],
|
46
|
+
time_entries_params(connection, report_interval, page)
|
47
|
+
)
|
48
|
+
|
49
|
+
entries_list << body['data']
|
50
|
+
entries_list.flatten!
|
51
|
+
entries_list.compact!
|
52
|
+
|
53
|
+
break if entries_list.length >= body['total_count']
|
54
|
+
|
55
|
+
page += 1
|
56
|
+
end
|
57
|
+
|
58
|
+
entries_list
|
45
59
|
end
|
46
60
|
|
47
|
-
def self.time_entries_params(connection, report_interval)
|
61
|
+
def self.time_entries_params(connection, report_interval, page = 1)
|
48
62
|
start_date, end_date = report_interval
|
49
63
|
params = {
|
50
64
|
workspace_id: connection['workspace_id'],
|
@@ -52,7 +66,8 @@ module Sfctl
|
|
52
66
|
billable: connection['billable'],
|
53
67
|
rounding: connection['rounding'],
|
54
68
|
since: start_date.to_s,
|
55
|
-
until: end_date.to_s
|
69
|
+
until: end_date.to_s,
|
70
|
+
page: page
|
56
71
|
}
|
57
72
|
params[:task_ids] = connection['task_ids'] if connection['task_ids'].length.positive?
|
58
73
|
params
|
data/lib/sfctl/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sfctl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Serhii Rudik
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-07-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -447,7 +447,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
447
447
|
- !ruby/object:Gem::Version
|
448
448
|
version: '0'
|
449
449
|
requirements: []
|
450
|
-
rubygems_version: 3.1.
|
450
|
+
rubygems_version: 3.1.4
|
451
451
|
signing_key:
|
452
452
|
specification_version: 4
|
453
453
|
summary: sfctl is a command line interface for the Starfish API.
|