paylocity_web_service 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/lib/paylocity_web_service/client/credentials.rb +2 -2
- data/lib/paylocity_web_service/client/employees.rb +4 -0
- data/lib/paylocity_web_service/client/onboardings.rb +9 -0
- data/lib/paylocity_web_service/client.rb +2 -0
- data/lib/paylocity_web_service/connection.rb +3 -3
- data/lib/paylocity_web_service/error.rb +57 -36
- data/lib/paylocity_web_service/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61c37a8407a937d427a0977f672e8a1cedb242aca0699641756595c377bc4ef6
|
4
|
+
data.tar.gz: 6dcbab6fdd29651035fc331d9df52db0dc2f71a50bef1d6c2cdaa83045e6b721
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6d40b77bcb8c7745e6db01ba7cf96f6c3318df04bf8fc592267a5934ba14d1e55d189cc7832e48ca87681edd1cbb4a33e74a1fdf4abf8aa1805761d76b363f3
|
7
|
+
data.tar.gz: bf2a545e9a90521fced8f9676288a230ef31efbcb301b9fa80327566e4e1f3b33f05014a7e93de3d9e580390b751b16fbb44235bf4fd0748e0abb53e2f4252ec
|
data/.gitignore
CHANGED
@@ -12,6 +12,10 @@ module PaylocityWebService
|
|
12
12
|
def create_employee(options={})
|
13
13
|
post("/api/v2/companies/#{company_id}/employees", options)
|
14
14
|
end
|
15
|
+
|
16
|
+
def create_staging_employee(options={})
|
17
|
+
post("/api/v2/weblinkstaging/companies/#{company_id}/employees/newemployees", options)
|
18
|
+
end
|
15
19
|
end
|
16
20
|
end
|
17
21
|
end
|
@@ -5,6 +5,7 @@ require 'paylocity_web_service/error'
|
|
5
5
|
require 'paylocity_web_service/client/companies'
|
6
6
|
require 'paylocity_web_service/client/employees'
|
7
7
|
require 'paylocity_web_service/client/credentials'
|
8
|
+
require 'paylocity_web_service/client/onboardings'
|
8
9
|
|
9
10
|
module PaylocityWebService
|
10
11
|
class Client
|
@@ -15,6 +16,7 @@ module PaylocityWebService
|
|
15
16
|
include PaylocityWebService::Client::Employees
|
16
17
|
include PaylocityWebService::Client::Companies
|
17
18
|
include PaylocityWebService::Client::Credentials
|
19
|
+
include PaylocityWebService::Client::Onboardings
|
18
20
|
|
19
21
|
def initialize(options={})
|
20
22
|
options = PaylocityWebService.options.merge(options)
|
@@ -70,9 +70,9 @@ module PaylocityWebService
|
|
70
70
|
response = connection.send(method) do |request|
|
71
71
|
case method
|
72
72
|
when :get, :delete
|
73
|
-
request.url(
|
73
|
+
request.url(path, options)
|
74
74
|
when :post, :put
|
75
|
-
request.path =
|
75
|
+
request.path = path
|
76
76
|
request.body = envelope_encrypt(options)
|
77
77
|
end
|
78
78
|
end
|
@@ -96,7 +96,7 @@ module PaylocityWebService
|
|
96
96
|
conn.request :retry, max: 2
|
97
97
|
conn.request :json
|
98
98
|
|
99
|
-
conn.use PaylocityWebService::Middleware::Response::RaiseError
|
99
|
+
# conn.use PaylocityWebService::Middleware::Response::RaiseError
|
100
100
|
conn.use FaradayMiddleware::ParseJson, :content_type => /\bjson$/
|
101
101
|
end
|
102
102
|
|
@@ -1,67 +1,88 @@
|
|
1
1
|
module PaylocityWebService
|
2
|
-
class Error < StandardError
|
2
|
+
class Error < StandardError
|
3
|
+
attr_accessor :response
|
4
|
+
|
3
5
|
# Returns the appropriate PaylocityWebService::Error subclass based
|
4
6
|
# on status and response message
|
5
7
|
#
|
6
8
|
# @param [Hash] response HTTP response
|
7
9
|
# @return [PaylocityWebService::Error]
|
8
10
|
def self.from_response(response)
|
9
|
-
|
11
|
+
status = response[:status].to_i
|
12
|
+
|
13
|
+
if klass = case status
|
10
14
|
when 400
|
11
|
-
|
15
|
+
PaylocityWebService::BadRequest
|
12
16
|
when 401
|
13
|
-
|
17
|
+
PaylocityWebService::ClientError
|
14
18
|
when 403
|
15
|
-
|
19
|
+
PaylocityWebService::Forbidden
|
16
20
|
when 404
|
17
|
-
|
21
|
+
PaylocityWebService::NotFound
|
18
22
|
when 405
|
19
|
-
|
23
|
+
PaylocityWebService::MethodNotAllowed
|
20
24
|
when 406
|
21
|
-
|
25
|
+
PaylocityWebService::NotAcceptable
|
22
26
|
when 409
|
23
|
-
|
27
|
+
PaylocityWebService::Conflict
|
24
28
|
when 415
|
25
|
-
|
29
|
+
PaylocityWebService::UnsupportedMediaType
|
26
30
|
when 422
|
27
|
-
|
31
|
+
PaylocityWebService::UnprocessableEntity
|
28
32
|
when 451
|
29
|
-
|
33
|
+
PaylocityWebService::UnavailableForLegalReasons
|
30
34
|
when 400..499
|
31
|
-
|
35
|
+
PaylocityWebService::ClientError
|
32
36
|
when 500
|
33
|
-
|
37
|
+
PaylocityWebService::InternalServerError
|
34
38
|
when 501
|
35
|
-
|
39
|
+
PaylocityWebService::NotImplemented
|
36
40
|
when 502
|
37
|
-
|
41
|
+
PaylocityWebService::BadGateway
|
38
42
|
when 503
|
39
|
-
|
43
|
+
PaylocityWebService::ServiceUnavailable
|
40
44
|
when 500..599
|
41
|
-
|
45
|
+
PaylocityWebService::ServerError
|
42
46
|
end
|
43
|
-
end
|
44
47
|
|
45
|
-
|
46
|
-
|
47
|
-
def self.response_values(response)
|
48
|
-
return nil if response.nil?
|
49
|
-
|
50
|
-
{
|
51
|
-
status: response.status,
|
52
|
-
headers: response.response_headers,
|
53
|
-
body: response.body,
|
54
|
-
request: {
|
55
|
-
method: response.method,
|
56
|
-
url_path: response.url.path,
|
57
|
-
params: response.params,
|
58
|
-
headers: response.request_headers,
|
59
|
-
body: response.request_body
|
60
|
-
}
|
61
|
-
}
|
48
|
+
klass.new(response)
|
62
49
|
end
|
63
50
|
end
|
64
51
|
|
52
|
+
private
|
53
|
+
|
54
|
+
def initialize(response=nil)
|
55
|
+
@response = response
|
56
|
+
super(build_error_message)
|
57
|
+
end
|
58
|
+
|
59
|
+
def build_error_message
|
60
|
+
return nil if response.nil?
|
61
|
+
|
62
|
+
message = "Status: #{response&.status} \n"
|
63
|
+
message << "Method: #{response&.method&.to_s.upcase} \n"
|
64
|
+
message << "URL: #{response&.url&.to_s} \n"
|
65
|
+
message << "Body: \n"
|
66
|
+
message << JSON.pretty_generate(response&.body)
|
67
|
+
message
|
68
|
+
|
69
|
+
# message = {
|
70
|
+
# status: response.status,
|
71
|
+
# headers: response.response_headers,
|
72
|
+
# body: response.body,
|
73
|
+
# request: {
|
74
|
+
# method: response.method,
|
75
|
+
# url_path: response.url.path,
|
76
|
+
# params: response.params,
|
77
|
+
# headers: response.request_headers,
|
78
|
+
# body: response.request_body
|
79
|
+
# }
|
80
|
+
# }
|
81
|
+
# JSON.pretty_generate(message)
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
65
86
|
# Raised on errors in the 400-499 range
|
66
87
|
class ClientError < Error; end
|
67
88
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paylocity_web_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Lv
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- lib/paylocity_web_service/client/companies.rb
|
65
65
|
- lib/paylocity_web_service/client/credentials.rb
|
66
66
|
- lib/paylocity_web_service/client/employees.rb
|
67
|
+
- lib/paylocity_web_service/client/onboardings.rb
|
67
68
|
- lib/paylocity_web_service/configuration.rb
|
68
69
|
- lib/paylocity_web_service/connection.rb
|
69
70
|
- lib/paylocity_web_service/encryption.rb
|