wolf_core 0.1.99 → 0.2.0

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: 8d2f944616b25d134e6589f0dbfcb8fd909a27dfb881cfd78eb9b76e264f900c
4
- data.tar.gz: d6644bfec1886500d96906243f1429e6d28145fc19dd3e419826309122b243c5
3
+ metadata.gz: 72dc3ed5c7b6520f4baa43f27e45a304ac21b7b68d5167beeed386fd088ee2e9
4
+ data.tar.gz: 87fa7ece4f89b46d81f7ca97c0e1470fa7f3ceff03de7725d5e3bc31b7b09d2e
5
5
  SHA512:
6
- metadata.gz: afef89f59ffb52ca6dee4b5a9a5a8baf1d281ac609702c472f7e048de8d57472439b4c82fe5800aec86f1e7790b6ad9fa0c800adfb507482aad1bc49cbefd447
7
- data.tar.gz: f0f4f40b589361933bf7a7f2f5df41f7bc4e6f1ade3f3872d10b6fa10bf508b8d0fc989e2892bd1454f6345c8dc04b4e5bf40fb6fbba8d3e4ed63d39db4456d4
6
+ metadata.gz: 570ad8e75a0c36bab766171acc847ecf0cf73e668890c425da83ed89bda51ca2890df07a9fb3a97dab425ded238287abfd239c4e510726ad44826bdd3be7b102
7
+ data.tar.gz: ae521dc9bc683c8cbc960abaf0b23037b5a804e2bcbeabb18b088b6fd7d36b345a679d81158152173a4d739effcbc45f4cae1f5ef0571996a1916fa3bebf9b06
@@ -0,0 +1,27 @@
1
+ module WolfCore
2
+ module Burnett
3
+ module Mappings
4
+ JOB_TYPE_MAPPING = {
5
+ '144' => '26',
6
+ '145' => '30',
7
+ '153' => '24',
8
+ '152' => '28',
9
+ '155' => '12',
10
+ '156' => '22',
11
+ '150' => '27',
12
+ '148' => '31',
13
+ '158' => '25',
14
+ '151' => '29',
15
+ '163' => '23',
16
+ }
17
+
18
+ def map_job_type(value)
19
+ JOB_TYPE_MAPPING[value] || value
20
+ end
21
+
22
+ def revert_map_job_type(value)
23
+ JOB_TYPE_MAPPING.invert[value] || value
24
+ end
25
+ end
26
+ end
27
+ end
@@ -3,28 +3,44 @@ module WolfCore
3
3
  module JobseekerApiOperations
4
4
  include WolfCore::HttpOperations
5
5
 
6
- def fetch_jobseeker(wolf_token:, jobseeker_id:, tenant:)
6
+ def fetch_jobseeker!(wolf_token:, jobseeker_id:, tenant:, wolf_platform_url:, error_message:)
7
7
  response = safe_http_get(
8
8
  headers: { 'Authorization' => "Bearer #{wolf_token}" },
9
- url: "#{ENV['WOLF_PLATFORM_URL']}/api/v2/jobseekers/#{jobseeker_id}",
9
+ url: "#{wolf_platform_url}/api/v2/jobseekers/#{jobseeker_id}",
10
10
  query: { tenant: tenant },
11
- error_message: 'Failed to fetch jobseeker',
11
+ error_message: error_message,
12
12
  )
13
13
  response_body = response.body
14
14
  response_body.dig('data', 'table', 'jobseeker')
15
15
  end
16
16
 
