wolf_core 0.1.93 → 0.1.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/wolf_core/application/burnett/auth/auth_operations.rb +22 -0
- data/lib/wolf_core/application/integrations/routing_operations.rb +21 -0
- data/lib/wolf_core/application/integrations/webhooks_operations.rb +43 -0
- data/lib/wolf_core/infrastructure/http_operations.rb +1 -2
- data/lib/wolf_core/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e19a6b8b85db964078cb573c3c0a9a70d259ac868b7cf13340646be965d74dde
|
4
|
+
data.tar.gz: 9ed9bf169bfd6e3d1b98ae11d3338f5aaa5f1546338b10e9a8fbe2e1aa5b8f66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59d2649c23a0471dfcf230d4d4ac71206fee9b389d2e30a75387ae3784bf0b47b48f37cd92c810ce5e41b5c68201c34b8220c243a33494ee579d058a0fc2f849
|
7
|
+
data.tar.gz: 72f602f75d91972f8ecfcc0d1d21c77f70dcb84a659fddda7f2d2f8f9bc17121fe772e2b659eadb1f35986bd95c2927a134b93fdae48337a0af8368caf5fb573
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module WolfCore
|
2
|
+
module Burnett
|
3
|
+
module Auth
|
4
|
+
module Operations
|
5
|
+
def get_erecruit_access_token
|
6
|
+
response = safe_http_post(
|
7
|
+
url: ENV['ERECRUIT_AUTH_URL'],
|
8
|
+
headers: { 'Content-Type' => 'application/x-www-form-urlencoded' },
|
9
|
+
body: {
|
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
|
+
},
|
14
|
+
error_message: 'Unable to get erecruit token'
|
15
|
+
)
|
16
|
+
access_token = response.body['access_token']
|
17
|
+
access_token
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module WolfCore
|
2
|
+
module Integrations
|
3
|
+
module RoutingOperations
|
4
|
+
def route_event_request(path:, body:)
|
5
|
+
environment = ENV['ENVIRONMENT']
|
6
|
+
if environment == 'production'
|
7
|
+
function_name = PATH_TO_FUNCTION_NAME_MAPPING[path]
|
8
|
+
raise_service_error("Function name not found for path: #{path}") if function_name.blank?
|
9
|
+
|
10
|
+
invoke_lambda(
|
11
|
+
function_name: function_name,
|
12
|
+
payload: body,
|
13
|
+
)
|
14
|
+
else
|
15
|
+
domain_url = ENV['CURRENT_SAM_URL']
|
16
|
+
async_http_post(url: "#{domain_url}/#{path}", body: body)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module WolfCore
|
2
|
+
module Integrations
|
3
|
+
module WebhooksOperations
|
4
|
+
def get_payload(event_type:, params:)
|
5
|
+
return if event_type == 'SubscriptionConfirmation'
|
6
|
+
params = JSON.parse(params['Message'] || '{}')
|
7
|
+
params['payload'] = JSON.parse(params['payload'] || '{}')
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_event_type(params:)
|
11
|
+
params['Type']
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_event_name(params:)
|
15
|
+
message = JSON.parse(params['Message'] || {})
|
16
|
+
message['event_name']
|
17
|
+
end
|
18
|
+
|
19
|
+
def validate_user(event_type:, params:)
|
20
|
+
return if event_type == 'SubscriptionConfirmation'
|
21
|
+
|
22
|
+
user_id = params.dig('invoker', 'user_id').to_s
|
23
|
+
return unless user_id == ENV['WOLF_ADMIN_ID'].to_s
|
24
|
+
|
25
|
+
raise_service_error("Ignoring event from user id #{user_id}")
|
26
|
+
end
|
27
|
+
|
28
|
+
def subscription_confirmation_request(url:)
|
29
|
+
response = safe_http_get(
|
30
|
+
url: url,
|
31
|
+
error_message: "Can not confirm subscription",
|
32
|
+
)
|
33
|
+
response
|
34
|
+
end
|
35
|
+
|
36
|
+
def build_body_from_params(params:, id_key:)
|
37
|
+
params.slice(
|
38
|
+
'event_name', 'payload'
|
39
|
+
).merge({ id_key => params['object_id'] })
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -17,8 +17,7 @@ module WolfCore
|
|
17
17
|
response = http_get(url: url, headers: headers, query: query)
|
18
18
|
response = parse_http_response(response)
|
19
19
|
|
20
|
-
title
|
21
|
-
log_object response, title: title
|
20
|
+
log_object response, title: title if title.present?
|
22
21
|
|
23
22
|
error_message ||= 'Error on safe_http_get'
|
24
23
|
validate_http_response(response: response, message: error_message)
|
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: 0.1.
|
4
|
+
version: 0.1.95
|
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-
|
11
|
+
date: 2024-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -92,8 +92,11 @@ files:
|
|
92
92
|
- lib/wolf_core/application/barton/mappings.rb
|
93
93
|
- lib/wolf_core/application/barton/parsing.rb
|
94
94
|
- lib/wolf_core/application/barton/routing.rb
|
95
|
+
- lib/wolf_core/application/burnett/auth/auth_operations.rb
|
95
96
|
- lib/wolf_core/application/exception_operations.rb
|
96
97
|
- lib/wolf_core/application/integrations/change_detection.rb
|
98
|
+
- lib/wolf_core/application/integrations/routing_operations.rb
|
99
|
+
- lib/wolf_core/application/integrations/webhooks_operations.rb
|
97
100
|
- lib/wolf_core/application/salesforce_oauth_service.rb
|
98
101
|
- lib/wolf_core/application/service_exception.rb
|
99
102
|
- lib/wolf_core/infrastructure/fkm_operations.rb
|
@@ -134,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
137
|
- !ruby/object:Gem::Version
|
135
138
|
version: '0'
|
136
139
|
requirements: []
|
137
|
-
rubygems_version: 3.5.
|
140
|
+
rubygems_version: 3.5.16
|
138
141
|
signing_key:
|
139
142
|
specification_version: 4
|
140
143
|
summary: Repository to store shared code among Ruby projects.
|