wolf_core 0.1.92 → 0.1.94

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99d40f26013a94735f4da9b17a774b7b8338d57c7b684f3f84b0bbb22bb03403
4
- data.tar.gz: 8eced06644e17124505391fa14fb66ba337f3cd5bff727d2be85663e7a18fd3a
3
+ metadata.gz: db97beec0b08abbe43e33486e9b35e14b2c28f20ce9bf74112aa8864d42cfca2
4
+ data.tar.gz: 71b868309e2b40a9ece2b86967289e2ec77f785755b78785d90c2d5e74b4896c
5
5
  SHA512:
6
- metadata.gz: e6cf194726bd84f9409d13df4ee2eb813bd0861f46dd7aa3919f7d1e940b1a3d6eb3ae1ae0eec8df890584f2fb341b243f96fec8c1a03768406f3e96e92c3dbe
7
- data.tar.gz: 1bf30ee6e4afe23eaaad68b96f3736faa252782910e0c393c54717a4d93585b0fa13bd10d4d0ad6d2d1aee82c004daa049361d9c6509be1a0a12dd95a55fdd33
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
@@ -13,6 +13,7 @@ module WolfCore
13
13
  [payload.dig('attributes', 'custom_requirement_id').to_s]
14
14
  end
15
15
  end
16
+ changed_custom_requirement_ids
16
17
  end
17
18
  end
18
19
  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 ||= 'safe_http_get response is'
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WolfCore
4
- VERSION = "0.1.92"
4
+ VERSION = "0.1.94"
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.92
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-09-23 00:00:00.000000000 Z
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