17
- def create_jobseeker(wolf_token:, jobseeker:, tenant:)
18
- response = http_post(
17
+ def fetch_jobseeker(wolf_token:, jobseeker_id:, tenant:, wolf_platform_url:)
18
+ response = http_get(
19
19
  headers: { 'Authorization' => "Bearer #{wolf_token}" },
20
+ url: "#{wolf_platform_url}/api/v2/jobseekers/#{jobseeker_id}",
20
21
  query: { tenant: tenant },
21
- url: "#{ENV['WOLF_PLATFORM_URL']}/api/v2/jobseekers",
22
- body: jobseeker
23
22
  )
24
- log_object response, title: 'create jobseeker response is'
25
- validate_http_response(
26
- response: response,
27
- message: 'Can not create jobseeker'
23
+ response_body = response.body
24
+ return unless response_body.instance_of?(Hash)
25
+ response_body.dig('data', 'table', 'jobseeker')
26
+ end
27
+
28
+ def create_jobseeker!(wolf_token:, jobseeker:, tenant:, wolf_platform_url:, error_message:)
29
+ safe_http_post(
30
+ headers: { 'Authorization' => "Bearer #{wolf_token}" },
31
+ query: { tenant: tenant },
32
+ url: "#{wolf_platform_url}/api/v2/jobseekers",
33
+ body: jobseeker,
34
+ error_message: error_message,
35
+ )
36
+ end
37
+
38
+ def create_jobseeker(wolf_token:, jobseeker:, tenant:, wolf_platform_url:)
39
+ http_post(
40
+ headers: { 'Authorization' => "Bearer #{wolf_token}" },
41
+ query: { tenant: tenant },
42
+ url: "#{wolf_platform_url}/api/v2/jobseekers",
43
+ body: jobseeker
28
44
  )
29
45
  end
30
46
  end
@@ -0,0 +1,48 @@
1
+ module WolfCore
2
+ module Integrations
3
+ module OrdersApiOperations
4
+ include WolfCore::HttpOperations
5
+
6
+ def fetch_order!(wolf_token:, order_id:, tenant:, wolf_platform_url:, error_message:)
7
+ response = safe_http_get(
8
+ headers: { 'Authorization' => "Bearer #{wolf_token}" },
9
+ url: "#{wolf_platform_url}/api/v2/orders/#{order_id}",
10
+ query: { tenant: tenant },
11
+ error_message: error_message,
12
+ )
13
+ response_body = response.body
14
+ response_body.dig('data', 'table', 'order')
15
+ end
16
+
17
+ def fetch_order(wolf_token:, order_id:, tenant:, wolf_platform_url:)
18
+ response = http_get(
19
+ headers: { 'Authorization' => "Bearer #{wolf_token}" },
20
+ url: "#{wolf_platform_url}/api/v2/orders/#{order_id}",
21
+ query: { tenant: tenant },
22
+ )
23
+ response_body = response.body
24
+ return unless response_body.instance_of?(Hash)
25
+ response_body.dig('data', 'table', 'order')
26
+ end
27
+
28
+ def create_order!(wolf_token:, order:, tenant:, wolf_platform_url:, error_message:)
29
+ safe_http_post(
30
+ headers: { 'Authorization' => "Bearer #{wolf_token}" },
31
+ url: "#{wolf_platform_url}/api/v2/orders",
32
+ query: { tenant: tenant },
33
+ body: order,
34
+ error_message: error_message,
35
+ )
36
+ end
37
+
38
+ def create_order(wolf_token:, order:, tenant:, wolf_platform_url:)
39
+ http_post(
40
+ headers: { 'Authorization' => "Bearer #{wolf_token}" },
41
+ url: "#{wolf_platform_url}/api/v2/orders",
42
+ query: { tenant: tenant },
43
+ body: order
44
+ )
45
+ end
46
+ end
47
+ end
48
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WolfCore
4
- VERSION = "0.1.99"
4
+ VERSION = "0.2.0"
5
5
  end
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: 0.1.99
4
+ version: 0.2.0
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-08 00:00:00.000000000 Z
11
+ date: 2024-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -93,9 +93,11 @@ files:
93
93
  - lib/wolf_core/application/barton/parsing.rb
94
94
  - lib/wolf_core/application/barton/routing.rb
95
95
  - lib/wolf_core/application/burnett/auth/auth_operations.rb
96
+ - lib/wolf_core/application/burnett/data_transformation/mappings.rb
96
97
  - lib/wolf_core/application/exception_operations.rb
97
98
  - lib/wolf_core/application/integrations/change_detection.rb
98
99
  - lib/wolf_core/application/integrations/jobseeker_api_operations.rb
100
+ - lib/wolf_core/application/integrations/orders_api_operations.rb
99
101
  - lib/wolf_core/application/integrations/routing_operations.rb
100
102
  - lib/wolf_core/application/integrations/webhooks_operations.rb
101
103
  - lib/wolf_core/application/salesforce_oauth_service.rb