paylocity_web_service 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 785d1989802a97490574f7527a260c0c3e3a1d598301421cc74630525cc4f0a4
|
4
|
+
data.tar.gz: f1323abd22825eacf39dc03c3f1abc20ef2994f89b811f3295a73f2b0f5d936b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b0d6ed1aa48cbf529597a210c519916b2b2b44f38c0f82848909c404fef3cf4d6fee9aa0f5fe33779c2a499fd7d820a80906e112187a24d6d9736a543266a12
|
7
|
+
data.tar.gz: 94882dbd2970de70dd7552ccc133f0ca03e8bc2d43d2be95e845dbec2796e25a136281599265ec313f1ec4927c2e592ba5b29dd72a81166ef3deca11b0e19c6f
|
@@ -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
|
@@ -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
|
@@ -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.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Lv
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|