splinter-pto 0.1.1 → 0.1.6

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: 56ca9967773dfdf635ad536854b060577bf41e7efc37efb117279f40358737f5
4
- data.tar.gz: 8e4d2b5329063680edb67fd132c7f293ec23cc51e6c3314b58ca8a60be5fbb52
3
+ metadata.gz: 244d535b9b207228adf3e369095795b614ad8a1f8d11b65d061d8d8221fb5803
4
+ data.tar.gz: 92af48704ef825497a0b6d83dfb45778f5f6e0021fc4d92b9c9e0ecdfca7410d
5
5
  SHA512:
6
- metadata.gz: e888b01d5c453a9887f71d74499dcebc91797de5b95956546d7edf1a8825eef35f9c525efc1a14dcbcdabeaca108cf01217cee4af4b89860af7d05c9ab960e87
7
- data.tar.gz: ff3ecd5d9b6dabc241a7797c2cf218214757289475764b0e4af29224a1818456be474211c25885c44912437d4ea9f190196a11b14206b034a582463d36ae795b
6
+ metadata.gz: 590718ca6a66a73d1a7a88ca7d35a90bd65a4a8b97731fe98ad00617aae5624e014e1b4c7306f960c9bfbff61117a7fa758ea2a9d1988a27f42111a7f703f678
7
+ data.tar.gz: 24c492f39b77aaaf2568a8f7d29a69a13937f4e13a7f1c9cfa61b5833dca60bd17ea5cff7d64a497dc0cda8e634235af648137dde2cb95101d8b040c8556b715
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-09-01 14:54:03 UTC using RuboCop version 0.90.0.
3
+ # on 2020-10-30 09:28:15 UTC using RuboCop version 0.90.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -16,14 +16,15 @@ Packaging/GemspecGit:
16
16
  Exclude:
17
17
  - 'splinter.gemspec'
18
18
 
19
- # Offense count: 4
19
+ # Offense count: 6
20
20
  # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
21
21
  RSpec/VerifiedDoubles:
22
22
  Exclude:
23
23
  - 'spec/lib/splinter/api_spec.rb'
24
24
  - 'spec/lib/splinter/ooo_events_spec.rb'
25
+ - 'spec/lib/splinter/ooo_types_spec.rb'
25
26
 
26
- # Offense count: 2
27
+ # Offense count: 3
27
28
  # Cop supports --auto-correct.
28
29
  # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
29
30
  # SupportedStyles: single_quotes, double_quotes
@@ -31,3 +32,11 @@ Style/StringLiterals:
31
32
  Exclude:
32
33
  - 'spec/lib/splinter/api_spec.rb'
33
34
  - 'spec/lib/splinter/ooo_events_spec.rb'
