wolf_core 1.0.4 → 1.0.6
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/routing.rb +2 -1
- data/lib/wolf_core/application/integrations/jobseeker_api_operations.rb +17 -16
- data/lib/wolf_core/application/integrations/routing_operations.rb +2 -1
- data/lib/wolf_core/utils/file_utils.rb +9 -5
- data/lib/wolf_core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c7897679b1a29f38652e90e2023e12a0959759bbff7142d2a9e8da65c16715f
|
4
|
+
data.tar.gz: 46753cc5d2f6896bd44a0e435ebb172d378f221cf0bdd60808356d9ef3f45391
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01043ab0fb6d14d87613bf8f85dd79aa7c33320790aaab8205d80418088893e7996bb1c687cea965d3580c979f1139bcb783cfcbf68aafca7c3738a28d4066d5
|
7
|
+
data.tar.gz: 1000de72032d73ba9f9032d1db2a23a1e8a8745398540e53236ea1d10402d5a9f0ce39a6cce2008054684fce0e845e291a3a575072b2dd04fc7608244b1275ff
|
@@ -30,7 +30,8 @@ module WolfCore
|
|
30
30
|
|
31
31
|
def route_event_request(path:, body:)
|
32
32
|
environment = ENV['ENVIRONMENT']
|
33
|
-
|
33
|
+
deployable_envs = ['production', 'staging']
|
34
|
+
if deployable_envs.include?(environment)
|
34
35
|
function_name = PATH_TO_FUNCTION_NAME_MAPPING[path]
|
35
36
|
raise_service_error("Function name not found for path: #{path}") if function_name.blank?
|
36
37
|
|
@@ -5,39 +5,40 @@ module WolfCore
|
|
5
5
|
|
6
6
|
def fetch_jobseeker!(wolf_token:, jobseeker_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/jobseekers/#{jobseeker_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", "jobseeker")
|
15
15
|
end
|
16
16
|
|
17
17
|
def fetch_jobseeker(wolf_token:, jobseeker_id:, tenant:, wolf_platform_url:)
|
18
|
-
response =
|
19
|
-
headers: {
|
18
|
+
response = parsed_http_get(
|
19
|
+
headers: { "Authorization" => "Bearer #{wolf_token}" },
|
20
20
|
url: "#{wolf_platform_url}/api/v2/jobseekers/#{jobseeker_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", "jobseeker")
|
26
27
|
end
|
27
28
|
|
28
29
|
def create_jobseeker!(wolf_token:, jobseeker:, tenant:, wolf_platform_url:, error_message:)
|
29
30
|
safe_http_post(
|
30
|
-
headers: {
|
31
|
+
headers: { "Authorization" => "Bearer #{wolf_token}" },
|
31
32
|
query: { tenant: tenant },
|
32
33
|
url: "#{wolf_platform_url}/api/v2/jobseekers",
|
33
34
|
body: jobseeker,
|
34
|
-
error_message: error_message
|
35
|
+
error_message: error_message
|
35
36
|
)
|
36
37
|
end
|
37
38
|
|
38
39
|
def create_jobseeker(wolf_token:, jobseeker:, tenant:, wolf_platform_url:)
|
39
|
-
|
40
|
-
headers: {
|
40
|
+
parsed_http_post(
|
41
|
+
headers: { "Authorization" => "Bearer #{wolf_token}" },
|
41
42
|
query: { tenant: tenant },
|
42
43
|
url: "#{wolf_platform_url}/api/v2/jobseekers",
|
43
44
|
body: jobseeker
|
@@ -46,17 +47,17 @@ module WolfCore
|
|
46
47
|
|
47
48
|
def update_jobseeker!(wolf_token:, jobseeker:, tenant:, wolf_platform_url:, error_message:, jobseeker_id:)
|
48
49
|
safe_http_put(
|
49
|
-
headers: {
|
50
|
+
headers: { "Authorization" => "Bearer #{wolf_token}" },
|
50
51
|
query: { tenant: tenant },
|
51
52
|
url: "#{wolf_platform_url}/api/v2/jobseekers/#{jobseeker_id}",
|
52
53
|
body: jobseeker,
|
53
|
-
error_message: error_message
|
54
|
+
error_message: error_message
|
54
55
|
)
|
55
56
|
end
|
56
57
|
|
57
58
|
def update_jobseeker(wolf_token:, jobseeker:, tenant:, wolf_platform_url:, jobseeker_id:)
|
58
|
-
|
59
|
-
headers: {
|
59
|
+
parsed_http_put(
|
60
|
+
headers: { "Authorization" => "Bearer #{wolf_token}" },
|
60
61
|
query: { tenant: tenant },
|
61
62
|
url: "#{wolf_platform_url}/api/v2/jobseekers/#{jobseeker_id}",
|
62
63
|
body: jobseeker
|
@@ -64,4 +65,4 @@ module WolfCore
|
|
64
65
|
end
|
65
66
|
end
|
66
67
|
end
|
67
|
-
end
|
68
|
+
end
|
@@ -7,7 +7,8 @@ module WolfCore
|
|
7
7
|
|
8
8
|
def route_event_request(path:, body:)
|
9
9
|
environment = ENV['ENVIRONMENT']
|
10
|
-
|
10
|
+
deployable_envs = ['production', 'staging']
|
11
|
+
if deployable_envs.include?(environment)
|
11
12
|
function_name = PATH_TO_FUNCTION_NAME_MAPPING[path]
|
12
13
|
raise_service_error("Function name not found for path: #{path}") if function_name.blank?
|
13
14
|
|
@@ -46,11 +46,8 @@ module WolfCore
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def encode_file_to_base64_from_url(url)
|
49
|
-
|
50
|
-
|
51
|
-
raise_service_error({ message: 'Failed to download file', url: url }) unless response.is_a?(Net::HTTPSuccess)
|
52
|
-
|
53
|
-
encoded_file = Base64.strict_encode64(response.body)
|
49
|
+
bytes = bytes_from_url(url)
|
50
|
+
encoded_file = Base64.strict_encode64(bytes)
|
54
51
|
|
55
52
|
content_disposition = response['content-disposition']
|
56
53
|
|
@@ -69,5 +66,12 @@ module WolfCore
|
|
69
66
|
url: url,
|
70
67
|
})
|
71
68
|
end
|
69
|
+
|
70
|
+
def bytes_from_url(url)
|
71
|
+
uri = URI.parse(url)
|
72
|
+
response = Net::HTTP.get_response(uri)
|
73
|
+
raise_service_error({ message: 'Failed to download file', url: url }) unless response.is_a?(Net::HTTPSuccess)
|
74
|
+
response.body
|
75
|
+
end
|
72
76
|
end
|
73
77
|
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.6
|
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-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|