wolf_core 0.1.28 → 0.1.29
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57aa9bfd33652940c175b75d42f9d9cb48d1da5215f3f527643ea44748a7b34f
|
4
|
+
data.tar.gz: 7a0a439e84012da04ef0b8ea94d5282a0ecd47b4444e7c71497c16a951c3900e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
@@ -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
|
@@ -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
|
data/lib/wolf_core/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javier Roncallo
|
@@ -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
|