wolf_core 0.1.27 → 0.1.29

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: 3d51ec182318cf97c54c92a3800d854adee6d727559b753279adedb925bdd49c
4
- data.tar.gz: 9ffe2f1c4a402d454ba3c9b547bf731d6e66ebf19ac4ece66e43c1f46856148e
3
+ metadata.gz: 57aa9bfd33652940c175b75d42f9d9cb48d1da5215f3f527643ea44748a7b34f
4
+ data.tar.gz: 7a0a439e84012da04ef0b8ea94d5282a0ecd47b4444e7c71497c16a951c3900e
5
5
  SHA512:
6
- metadata.gz: b7bac9f5e39e034f7313f648541898c2c3bd4f5e04dd9a11a46ba3c8ffdc5e4ed3a4bdce58ccc0e08a96b39118648f62f90d76e19148cfb57b4e699beed01fa0
7
- data.tar.gz: 95ef614f875da89ec82f3cc21f3c73266f504f6734762c1d96162d6885b2c1c036264e84860e5abe56db1c98466d9f287c75330d11c879a3181d66c074a325f5
6
+ metadata.gz: 7e0c02cb302dfb785c98b6f7c856578a6a9854e997b76df7cb7705882de738de06130bad46a00280ec752c6946766bcc9583b2a644d3b37c255a5f79e9825ded
7
+ data.tar.gz: d4547671e07bf6ddc59d2ad6f10e080db5882194f901cfea2639d28929d994b2594f0a633d46e9e48e4bcee4fa22d0d519c84ffc0317648e77bb5ccf51e5c0b6
@@ -40,11 +40,6 @@ module WolfCore
40
40
  return permitted
41
41
  end
42
42
 
43
- def route_event_request(path:, body:)
44
- domain_url = ENV['CURRENT_SAM_URL']
45
- async_http_post(url: "#{domain_url}/#{path}", body: body)
46
- end
47
-
48
43
  def get_salesforce_access_token
49
44
  result = WolfCore::SalesforceOauthService.new.call
50
45
  raise_failed_result(result)
@@ -7,6 +7,7 @@ module WolfCore
7
7
  'PA' => ENV['PA_PRICING_ID'],
8
8
  'DMD' => ENV['DMD_PRICING_ID'],
9
9
  'NP' => ENV['NP_PRICING_ID'],
10
+ 'DDS' => ENV['DDS_PRICING_ID'],
10
11
  }
11
12
 
12
13
  LOCUM_AVAILABILITY_MAP = {
@@ -0,0 +1,28 @@
1
+ module WolfCore
2
+ module Barton
3
+ module Routing
4
+ include WolfCore::HttpOperations
5
+ include WolfCore::LambdaFunctionOperations
6
+
7
+ PATH_TO_FUNCTION_NAME_MAPPING = {
8
+ 'barton/import/jobseeker' => 'BartonImportJobseeker',
9
+ 'barton/export/jobseeker' => 'BartonExportJobseeker',
10
+ 'barton/import/order' => 'BartonImportOrder',
11
+ 'barton/export/order' => 'BartonExportOrder',
12
+ }
13
+
14
+ def route_event_request(path:, body:)
15
+ domain_url = ENV['CURRENT_SAM_URL']
16
+ if domain_url.present?
17
+ async_http_post(url: "#{domain_url}/#{path}", body: body)
18
+ else
19
+ function_name = PATH_TO_FUNCTION_NAME_MAPPING[path]
20
+ invoke_lambda(
21
+ function_name: function_name,
22
+ payload: body,
23
+ )
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -5,6 +5,8 @@ module WolfCore
5
5
 
6
6
  def async_http_get(**args)
7
7
  puts "starting async_http_get"
8
+ puts "async_http_get args are"
9
+ pp args
8
10
  run_async do
9
11
  response = http_get(**args)
10
12
  puts "async_http_get response is"
@@ -18,6 +20,8 @@ module WolfCore
18
20
 
19
21
  def async_http_post(**args)
20
22
  puts "starting async_http_post"
23
+ puts "async_http_post args are"
24
+ pp args
21
25
  run_async do
22
26
  response = http_post(**args)
23
27
  puts "async_http_post response is"
@@ -31,6 +35,8 @@ module WolfCore
31
35
 
32
36
  def async_http_put(**args)
33
37
  puts "starting async_http_put"
38
+ puts "async_http_put args are"
39
+ pp args
34
40
  run_async do
35
41
  response = http_put(**args)
36
42
  puts "async_http_put response is"
@@ -3,5 +3,31 @@ module WolfCore
3
3
  def invoke_lambda(function_name:, payload:)
4
4
  WolfCore::LambdaFunctionDataSource.invoke(function_name: function_name, payload: payload)
5
5
  end
6
+
7
+ def get_event_params(event)
8
+ event_body = event['body']
9
+ return deep_parse_json(event_body) if event_body.present?
10
+ event
11
+ end
12
+
13
+ def deep_parse_json(input)
14
+ while input.is_a?(String)
15
+ begin
16
+ input = JSON.parse(input)
17
+ rescue JSON::ParserError
18
+ break
19
+ end
20
+ end
21
+
22
+ input&.with_indifferent_access || {}
23
+ end
24
+
25
+ def result_to_response(result)
26
+ if result.success?
27
+ { statusCode: 200, body: result.data.to_h.to_json }
28
+ else
29
+ { statusCode: result.error.status || 422, body: result.error.to_h.to_json }
30
+ end
31
+ end
6
32
  end
7
33
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WolfCore
4
- VERSION = "0.1.27"
4
+ VERSION = "0.1.29"
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.27
4
+ version: 0.1.29
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-07-22 00:00:00.000000000 Z
11
+ date: 2024-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -62,6 +62,7 @@ files:
62
62
  - lib/wolf_core.rb
63
63
  - lib/wolf_core/application/application_service.rb
64
64
  - lib/wolf_core/application/barton/mappings.rb
65
+ - lib/wolf_core/application/barton/routing.rb
65
66
  - lib/wolf_core/application/exception_operations.rb
66
67
  - lib/wolf_core/application/salesforce_oauth_service.rb
67
68
  - lib/wolf_core/application/service_exception.rb