wolf_core 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wolf_core/application/barton/mappings.rb +46 -45
- data/lib/wolf_core/application/burnett/auth/auth_operations.rb +8 -9
- data/lib/wolf_core/application/burnett/match_operations/match_operattions.rb +45 -0
- data/lib/wolf_core/application/burnett/positions_operations/positions_operations.rb +45 -0
- data/lib/wolf_core/application/integrations/orders_api_operations.rb +11 -10
- data/lib/wolf_core/utils/file_utils.rb +41 -37
- data/lib/wolf_core/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: 82a7cb08945e955a025445c25fc2ef2e870ee862f554c5cc605236cfe765932c
|
4
|
+
data.tar.gz: c48627a923a8305923f751ea1b6204ef1ccb9976e42cb4a7071ff9ffb619fa1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ed382ab307462e355acef58096444cd29d5d762625e8ff49d447e0c529cf11f1a772d4ebb9876a3a58817210fb8fa1ad1b567614939ed28902bd1b45718054b
|
7
|
+
data.tar.gz: 62bca4dbf76087e2e03e0a021a5a95355de8d55efd85da1bcdeec9dcefb4c59bcc41dbc816584e487e9ed4cd6c5f0c76ba2352cf3ace97c4d72a134978a9c39c
|
@@ -2,42 +2,42 @@ module WolfCore
|
|
2
2
|
module Barton
|
3
3
|
module Mappings
|
4
4
|
PROVIDER_TYPE_MAPPING = {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
"MD" => ENV["MD_PRICING_ID"],
|
6
|
+
"DO" => ENV["DO_PRICING_ID"],
|
7
|
+
"PA" => ENV["PA_PRICING_ID"],
|
8
|
+
"DMD" => ENV["DMD_PRICING_ID"],
|
9
|
+
"NP" => ENV["NP_PRICING_ID"],
|
10
|
+
"DDS" => ENV["DDS_PRICING_ID"],
|
11
|
+
"GP" => ENV["GP_PRICING_ID"]
|
12
12
|
}
|
13
13
|
|
14
14
|
LOCUM_AVAILABILITY_MAP = {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
"PT" => "Part Time",
|
16
|
+
"FT" => "Full Time",
|
17
|
+
"PFI" => "Not Sure Yet",
|
18
|
+
"Interim Locum" => "Between Permanent Positions",
|
19
|
+
"Perm Only" => "Permanent"
|
20
20
|
}
|
21
21
|
|
22
22
|
ORDER_STATUS_MAP = {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
"Listing Qualification" => "pending",
|
24
|
+
"Pending" => "pending",
|
25
|
+
"On Hold" => "pending",
|
26
|
+
"Filled" => "pending",
|
27
|
+
"Open" => "live",
|
28
|
+
"Closed" => "pending"
|
29
29
|
}
|
30
30
|
|
31
31
|
SUBMITTAL_STAGE_MAP = {
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
32
|
+
"Pre-Submission" => "wait",
|
33
|
+
"Submittal" => "wait",
|
34
|
+
"Send Out" => "wait",
|
35
|
+
"On Hold" => "wait",
|
36
|
+
"Offer" => "wait",
|
37
|
+
"Applied Online" => "wait",
|
38
|
+
"Declined Online" => "declined",
|
39
|
+
"Withdraw" => "declined",
|
40
|
+
"Reject" => "rejected"
|
41
41
|
}
|
42
42
|
|
43
43
|
STATE_ABBREVIATIONS_MAP = {
|
@@ -86,26 +86,26 @@ module WolfCore
|
|
86
86
|
"Palau" => "PW",
|
87
87
|
"Pennsylvania" => "PA",
|
88
88
|
"Puerto Rico" => "PR",
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
89
|
+
"Rhode Island" => "RI",
|
90
|
+
"South Carolina" => "SC",
|
91
|
+
"South Dakota" => "SD",
|
92
|
+
"Tennessee" => "TN",
|
93
|
+
"Texas" => "TX",
|
94
|
+
"U.S. Virgin Islands" => "VI",
|
95
|
+
"Utah" => "UT",
|
96
|
+
"Vermont" => "VT",
|
97
|
+
"Virginia" => "VA",
|
98
|
+
"Washington" => "WA",
|
99
|
+
"West Virginia" => "WV",
|
100
|
+
"Wisconsin" => "WI",
|
101
|
+
"Wyoming" => "WY"
|
102
102
|
}
|
103
103
|
|
104
104
|
DISPLAY_PAY_RATE_UNIT_MAP = {
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
105
|
+
"hour" => "Hourly",
|
106
|
+
"day" => "Daily",
|
107
|
+
"week" => "Weekly",
|
108
|
+
"month" => "Monthly"
|
109
109
|
}
|
110
110
|
|
111
111
|
def map_provider_type_to_pricing_id(provider_type)
|
@@ -115,6 +115,7 @@ module WolfCore
|
|
115
115
|
|
116
116
|
def map_pricing_id_to_provider_type(pricing_id)
|
117
117
|
return nil if pricing_id.blank?
|
118
|
+
|
118
119
|
pricing_id = pricing_id.to_s
|
119
120
|
provider_type = PROVIDER_TYPE_MAPPING.invert[pricing_id]
|
120
121
|
provider_type || pricing_id
|
@@ -161,4 +162,4 @@ module WolfCore
|
|
161
162
|
end
|
162
163
|
end
|
163
164
|
end
|
164
|
-
end
|
165
|
+
end
|
@@ -4,19 +4,18 @@ module WolfCore
|
|
4
4
|
module Operations
|
5
5
|
def get_erecruit_access_token
|
6
6
|
response = safe_http_post(
|
7
|
-
url: ENV[
|
8
|
-
headers: {
|
7
|
+
url: ENV["ERECRUIT_AUTH_URL"],
|
8
|
+
headers: { "Content-Type" => "application/x-www-form-urlencoded" },
|
9
9
|
body: {
|
10
|
-
client_id: ENV[
|
11
|
-
client_secret: ENV[
|
12
|
-
grant_type: ENV[
|
10
|
+
client_id: ENV["ERECRUIT_AUTH_CLIENT_ID"],
|
11
|
+
client_secret: ENV["ERECRUIT_AUTH_CLIENT_SECRET"],
|
12
|
+
grant_type: ENV["ERECRUIT_AUTH_GRANT_TYPE"]
|
13
13
|
},
|
14
|
-
error_message:
|
14
|
+
error_message: "Unable to get erecruit token"
|
15
15
|
)
|
16
|
-
|
17
|
-
access_token
|
16
|
+
response.body["access_token"]
|
18
17
|
end
|
19
18
|
end
|
20
19
|
end
|
21
20
|
end
|
22
|
-
end
|
21
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module WolfCore # rubocop:disable Style/FrozenStringLiteralComment
|
2
|
+
module Burnett
|
3
|
+
module MatchOperations # rubocop:disable Style/Documentation
|
4
|
+
include WolfCore::HttpOperations
|
5
|
+
|
6
|
+
def create_match!(erecruit_token:, erecruit_platform_url:, position_id:, candidate_id:, error_message:)
|
7
|
+
response = safe_http_post(
|
8
|
+
headers: { "Authorization" => "Bearer #{erecruit_token}" },
|
9
|
+
url: "#{erecruit_platform_url}/",
|
10
|
+
query: { tenant: tenant },
|
11
|
+
error_message: error_message
|
12
|
+
)
|
13
|
+
nil if response.code == 200
|
14
|
+
end
|
15
|
+
|
16
|
+
def create_match(erecruit_token:, erecruit_platform_url:, position_id:, candidate_id:)
|
17
|
+
response = http_get(
|
18
|
+
headers: { "Authorization" => "Bearer #{erecruit_token}" },
|
19
|
+
url: "#{erecruit_platform_url}/",
|
20
|
+
query: { tenant: tenant }
|
21
|
+
)
|
22
|
+
nil if response.code == 200
|
23
|
+
end
|
24
|
+
|
25
|
+
def update_match!(erecruit_token:, erecruit_platform_url:, position_id:, candidate_id:, error_message:)
|
26
|
+
response = safe_http_post(
|
27
|
+
headers: { "Authorization" => "Bearer #{erecruit_token}" },
|
28
|
+
url: "#{erecruit_platform_url}/",
|
29
|
+
query: { tenant: tenant },
|
30
|
+
error_message: error_message
|
31
|
+
)
|
32
|
+
nil if response.code == 200
|
33
|
+
end
|
34
|
+
|
35
|
+
def update_match(erecruit_token:, erecruit_platform_url:, position_id:, candidate_id:)
|
36
|
+
response = http_get(
|
37
|
+
headers: { "Authorization" => "Bearer #{erecruit_token}" },
|
38
|
+
url: "#{erecruit_platform_url}/",
|
39
|
+
query: { tenant: tenant }
|
40
|
+
)
|
41
|
+
nil if response.code == 200
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module WolfCore
|
2
|
+
module Burnett
|
3
|
+
module PositionsOperations
|
4
|
+
include WolfCore::HttpOperations
|
5
|
+
|
6
|
+
def create_position!(erecruit_token:, erecruit_platform_url:, position_id:, candidate_id:, error_message:)
|
7
|
+
response = safe_http_post(
|
8
|
+
headers: { "Authorization" => "Bearer #{erecruit_token}" },
|
9
|
+
url: "#{erecruit_platform_url}/",
|
10
|
+
query: { tenant: tenant },
|
11
|
+
error_message: error_message
|
12
|
+
)
|
13
|
+
nil if response.code == 200
|
14
|
+
end
|
15
|
+
|
16
|
+
def create_position(erecruit_token:, erecruit_platform_url:, position_id:, candidate_id:)
|
17
|
+
response = http_get(
|
18
|
+
headers: { "Authorization" => "Bearer #{erecruit_token}" },
|
19
|
+
url: "#{erecruit_platform_url}/",
|
20
|
+
query: { tenant: tenant }
|
21
|
+
)
|
22
|
+
nil if response.code == 200
|
23
|
+
end
|
24
|
+
|
25
|
+
def update_position!(erecruit_token:, erecruit_platform_url:, position_id:, candidate_id:, error_message:)
|
26
|
+
response = safe_http_post(
|
27
|
+
headers: { "Authorization" => "Bearer #{erecruit_token}" },
|
28
|
+
url: "#{erecruit_platform_url}/",
|
29
|
+
query: { tenant: tenant },
|
30
|
+
error_message: error_message
|
31
|
+
)
|
32
|
+
nil if response.code == 200
|
33
|
+
end
|
34
|
+
|
35
|
+
def update_position(erecruit_token:, erecruit_platform_url:, position_id:, candidate_id:)
|
36
|
+
response = http_get(
|
37
|
+
headers: { "Authorization" => "Bearer #{erecruit_token}" },
|
38
|
+
url: "#{erecruit_platform_url}/",
|
39
|
+
query: { tenant: tenant }
|
40
|
+
)
|
41
|
+
nil if response.code == 200
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -5,39 +5,40 @@ module WolfCore
|
|
5
5
|
|
6
6
|
def fetch_order!(wolf_token:, order_id:, tenant:, wolf_platform_url:, error_message:)
|
7
7
|
response = safe_http_get(
|
8
|
-
headers: {
|
8
|
+
headers: { "Authorization" => "Bearer #{wolf_token}" },
|
9
9
|
url: "#{wolf_platform_url}/api/v2/orders/#{order_id}",
|
10
10
|
query: { tenant: tenant },
|
11
|
-
error_message: error_message
|
11
|
+
error_message: error_message
|
12
12
|
)
|
13
13
|
response_body = response.body
|
14
|
-
response_body.dig(
|
14
|
+
response_body.dig("data", "table", "order")
|
15
15
|
end
|
16
16
|
|
17
17
|
def fetch_order(wolf_token:, order_id:, tenant:, wolf_platform_url:)
|
18
18
|
response = http_get(
|
19
|
-
headers: {
|
19
|
+
headers: { "Authorization" => "Bearer #{wolf_token}" },
|
20
20
|
url: "#{wolf_platform_url}/api/v2/orders/#{order_id}",
|
21
|
-
query: { tenant: tenant }
|
21
|
+
query: { tenant: tenant }
|
22
22
|
)
|
23
23
|
response_body = response.body
|
24
24
|
return unless response_body.instance_of?(Hash)
|
25
|
-
|
25
|
+
|
26
|
+
response_body.dig("data", "table", "order")
|
26
27
|
end
|
27
28
|
|
28
29
|
def create_order!(wolf_token:, order:, tenant:, wolf_platform_url:, error_message:)
|
29
30
|
safe_http_post(
|
30
|
-
headers: {
|
31
|
+
headers: { "Authorization" => "Bearer #{wolf_token}" },
|
31
32
|
url: "#{wolf_platform_url}/api/v2/orders",
|
32
33
|
query: { tenant: tenant },
|
33
34
|
body: order,
|
34
|
-
error_message: error_message
|
35
|
+
error_message: error_message
|
35
36
|
)
|
36
37
|
end
|
37
38
|
|
38
39
|
def create_order(wolf_token:, order:, tenant:, wolf_platform_url:)
|
39
40
|
http_post(
|
40
|
-
headers: {
|
41
|
+
headers: { "Authorization" => "Bearer #{wolf_token}" },
|
41
42
|
url: "#{wolf_platform_url}/api/v2/orders",
|
42
43
|
query: { tenant: tenant },
|
43
44
|
body: order
|
@@ -45,4 +46,4 @@ module WolfCore
|
|
45
46
|
end
|
46
47
|
end
|
47
48
|
end
|
48
|
-
end
|
49
|
+
end
|
@@ -1,35 +1,33 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative "logging_utils" # rubocop:disable Style/FrozenStringLiteralComment
|
2
2
|
|
3
3
|
module WolfCore
|
4
|
-
module FileUtils
|
4
|
+
module FileUtils # rubocop:disable Style/Documentation
|
5
5
|
extend WolfCore::LoggingUtils
|
6
6
|
|
7
7
|
module_function
|
8
8
|
|
9
9
|
def require_relative_folder(*folders)
|
10
|
-
folder_files = File.join(*folders,
|
10
|
+
folder_files = File.join(*folders, "**", "*.rb")
|
11
11
|
files_to_require = Dir[folder_files].sort
|
12
12
|
# log_object files_to_require, title: 'Files to require are'
|
13
13
|
safe_require(files_to_require)
|
14
14
|
end
|
15
15
|
|
16
|
-
def safe_require(missing_files)
|
16
|
+
def safe_require(missing_files) # rubocop:disable Metrics/MethodLength
|
17
17
|
error_counter = {}
|
18
18
|
while missing_files.any?
|
19
19
|
files_to_require = missing_files
|
20
20
|
missing_files = []
|
21
21
|
files_to_require.each do |file|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
log_object e, title: 'Error is'
|
30
|
-
end
|
31
|
-
missing_files << file if error_counter[file] < 15
|
22
|
+
# log_object "Requiring file: #{file}"
|
23
|
+
require_relative file
|
24
|
+
rescue NameError => e
|
25
|
+
error_counter[file] = error_counter[file].to_i + 1
|
26
|
+
if error_counter[file] >= 10
|
27
|
+
log_object "Error requiring file: #{file}"
|
28
|
+
log_object e, title: "Error is"
|
32
29
|
end
|
30
|
+
missing_files << file if error_counter[file] < 15
|
33
31
|
end
|
34
32
|
end
|
35
33
|
end
|
@@ -45,39 +43,45 @@ module WolfCore
|
|
45
43
|
log_object "File Deleting Process Finished! (#{files_to_delete.size} files deleted)"
|
46
44
|
end
|
47
45
|
|
48
|
-
def encode_file_to_base64_from_url(url)
|
49
|
-
response = download_file_from_url(url)
|
46
|
+
def encode_file_to_base64_from_url(url) # rubocop:disable Metrics/MethodLength
|
47
|
+
uri, response = download_file_from_url(url).values_at(:uri, :response)
|
50
48
|
bytes = response.body
|
51
49
|
|
52
50
|
encoded_file = Base64.strict_encode64(bytes)
|
53
51
|
|
54
|
-
|
55
|
-
|
56
|
-
filename
|
57
|
-
|
58
|
-
match ? match[1] : File.basename(uri.path)
|
59
|
-
else
|
60
|
-
File.basename(uri.path)
|
61
|
-
end
|
62
|
-
log_object filename, title: 'filename is'
|
63
|
-
return { filename: filename, encoded_file: encoded_file }
|
64
|
-
rescue => e
|
52
|
+
filename = filename_from_response(response, uri)
|
53
|
+
log_object filename, title: "filename is"
|
54
|
+
{ filename: filename, encoded_file: encoded_file }
|
55
|
+
rescue StandardError => e
|
65
56
|
raise_service_error({
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
71
|
-
|
72
|
-
def bytes_from_url(url)
|
73
|
-
download_file_from_url(url).body
|
57
|
+
message: "Failed to encode file url",
|
58
|
+
encode_file_error: { message: e.message, backtrace: e.backtrace },
|
59
|
+
url: url
|
60
|
+
})
|
74
61
|
end
|
75
62
|
|
76
63
|
def download_file_from_url(url)
|
77
64
|
uri = URI.parse(url)
|
78
65
|
response = Net::HTTP.get_response(uri)
|
79
|
-
raise_service_error({ message:
|
80
|
-
response
|
66
|
+
raise_service_error({ message: "Failed to download file", url: url }) unless response.is_a?(Net::HTTPSuccess)
|
67
|
+
{ uri: uri, response: response }
|
68
|
+
end
|
69
|
+
|
70
|
+
def bytes_from_url(url)
|
71
|
+
uri, response = download_file_from_url(url).values_at(:uri, :response)
|
72
|
+
bytes = response.body
|
73
|
+
filename = filename_from_response(response, uri)
|
74
|
+
{ bytes: bytes, filename: filename }
|
75
|
+
end
|
76
|
+
|
77
|
+
def filename_from_response(response, uri)
|
78
|
+
content_disposition = response["content-disposition"]
|
79
|
+
if content_disposition
|
80
|
+
match = content_disposition.match(/filename="?([^"]+)"?/)
|
81
|
+
match ? match[1] : File.basename(uri.path)
|
82
|
+
else
|
83
|
+
File.basename(uri.path)
|
84
|
+
end
|
81
85
|
end
|
82
86
|
end
|
83
87
|
end
|
data/lib/wolf_core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wolf_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javier Roncallo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -94,6 +94,8 @@ files:
|
|
94
94
|
- lib/wolf_core/application/barton/routing.rb
|
95
95
|
- lib/wolf_core/application/burnett/auth/auth_operations.rb
|
96
96
|
- lib/wolf_core/application/burnett/data_transformation/mappings.rb
|
97
|
+
- lib/wolf_core/application/burnett/match_operations/match_operattions.rb
|
98
|
+
- lib/wolf_core/application/burnett/positions_operations/positions_operations.rb
|
97
99
|
- lib/wolf_core/application/exception_operations.rb
|
98
100
|
- lib/wolf_core/application/integrations/change_detection.rb
|
99
101
|
- lib/wolf_core/application/integrations/jobseeker_api_operations.rb
|