splinter-pto 0.1.5 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +39 -34
- data/README.md +31 -1
- data/lib/splinter/api.rb +19 -7
- data/lib/splinter/version.rb +1 -1
- data/splinter.gemspec +4 -9
- metadata +14 -103
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a59c344c2b2855841431b98c542f12757b06275df2fe0073df337b147524fc8e
|
4
|
+
data.tar.gz: cda5af416943056e2c42c46b8e623cb8c6122a0bc5d5b323a34300a7a8b5c4b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1314d55b3972cfb9b53e9b3a8409e67aee3d862b0b3471cf7f828df4ee3f3d2df787fe70638cab7d2c1e4bb1664f2ac6487ec246bf83dd1483df356a4eb859be
|
7
|
+
data.tar.gz: 68f10155d9e6715cfaf749ad47ccfa6f4ba0a6788a23873fbac84a16fb59f1b505e437f0aedbd2c700f5f662bfb3695fac8368368971657e0663c429f6848ad7
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
@@ -4,3 +4,14 @@ source 'https://rubygems.org'
|
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in splinter.gemspec
|
6
6
|
gemspec
|
7
|
+
|
8
|
+
# Development Dependencies
|
9
|
+
group :development, :test do
|
10
|
+
gem 'pry', '~> 0.13'
|
11
|
+
gem 'rake', '~> 13.0'
|
12
|
+
gem 'rspec', '~> 3.7', '>= 3.9.0'
|
13
|
+
gem 'rubocop', '~> 1.65'
|
14
|
+
gem 'rubocop-packaging', '~> 0.5'
|
15
|
+
gem 'rubocop-rake', '~> 0.6'
|
16
|
+
gem 'rubocop-rspec', '~> 3.0'
|
17
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
splinter-pto (0.1.
|
4
|
+
splinter-pto (0.1.7)
|
5
|
+
json
|
5
6
|
rest-client (~> 2.0)
|
6
7
|
|
7
8
|
GEM
|
@@ -10,32 +11,35 @@ GEM
|
|
10
11
|
ast (2.4.2)
|
11
12
|
coderay (1.1.3)
|
12
13
|
diff-lcs (1.4.4)
|
13
|
-
domain_name (0.
|
14
|
-
unf (>= 0.0.5, < 1.0.0)
|
14
|
+
domain_name (0.6.20240107)
|
15
15
|
http-accept (1.7.0)
|
16
|
-
http-cookie (1.0.
|
16
|
+
http-cookie (1.0.5)
|
17
17
|
domain_name (~> 0.5)
|
18
|
-
json (2.
|
18
|
+
json (2.7.2)
|
19
|
+
language_server-protocol (3.17.0.3)
|
19
20
|
method_source (1.0.0)
|
20
|
-
mime-types (3.
|
21
|
+
mime-types (3.5.2)
|
21
22
|
mime-types-data (~> 3.2015)
|
22
|
-
mime-types-data (3.
|
23
|
+
mime-types-data (3.2024.0305)
|
23
24
|
netrc (0.11.0)
|
24
|
-
parallel (1.
|
25
|
-
parser (3.
|
25
|
+
parallel (1.25.1)
|
26
|
+
parser (3.3.4.0)
|
26
27
|
ast (~> 2.4.1)
|
28
|
+
racc
|
27
29
|
pry (0.14.1)
|
28
30
|
coderay (~> 1.1)
|
29
31
|
method_source (~> 1.0)
|
30
|
-
|
32
|
+
racc (1.8.0)
|
33
|
+
rainbow (3.1.1)
|
31
34
|
rake (13.0.3)
|
32
|
-
regexp_parser (2.
|
35
|
+
regexp_parser (2.9.2)
|
33
36
|
rest-client (2.1.0)
|
34
37
|
http-accept (>= 1.7.0, < 2.0)
|
35
38
|
http-cookie (>= 1.0.2, < 2.0)
|
36
39
|
mime-types (>= 1.16, < 4.0)
|
37
40
|
netrc (~> 0.8)
|
38
|
-
rexml (3.
|
41
|
+
rexml (3.3.1)
|
42
|
+
strscan
|
39
43
|
rspec (3.10.0)
|
40
44
|
rspec-core (~> 3.10.0)
|
41
45
|
rspec-expectations (~> 3.10.0)
|
@@ -49,39 +53,40 @@ GEM
|
|
49
53
|
diff-lcs (>= 1.2.0, < 2.0)
|
50
54
|
rspec-support (~> 3.10.0)
|
51
55
|
rspec-support (3.10.2)
|
52
|
-
rubocop (
|
56
|
+
rubocop (1.65.0)
|
57
|
+
json (~> 2.3)
|
58
|
+
language_server-protocol (>= 3.17.0)
|
53
59
|
parallel (~> 1.10)
|
54
|
-
parser (>=
|
60
|
+
parser (>= 3.3.0.2)
|
55
61
|
rainbow (>= 2.2.2, < 4.0)
|
56
|
-
regexp_parser (>=
|
57
|
-
rexml
|
58
|
-
rubocop-ast (>=
|
62
|
+
regexp_parser (>= 2.4, < 3.0)
|
63
|
+
rexml (>= 3.2.5, < 4.0)
|
64
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
59
65
|
ruby-progressbar (~> 1.7)
|
60
|
-
unicode-display_width (>=
|
61
|
-
rubocop-ast (1.
|
62
|
-
parser (>= 3.
|
63
|
-
rubocop-packaging (0.5.
|
64
|
-
rubocop (>=
|
65
|
-
rubocop-
|
66
|
-
rubocop (~> 0
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
unicode-display_width (1.7.0)
|
66
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
67
|
+
rubocop-ast (1.31.3)
|
68
|
+
parser (>= 3.3.1.0)
|
69
|
+
rubocop-packaging (0.5.2)
|
70
|
+
rubocop (>= 1.33, < 2.0)
|
71
|
+
rubocop-rake (0.6.0)
|
72
|
+
rubocop (~> 1.0)
|
73
|
+
rubocop-rspec (3.0.3)
|
74
|
+
rubocop (~> 1.61)
|
75
|
+
ruby-progressbar (1.13.0)
|
76
|
+
strscan (3.1.0)
|
77
|
+
unicode-display_width (2.5.0)
|
73
78
|
|
74
79
|
PLATFORMS
|
75
80
|
ruby
|
76
81
|
|
77
82
|
DEPENDENCIES
|
78
|
-
json
|
79
83
|
pry (~> 0.13)
|
80
84
|
rake (~> 13.0)
|
81
85
|
rspec (~> 3.7, >= 3.9.0)
|
82
|
-
rubocop (~>
|
83
|
-
rubocop-packaging (~> 0.
|
84
|
-
rubocop-
|
86
|
+
rubocop (~> 1.65)
|
87
|
+
rubocop-packaging (~> 0.5)
|
88
|
+
rubocop-rake (~> 0.6)
|
89
|
+
rubocop-rspec (~> 3.0)
|
85
90
|
splinter-pto!
|
86
91
|
|
87
92
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -19,7 +19,37 @@ Or install it yourself as:
|
|
19
19
|
$ gem install splinter-pto
|
20
20
|
|
21
21
|
## Usage
|
22
|
-
|
22
|
+
|
23
|
+
### Configuration
|
24
|
+
|
25
|
+
Configure an API Key:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
Splinter.configure do |c|
|
29
|
+
c.api_key = "MY_API_KEY"
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
### OOO Events
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
# Get all PTO Events
|
37
|
+
Splinter::OOOEvents.get_all
|
38
|
+
|
39
|
+
event_id = 1 # example event ID
|
40
|
+
Splinter::OOOEvents.find(event_id)
|
41
|
+
```
|
42
|
+
|
43
|
+
### OOO Types
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
# List all OOO Event Types
|
47
|
+
Splinter::OOOTypes.get_all
|
48
|
+
|
49
|
+
# Find a specific event type by ID
|
50
|
+
type_id = '1'
|
51
|
+
Splinter::OOOTypes.find(type_id)
|
52
|
+
```
|
23
53
|
|
24
54
|
## Development
|
25
55
|
|
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
|
-
BASE_URL = 'https://ninja
|
9
|
+
BASE_URL = 'https://ninja.tryroots.io/api/beta'
|
9
10
|
|
10
11
|
def self.get(endpoint)
|
11
|
-
|
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
|
-
|
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
|
21
|
+
result = RestClient.get(url, headers)
|
22
22
|
parsed_result = JSON.parse(result.body)
|
23
23
|
results.concat(parsed_result['results'])
|
24
|
-
url = parsed_result
|
24
|
+
url = parsed_result&.dig('next')
|
25
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
|
data/lib/splinter/version.rb
CHANGED
data/splinter.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
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.
|
14
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.7.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,13 +26,8 @@ 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.
|
29
|
+
spec.add_dependency 'json'
|
30
|
+
spec.add_dependency 'rest-client', '~> 2.0'
|
30
31
|
|
31
|
-
spec.
|
32
|
-
spec.add_development_dependency 'pry', '~> 0.13'
|
33
|
-
spec.add_development_dependency 'rake', '~> 13.0'
|
34
|
-
spec.add_development_dependency 'rspec', '~> 3.7', '>= 3.9.0'
|
35
|
-
spec.add_development_dependency 'rubocop', '~> 0.85'
|
36
|
-
spec.add_development_dependency 'rubocop-packaging', '~> 0.1'
|
37
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 1.39'
|
32
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
38
33
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: splinter-pto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lien Van Den Steen
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-07-15 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'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: json
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -31,7 +17,7 @@ dependencies:
|
|
31
17
|
- - ">="
|
32
18
|
- !ruby/object:Gem::Version
|
33
19
|
version: '0'
|
34
|
-
type: :
|
20
|
+
type: :runtime
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
@@ -39,96 +25,20 @@ dependencies:
|
|
39
25
|
- !ruby/object:Gem::Version
|
40
26
|
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0.13'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0.13'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '13.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '13.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rspec
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '3.7'
|
76
|
-
- - ">="
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: 3.9.0
|
79
|
-
type: :development
|
80
|
-
prerelease: false
|
81
|
-
version_requirements: !ruby/object:Gem::Requirement
|
82
|
-
requirements:
|
83
|
-
- - "~>"
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '3.7'
|
86
|
-
- - ">="
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: 3.9.0
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: rubocop
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - "~>"
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: '0.85'
|
96
|
-
type: :development
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - "~>"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '0.85'
|
103
|
-
- !ruby/object:Gem::Dependency
|
104
|
-
name: rubocop-packaging
|
105
|
-
requirement: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - "~>"
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0.1'
|
110
|
-
type: :development
|
111
|
-
prerelease: false
|
112
|
-
version_requirements: !ruby/object:Gem::Requirement
|
113
|
-
requirements:
|
114
|
-
- - "~>"
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: '0.1'
|
117
|
-
- !ruby/object:Gem::Dependency
|
118
|
-
name: rubocop-rspec
|
28
|
+
name: rest-client
|
119
29
|
requirement: !ruby/object:Gem::Requirement
|
120
30
|
requirements:
|
121
31
|
- - "~>"
|
122
32
|
- !ruby/object:Gem::Version
|
123
|
-
version: '
|
124
|
-
type: :
|
33
|
+
version: '2.0'
|
34
|
+
type: :runtime
|
125
35
|
prerelease: false
|
126
36
|
version_requirements: !ruby/object:Gem::Requirement
|
127
37
|
requirements:
|
128
38
|
- - "~>"
|
129
39
|
- !ruby/object:Gem::Version
|
130
|
-
version: '
|
131
|
-
description:
|
40
|
+
version: '2.0'
|
41
|
+
description:
|
132
42
|
email:
|
133
43
|
- lvandensteen@gitlab.com
|
134
44
|
executables: []
|
@@ -162,7 +72,8 @@ metadata:
|
|
162
72
|
homepage_uri: https://gitlab.com/gitlab-com/people-group/peopleops-eng/splinter
|
163
73
|
source_code_uri: https://gitlab.com/gitlab-com/people-group/peopleops-eng/splinter
|
164
74
|
changelog_uri: https://gitlab.com/gitlab-com/people-group/peopleops-eng/splinter
|
165
|
-
|
75
|
+
rubygems_mfa_required: 'true'
|
76
|
+
post_install_message:
|
166
77
|
rdoc_options: []
|
167
78
|
require_paths:
|
168
79
|
- lib
|
@@ -170,15 +81,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
170
81
|
requirements:
|
171
82
|
- - ">="
|
172
83
|
- !ruby/object:Gem::Version
|
173
|
-
version: 2.
|
84
|
+
version: 2.7.0
|
174
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
175
86
|
requirements:
|
176
87
|
- - ">="
|
177
88
|
- !ruby/object:Gem::Version
|
178
89
|
version: '0'
|
179
90
|
requirements: []
|
180
|
-
rubygems_version: 3.
|
181
|
-
signing_key:
|
91
|
+
rubygems_version: 3.5.11
|
92
|
+
signing_key:
|
182
93
|
specification_version: 4
|
183
94
|
summary: Ruby wrapper for the PTO by Roots API
|
184
95
|
test_files: []
|