wolf_core 0.1.93 → 0.1.94
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/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 +34 -0
- data/lib/wolf_core/infrastructure/http_operations.rb +1 -2
- data/lib/wolf_core/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db97beec0b08abbe43e33486e9b35e14b2c28f20ce9bf74112aa8864d42cfca2
|
4
|
+
data.tar.gz: 71b868309e2b40a9ece2b86967289e2ec77f785755b78785d90c2d5e74b4896c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a96822cc2e9538cddbdf5afdbe4f89c3e647969e7218d89e91240a33e2899aac98fa774fcec0ebad61e15f307faf47ebc00bfae2e2e8ae2e70bae470b1c96f2b
|
7
|
+
data.tar.gz: 94717e8ceb7dc74c5b8e337eb4d15fe99aa74bf97696765f83a6c578f66956d9d2886398c1cedfea7107c7d34a84fb010e2b979795e5eea5c2d8c5fceb3ca8d0
|
@@ -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,34 @@
|
|
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 validate_user(event_type:, params:)
|
11
|
+
return if event_type == 'SubscriptionConfirmation'
|
12
|
+
|
13
|
+
user_id = params.dig('invoker', 'user_id').to_s
|
14
|
+
return unless user_id == ENV['WOLF_ADMIN_ID'].to_s
|
15
|
+
|
16
|
+
raise_service_error("Ignoring event from user id #{user_id}")
|
17
|
+
end
|
18
|
+
|
19
|
+
def subscription_confirmation_request(url:)
|
20
|
+
response = safe_http_get(
|
21
|
+
url: url,
|
22
|
+
error_message: "Can not confirm subscription",
|
23
|
+
)
|
24
|
+
response
|
25
|
+
end
|
26
|
+
|
27
|
+
def build_body_from_params(params:, id_key:)
|
28
|
+
params.slice(
|
29
|
+
'event_name', 'payload'
|
30
|
+
).merge({ id_key => params['object_id'] })
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
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.94
|
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-03 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
|