35
+ - 'spec/lib/splinter/ooo_types_spec.rb'
36
+
37
+ # Offense count: 2
38
+ # Cop supports --auto-correct.
39
+ # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
40
+ # URISchemes: http, https
41
+ Layout/LineLength:
42
+ Max: 121
data/Gemfile.lock CHANGED
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- splinter-pto (0.1.1)
4
+ splinter-pto (0.1.6)
5
5
  rest-client (~> 2.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- ast (2.4.1)
10
+ ast (2.4.2)
11
11
  coderay (1.1.3)
12
12
  diff-lcs (1.4.4)
13
13
  domain_name (0.5.20190701)
@@ -15,56 +15,57 @@ GEM
15
15
  http-accept (1.7.0)
16
16
  http-cookie (1.0.3)
17
17
  domain_name (~> 0.5)
18
- json (2.3.1)
18
+ json (2.5.1)
19
19
  method_source (1.0.0)
20
20
  mime-types (3.3.1)
21
21
  mime-types-data (~> 3.2015)
22
- mime-types-data (3.2020.0512)
22
+ mime-types-data (3.2021.0225)
23
23
  netrc (0.11.0)
24
- parallel (1.19.2)
25
- parser (2.7.1.4)
24
+ parallel (1.20.1)
25
+ parser (3.0.1.1)
26
26
  ast (~> 2.4.1)
27
- pry (0.13.1)
27
+ pry (0.14.1)
28
28
  coderay (~> 1.1)
29
29
  method_source (~> 1.0)
30
30
  rainbow (3.0.0)
31
- rake (13.0.1)
32
- regexp_parser (1.7.1)
31
+ rake (13.0.3)
32
+ regexp_parser (2.1.1)
33
33
  rest-client (2.1.0)
34
34
  http-accept (>= 1.7.0, < 2.0)
35
35
  http-cookie (>= 1.0.2, < 2.0)
36
36
  mime-types (>= 1.16, < 4.0)
37
37
  netrc (~> 0.8)
38
- rexml (3.2.4)
39
- rspec (3.9.0)
40
- rspec-core (~> 3.9.0)
41
- rspec-expectations (~> 3.9.0)
42
- rspec-mocks (~> 3.9.0)
43
- rspec-core (3.9.2)
44
- rspec-support (~> 3.9.3)
45
- rspec-expectations (3.9.2)
38
+ rexml (3.2.5)
39
+ rspec (3.10.0)
40
+ rspec-core (~> 3.10.0)
41
+ rspec-expectations (~> 3.10.0)
42
+ rspec-mocks (~> 3.10.0)
43
+ rspec-core (3.10.1)
44
+ rspec-support (~> 3.10.0)
45
+ rspec-expectations (3.10.1)
46
46
  diff-lcs (>= 1.2.0, < 2.0)
47
- rspec-support (~> 3.9.0)
48
- rspec-mocks (3.9.1)
47
+ rspec-support (~> 3.10.0)
48
+ rspec-mocks (3.10.2)
49
49
  diff-lcs (>= 1.2.0, < 2.0)
50
- rspec-support (~> 3.9.0)
51
- rspec-support (3.9.3)
52
- rubocop (0.90.0)
50
+ rspec-support (~> 3.10.0)
51
+ rspec-support (3.10.2)
52
+ rubocop (0.93.1)
53
53
  parallel (~> 1.10)
54
- parser (>= 2.7.1.1)
54
+ parser (>= 2.7.1.5)
55
55
  rainbow (>= 2.2.2, < 4.0)
56
- regexp_parser (>= 1.7)
56
+ regexp_parser (>= 1.8)
57
57
  rexml
58
- rubocop-ast (>= 0.3.0, < 1.0)
58
+ rubocop-ast (>= 0.6.0)
59
59
  ruby-progressbar (~> 1.7)
60
60
  unicode-display_width (>= 1.4.0, < 2.0)
61
- rubocop-ast (0.3.0)
62
- parser (>= 2.7.1.4)
63
- rubocop-packaging (0.3.0)
64
- rubocop (~> 0.89)
65
- rubocop-rspec (1.43.2)
61
+ rubocop-ast (1.6.0)
62
+ parser (>= 3.0.1.1)
63
+ rubocop-packaging (0.5.1)
64
+ rubocop (>= 0.89, < 2.0)
65
+ rubocop-rspec (1.44.1)
66
66
  rubocop (~> 0.87)
67
- ruby-progressbar (1.10.1)
67
+ rubocop-ast (>= 0.7.1)
68
+ ruby-progressbar (1.11.0)
68
69
  unf (0.1.4)
69
70
  unf_ext
70
71
  unf_ext (0.0.7.7)
@@ -84,4 +85,4 @@ DEPENDENCIES
84
85
  splinter-pto!
85
86
 
86
87
  BUNDLED WITH
87
- 2.1.4
88
+ 2.2.16
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Splinter
2
2
 
3
- This is a wrapper for the [PTO Ninja API](https://treehoppr.com/api/documentation/ninja)
3
+ This is a wrapper for the [PTO by Roots API](https://www.tryroots.io/api-docs/pto)
4
4
 
5
5
  ## Installation
6
6
 
data/lib/splinter/api.rb CHANGED
@@ -2,29 +2,41 @@
2
2
 
3
3
  require 'rest-client'
4
4
  require 'json'
5
+ require 'uri'
5
6
 
6
7
  module Splinter
7
8
  class API
8
9
  BASE_URL = 'https://ninja-bot.treehoppr.com/api/beta'
9
10
 
10
11
  def self.get(endpoint)
11
- headers = { 'Authorization': "Token #{Splinter.configuration.api_key}" }
12
- response = RestClient.get("#{BASE_URL}/#{endpoint}", headers)
12
+ response = RestClient.get(build_url(endpoint), headers)
13
13
  JSON.parse(response.body)
14
14
  end
15
15
 
16
16
  def self.paginated_get(endpoint, params = {})
17
- headers = { 'Authorization': "Token #{Splinter.configuration.api_key}" }
18
- url = "#{BASE_URL}/#{endpoint}"
17
+ url = build_url(endpoint, params)
19
18
  results = []
19
+
20
20
  loop do
21
- result = RestClient.get(url, headers.merge({ params: params }))
21
+ result = RestClient.get(url, headers)
22
22
  parsed_result = JSON.parse(result.body)
23
- url = parsed_result.dig('next')
24
23
  results.concat(parsed_result['results'])
25
- break if url.nil? || parsed_result['results'].empty?
24
+ url = parsed_result.dig('next')
25
+ break if url.nil?
26
26
  end
27
+
27
28
  results
28
29
  end
30
+
31
+ def self.headers
32
+ { 'Authorization': "Token #{Splinter.configuration.api_key}" }
33
+ end
34
+
35
+ def self.build_url(endpoint, params = {})
36
+ url = "#{BASE_URL}/#{endpoint}"
37
+ url += "?#{URI.encode_www_form(params)}" unless params.empty?
38
+
39
+ url
40
+ end
29
41
  end
30
42
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Splinter
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.6'
5
5
  end
data/splinter.gemspec CHANGED
@@ -5,13 +5,13 @@ require_relative 'lib/splinter/version'
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'splinter-pto'
7
7
  spec.version = Splinter::VERSION
8
- spec.authors = ['lien van den steen']
8
+ spec.authors = ['Lien Van Den Steen']
9
9
  spec.email = ['lvandensteen@gitlab.com']
10
10
 
11
- spec.summary = 'Ruby wrapper for the PTO Ninja API'
11
+ spec.summary = 'Ruby wrapper for the PTO by Roots API'
12
12
  spec.homepage = 'https://gitlab.com/gitlab-com/people-group/peopleops-eng/splinter'
13
13
  spec.license = 'MIT'
14
- spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
14
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
15
15
 
16
16
  spec.metadata['homepage_uri'] = spec.homepage
17
17
  spec.metadata['source_code_uri'] = 'https://gitlab.com/gitlab-com/people-group/peopleops-eng/splinter'
@@ -26,11 +26,12 @@ Gem::Specification.new do |spec|
26
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
27
  spec.require_paths = ['lib']
28
28
 
29
+ spec.add_runtime_dependency 'rest-client', '~> 2.0'
30
+
29
31
  spec.add_development_dependency 'json'
30
32
  spec.add_development_dependency 'pry', '~> 0.13'
31
33
  spec.add_development_dependency 'rake', '~> 13.0'
32
34
  spec.add_development_dependency 'rspec', '~> 3.7', '>= 3.9.0'
33
- spec.add_runtime_dependency 'rest-client', '~> 2.0'
34
35
  spec.add_development_dependency 'rubocop', '~> 0.85'
35
36
  spec.add_development_dependency 'rubocop-packaging', '~> 0.1'
36
37
  spec.add_development_dependency 'rubocop-rspec', '~> 1.39'
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: splinter-pto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
- - lien van den steen
8
- autorequire:
7
+ - Lien Van Den Steen
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-03 00:00:00.000000000 Z
11
+ date: 2021-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rest-client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: json
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -72,20 +86,6 @@ dependencies:
72
86
  - - ">="
73
87
  - !ruby/object:Gem::Version
74
88
  version: 3.9.0
75
- - !ruby/object:Gem::Dependency
76
- name: rest-client
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - "~>"
80
- - !ruby/object:Gem::Version
81
- version: '2.0'
82
- type: :runtime
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - "~>"
87
- - !ruby/object:Gem::Version
88
- version: '2.0'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: rubocop
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -128,7 +128,7 @@ dependencies:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
130
  version: '1.39'
131
- description:
131
+ description:
132
132
  email:
133
133
  - lvandensteen@gitlab.com
134
134
  executables: []
@@ -162,7 +162,7 @@ metadata:
162
162
  homepage_uri: https://gitlab.com/gitlab-com/people-group/peopleops-eng/splinter
163
163
  source_code_uri: https://gitlab.com/gitlab-com/people-group/peopleops-eng/splinter
164
164
  changelog_uri: https://gitlab.com/gitlab-com/people-group/peopleops-eng/splinter
165
- post_install_message:
165
+ post_install_message:
166
166
  rdoc_options: []
167
167
  require_paths:
168
168
  - lib
@@ -170,15 +170,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - ">="
172
172
  - !ruby/object:Gem::Version
173
- version: 2.3.0
173
+ version: 2.4.0
174
174
  required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  requirements:
176
176
  - - ">="
177
177
  - !ruby/object:Gem::Version
178
178
  version: '0'
179
179
  requirements: []
180
- rubygems_version: 3.0.3
181
- signing_key:
180
+ rubygems_version: 3.2.3
181
+ signing_key:
182
182
  specification_version: 4
183
- summary: Ruby wrapper for the PTO Ninja API
183
+ summary: Ruby wrapper for the PTO by Roots API
184
184
  test_files: []