breathe 0.3.1 → 0.3.2
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/CHANGELOG.md +5 -0
- data/README.md +7 -0
- data/lib/breathe.rb +3 -0
- data/lib/breathe/absences.rb +5 -14
- data/lib/breathe/client.rb +4 -0
- data/lib/breathe/employee_training_courses.rb +8 -0
- data/lib/breathe/employees.rb +6 -21
- data/lib/breathe/resource.rb +34 -0
- data/lib/breathe/sicknesses.rb +5 -14
- data/lib/breathe/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96b92d21eb2bfb0d148c30e774fb209332d9d417921c26f1a51448ebea86a949
|
4
|
+
data.tar.gz: 863903e2d56dc255f219ed8b6da8164dc3e685c0c25e87db341319f49f21aab7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0447d915f7761db9d2c55728349d4d00655bc1b16f37be622de6c2b22288186836c0330198eca6b1267445a412c73fa8c9dcbb8bf95a48e5ff2135bd3d375d5c
|
7
|
+
data.tar.gz: 1d79b24732559cb2373eff989a23073295ffc8f7a2a940a2b5ccaa93c4ddcf8d2d9d8865a21e1223f07a6839e91262b0734d12576ee9d2872f6c69ebf4e3696d
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
|
5
5
|
The format is based on [Keep a Changelog]
|
6
6
|
|
7
|
+
[0.3.2]
|
8
|
+
|
9
|
+
- Support listing of training courses
|
10
|
+
|
7
11
|
[0.3.1]
|
8
12
|
|
9
13
|
- Fix bug with auto pagination
|
@@ -30,6 +34,7 @@ The format is based on [Keep a Changelog]
|
|
30
34
|
|
31
35
|
- Allow listing of absences
|
32
36
|
|
37
|
+
[0.3.2]: https://github.com/dxw/breathe_ruby/releases/tag/0.3.2
|
33
38
|
[0.3.1]: https://github.com/dxw/breathe_ruby/releases/tag/0.3.1
|
34
39
|
[0.3.0]: https://github.com/dxw/breathe_ruby/releases/tag/0.3.0
|
35
40
|
[0.2.0]: https://github.com/dxw/breathe_ruby/releases/tag/0.2.0
|
data/README.md
CHANGED
data/lib/breathe.rb
CHANGED
@@ -3,14 +3,17 @@ require "sawyer"
|
|
3
3
|
require "breathe/version"
|
4
4
|
require "breathe/client"
|
5
5
|
require "breathe/response"
|
6
|
+
require "breathe/resource"
|
6
7
|
|
7
8
|
require "breathe/absences"
|
8
9
|
require "breathe/sicknesses"
|
9
10
|
require "breathe/employees"
|
11
|
+
require "breathe/employee_training_courses"
|
10
12
|
|
11
13
|
module Breathe
|
12
14
|
class Error < StandardError; end
|
13
15
|
class AuthenticationError < StandardError; end
|
14
16
|
class UnknownError < StandardError; end
|
17
|
+
class NotSupportedError < StandardError; end
|
15
18
|
# Your code goes here...
|
16
19
|
end
|
data/lib/breathe/absences.rb
CHANGED
@@ -1,17 +1,8 @@
|
|
1
1
|
module Breathe
|
2
|
-
class Absences
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
end
|
8
|
-
|
9
|
-
def list(args = {})
|
10
|
-
client.response(
|
11
|
-
method: :get,
|
12
|
-
path: "absences",
|
13
|
-
args: args
|
14
|
-
)
|
15
|
-
end
|
2
|
+
class Absences < Resource
|
3
|
+
RESOURCE_NAME = "absences"
|
4
|
+
SUPPORTED_ENDPOINTS = [
|
5
|
+
:list,
|
6
|
+
]
|
16
7
|
end
|
17
8
|
end
|
data/lib/breathe/client.rb
CHANGED
@@ -21,6 +21,10 @@ module Breathe
|
|
21
21
|
@employees ||= Employees.new(self)
|
22
22
|
end
|
23
23
|
|
24
|
+
def employee_training_courses
|
25
|
+
@employee_training_courses ||= EmployeeTrainingCourses.new(self)
|
26
|
+
end
|
27
|
+
|
24
28
|
def response(method:, path:, args: {})
|
25
29
|
response = request(method: method, path: path, options: {query: args})
|
26
30
|
parsed_response = Response.new(response: response, type: path.split("/").first)
|
data/lib/breathe/employees.rb
CHANGED
@@ -1,24 +1,9 @@
|
|
1
1
|
module Breathe
|
2
|
-
class Employees
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
def list(args = {})
|
10
|
-
client.response(
|
11
|
-
method: :get,
|
12
|
-
path: "employees",
|
13
|
-
args: args
|
14
|
-
)
|
15
|
-
end
|
16
|
-
|
17
|
-
def get(id)
|
18
|
-
client.response(
|
19
|
-
method: :get,
|
20
|
-
path: "employees/#{id.to_i}"
|
21
|
-
)
|
22
|
-
end
|
2
|
+
class Employees < Resource
|
3
|
+
RESOURCE_NAME = "employees"
|
4
|
+
SUPPORTED_ENDPOINTS = [
|
5
|
+
:list,
|
6
|
+
:get,
|
7
|
+
]
|
23
8
|
end
|
24
9
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Breathe
|
2
|
+
class Resource
|
3
|
+
attr_reader :client
|
4
|
+
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(args = {})
|
10
|
+
raise NotSupportedError unless self.class::SUPPORTED_ENDPOINTS.include?(:list)
|
11
|
+
|
12
|
+
client.response(
|
13
|
+
method: :get,
|
14
|
+
path: resource_name,
|
15
|
+
args: args
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
def get(id)
|
20
|
+
raise NotSupportedError unless self.class::SUPPORTED_ENDPOINTS.include?(:get)
|
21
|
+
|
22
|
+
client.response(
|
23
|
+
method: :get,
|
24
|
+
path: "#{resource_name}/#{id.to_i}"
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def resource_name
|
31
|
+
@resource_name ||= self.class::RESOURCE_NAME
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/breathe/sicknesses.rb
CHANGED
@@ -1,17 +1,8 @@
|
|
1
1
|
module Breathe
|
2
|
-
class Sicknesses
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
end
|
8
|
-
|
9
|
-
def list(args = {})
|
10
|
-
client.response(
|
11
|
-
method: :get,
|
12
|
-
path: "sicknesses",
|
13
|
-
args: args
|
14
|
-
)
|
15
|
-
end
|
2
|
+
class Sicknesses < Resource
|
3
|
+
RESOURCE_NAME = "sicknesses"
|
4
|
+
SUPPORTED_ENDPOINTS = [
|
5
|
+
:list,
|
6
|
+
]
|
16
7
|
end
|
17
8
|
end
|
data/lib/breathe/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: breathe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stuart Harrison
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -147,7 +147,9 @@ files:
|
|
147
147
|
- lib/breathe.rb
|
148
148
|
- lib/breathe/absences.rb
|
149
149
|
- lib/breathe/client.rb
|
150
|
+
- lib/breathe/employee_training_courses.rb
|
150
151
|
- lib/breathe/employees.rb
|
152
|
+
- lib/breathe/resource.rb
|
151
153
|
- lib/breathe/response.rb
|
152
154
|
- lib/breathe/sicknesses.rb
|
153
155
|
- lib/breathe/version.rb
|