wolf_core 0.1.15 → 0.1.17

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: 608584e93f4fcf6b8a92a497045dff3b823901701b2bf366d3bff33dfbf84395
4
- data.tar.gz: 3384c492d6a916cb07d2dabab569c2f022598afb51bebbf9ff91b3fc6fea128d
3
+ metadata.gz: bc4fd458f25e3c811fe10cc530624099b49c6fa48c98c83ce34168e811e4b2f3
4
+ data.tar.gz: 7d27d6bf1f70548aff6e8f4f667562fcf5538641a6a7d279c89566a7739b1a40
5
5
  SHA512:
6
- metadata.gz: 1fd8a35299fe06c2c54bade541155bb6a7de6b7149be86886a97e789eb1d8048b1853ee9b85fd42d5fe1cb2fe8701c1d2d5d24165af2e57b36d659d8341a8f7c
7
- data.tar.gz: 0353c3b9625ed1555bac67970977e98ca3639bddbdc3a18a6cbc5cbc53b378c3bc4e457b3e7aadac3af20c4e8649540a31d12a14e701375bfa45a6f02e41075a
6
+ metadata.gz: 5fa3c4785a823a2c65fd3437cc2abc973405cbd06e26ce91355da3afb8478a78bd1e2d069c97a8059509aef0db94bf0b49f1372f7e9e35e864d863c04e8ad2eb
7
+ data.tar.gz: f0de3112e7546b400bd985eaa3e2ef6b1bbdd954e84fb25a6e61b2719fa727ad305bb15ede314023785def7b186d54c09e2a1bce45abd6563db983241cf59625
@@ -1,40 +1,38 @@
1
1
  module WolfCore
2
2
  module Barton
3
3
  module Mappings
4
- include WolfCore::ExceptionOperations
4
+ PROVIDER_TYPE_MAPPING = {
5
+ 'MD' => ENV['MD_PRICING_ID'],
6
+ 'DO' => ENV['DO_PRICING_ID'],
7
+ 'PA' => ENV['PA_PRICING_ID'],
8
+ 'DMD' => ENV['DMD_PRICING_ID'],
9
+ 'NP' => ENV['NP_PRICING_ID'],
10
+ }
11
+
12
+ LOCUM_AVAILABILITY_MAP = {
13
+ "PT" => "Part Time",
14
+ "FT" => "Full Time",
15
+ "PFI" => "Not Sure Yet",
16
+ "Interim Locum" => "Between Permanent Positions",
17
+ "Perm Only" => "Permanent",
18
+ }
5
19
 
6
20
  def map_provider_type_to_pricing_id(provider_type)
7
- case provider_type
8
- when 'MD'
9
- ENV['MD_PRICING_ID']
10
- when 'DO'
11
- ENV['DO_PRICING_ID']
12
- when 'PA'
13
- ENV['PA_PRICING_ID']
14
- when 'DMD'
15
- ENV['DMD_PRICING_ID']
16
- when 'NP'
17
- ENV['NP_PRICING_ID']
18
- else
19
- raise_service_error({ message: "Unknown provider type #{provider_type}" })
20
- end
21
+ pricing_id = PROVIDER_TYPE_MAPPING[provider_type]
22
+ pricing_id || provider_type
21
23
  end
22
24
 
23
25
  def map_pricing_id_to_provider_type(pricing_id)
24
- case pricing_id.to_s
25
- when ENV['MD_PRICING_ID']
26
- 'MD'
27
- when ENV['DO_PRICING_ID']
28
- 'DO'
29
- when ENV['PA_PRICING_ID']
30
- 'PA'
31
- when ENV['DMD_PRICING_ID']
32
- 'DMD'
33
- when ENV['NP_PRICING_ID']
34
- 'NP'
35
- else
36
- raise_service_error({ message: "Unknown provider type #{provider_type}" })
37
- end
26
+ provider_type = PROVIDER_TYPE_MAPPING.invert[pricing_id]
27
+ provider_type || pricing_id
28
+ end
29
+
30
+ def map_locum_availability(value)
31
+ LOCUM_AVAILABILITY_MAP[value] || value
32
+ end
33
+
34
+ def reverse_map_locum_availability(value)
35
+ LOCUM_AVAILABILITY_MAP.invert[value] || value
38
36
  end
39
37
  end
40
38
  end
@@ -0,0 +1,29 @@
1
+ module WolfCore
2
+ module LambdaFunctionDataSource
3
+ module_function
4
+
5
+ def init
6
+ client_config = {
7
+ access_key_id: ENV.fetch('AWS_KEY_ID', nil),
8
+ secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY', nil),
9
+ region: ENV.fetch('AWS_REGION', nil)
10
+ }.compact
11
+ return if client_config.empty?
12
+ @@client = Aws::Lambda::Client.new(client_config)
13
+ end
14
+
15
+ def client
16
+ @@client
17
+ end
18
+
19
+ def invoke(function_name:, payload:)
20
+ parsed_payload = JSON.generate(payload)
21
+ @@client.invoke({
22
+ function_name: function_name,
23
+ invocation_type: 'Event',
24
+ log_type: 'Tail',
25
+ payload: parsed_payload
26
+ })
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,7 @@
1
+ module WolfCore
2
+ module LambdaFunctionOperations
3
+ def invoke_lambda(function_name:, payload:)
4
+ WolfCore::LambdaFunctionDataSource.invoke(function_name: function_name, payload: payload)
5
+ end
6
+ end
7
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WolfCore
4
- VERSION = "0.1.15"
4
+ VERSION = "0.1.17"
5
5
  end
data/lib/wolf_core.rb CHANGED
@@ -5,9 +5,11 @@ require 'ostruct'
5
5
  require 'httparty'
6
6
  require 'active_support'
7
7
  require 'active_support/core_ext'
8
+ require 'aws-sdk-lambda'
8
9
 
9
10
  module WolfCore; end
10
11
 
11
12
  require 'wolf_core/utils/file_utils'
12
13
 
13
14
  WolfCore::FileUtils.require_relative_folder(__dir__, 'wolf_core')
15
+ WolfCore::LambdaFunctionDataSource.init
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.15
4
+ version: 0.1.17
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-14 00:00:00.000000000 Z
11
+ date: 2024-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: aws-sdk-lambda
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: Repository to store shared code among Ruby projects.
42
56
  email:
43
57
  - jroncallo96@gmail.com
@@ -49,11 +63,13 @@ files:
49
63
  - lib/wolf_core/application/application_service.rb
50
64
  - lib/wolf_core/application/barton/mappings.rb
51
65
  - lib/wolf_core/application/exception_operations.rb
52
- - lib/wolf_core/application/fkm_operations.rb
53
- - lib/wolf_core/application/http_operations.rb
54
66
  - lib/wolf_core/application/salesforce_oauth_service.rb
55
67
  - lib/wolf_core/application/service_exception.rb
68
+ - lib/wolf_core/infrastructure/fkm_operations.rb
56
69
  - lib/wolf_core/infrastructure/http_data_source.rb
70
+ - lib/wolf_core/infrastructure/http_operations.rb
71
+ - lib/wolf_core/infrastructure/lambda_function_data_source.rb
72
+ - lib/wolf_core/infrastructure/lambda_function_operations.rb
57
73
  - lib/wolf_core/utils/file_utils.rb
58
74
  - lib/wolf_core/utils/result.rb
59
75
  - lib/wolf_core/version.rb