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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 987345c89cefd795ef0e0caf100079fdae0d21928e5dd797216132aed206834b
4
- data.tar.gz: b6935e7ebbaa5af76c6d16ce666da547b32262c3dbe688a7e51dc5201788e4bd
3
+ metadata.gz: 8b7cfd503a3b18b2441f5cff3c07e2fbfa595abb035b93d4ecba4acb9765ff29
4
+ data.tar.gz: 7c73df09e0f4b7b1b9093744e09ea662165612e468efd9e0c850f81725d61af4
5
5
  SHA512:
6
- metadata.gz: ac9d36c7c89667c8cd92be1e1ef61009674ef889ba971a40108ca6ca9342e244033d239349ff66ead8fa994a827c5f3f21252bc440ffe3345298f03d47a3ef74
7
- data.tar.gz: 6e29f52a803757984dede41303d62109734a09090492d414972f908369f70596dbadaabd35fe37557b73fa1286407d17b9fdeec6faeaf8ed2d39608a9bf467a9
6
+ metadata.gz: bc9efd5ac1521f8d519dfde47a46366995b9ecb5a8ed40db41ba0b8e419689f785f6a9c1f148022db78e6794840ceade2de4c9ee192b3a6c4d0e24acf91bee23
7
+ data.tar.gz: cd16f04c78c00f8b54e1e45e201a32f93cc1733040934a2a2aa1dfdc9ca36bcddc630c53995f526518e9f33bbc8fbc3df0c99de83515a24d5ef8fabce4faa477
data/.gitignore CHANGED
@@ -12,3 +12,4 @@
12
12
  .DS_Store
13
13
  sfctl-*.gem
14
14
  /.sflink
15
+ .byebug_history
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sfctl (0.1.0)
4
+ sfctl (1.0.1)
5
5
  faraday (~> 1.0)
6
6
  pastel (~> 0.7)
7
7
  rake (~> 12.0)
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # sfctl [![Build status](https://badge.buildkite.com/22ecc67f358163f4714383ff0fde8e847d1e3ae488fc10312f.svg)](https://buildkite.com/starfish/sf-control)
2
+ [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Falphatier-works%2Fsfctl.svg?type=shield)](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
+ [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Falphatier-works%2Fsfctl.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Falphatier-works%2Fsfctl?ref=badge_large)
@@ -20,31 +20,45 @@ module Sfctl
20
20
  output.puts
21
21
  output.puts
22
22
 
23
- time_entries['data']
23
+ time_entries
24
24
  end
25
25
 
26
26
  def self.time_entries_table_rows(time_entries)
27
- rows = time_entries['data'].sort_by { |te| te['start'] }.map do |te|
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
- rows.push(['Total:', '', "#{humanize_duration(time_entries['total_grand'])}h"])
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
- _success, data = Toggl::Client.time_entries(
40
- toggl_config['access_token'],
41
- time_entries_params(connection, report_interval)
42
- )
40
+ entries_list = []
43
41
 
44
- data
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
@@ -1,3 +1,3 @@
1
1
  module Sfctl
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
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.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-06-12 00:00:00.000000000 Z
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.3
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.