wolf_core 1.1.18 → 1.1.20
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f69f8bad2e0df5cd26a204f28082612b00dd0768cb72714f2e0becf1fbfcaa9e
|
4
|
+
data.tar.gz: 8d84976e1c59830240dd2bc8874c87f006ca9ddb6ae320da78360bdda58c42f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3abe68cdc77f28f492f9185e1c37c8a95718f03ad6b3b826711fc250dd5aeef84069bb9c923803f6e47727975eac950440abc76425ce565e4ad11e6b4276cf32
|
7
|
+
data.tar.gz: edb7349c6fb83f9549476640baa98027adaee59784952e0dccce5b4663d64e2054d70bb1a102fb2c35702f966d16b263cdc778f386a51d91dd531aaf0b91a483
|
@@ -0,0 +1,75 @@
|
|
1
|
+
module WolfCore
|
2
|
+
module Integrations
|
3
|
+
module ContractApiOperations
|
4
|
+
include WolfCore::HttpOperations
|
5
|
+
|
6
|
+
CONTRACT_ID_REGEX = /.*-(\d+)-(\d+)/
|
7
|
+
|
8
|
+
def fetch_contract!(wolf_token:, tenant:, wolf_platform_url:, contract_id:, error_message:, error_data: nil, query: nil)
|
9
|
+
response = fetch_contract(
|
10
|
+
wolf_token: wolf_token,
|
11
|
+
tenant: tenant,
|
12
|
+
wolf_platform_url: wolf_platform_url,
|
13
|
+
contract_id: contract_id,
|
14
|
+
query: query
|
15
|
+
)
|
16
|
+
order_id, jobseeker_id = extract_ids_from_contract_id(contract_id)
|
17
|
+
error_data ||= {}
|
18
|
+
validate_http_response(
|
19
|
+
response: response,
|
20
|
+
message: error_message,
|
21
|
+
error_data: error_data.merge(contract_id: contract_id, order_id: order_id, jobseeker_id: jobseeker_id, query: query)
|
22
|
+
)
|
23
|
+
response.body.dig("data", "table", "contract")
|
24
|
+
end
|
25
|
+
|
26
|
+
def fetch_contract(wolf_token:, tenant:, wolf_platform_url:, contract_id:, query: nil)
|
27
|
+
order_id, jobseeker_id = extract_ids_from_contract_id(contract_id)
|
28
|
+
query ||= {}
|
29
|
+
parsed_http_get(
|
30
|
+
headers: { "Authorization" => "Bearer #{wolf_token}" },
|
31
|
+
url: "#{wolf_platform_url}/api/v2/contracts/#{order_id}/#{jobseeker_id}",
|
32
|
+
query: query.merge(tenant: tenant)
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
def update_contract!(wolf_token:, tenant:, wolf_platform_url:, contract_id:, contract:, error_message:, error_data: nil)
|
37
|
+
response = update_contract(
|
38
|
+
wolf_token: wolf_token,
|
39
|
+
tenant: tenant,
|
40
|
+
wolf_platform_url: wolf_platform_url,
|
41
|
+
contract_id: contract_id,
|
42
|
+
contract: contract
|
43
|
+
)
|
44
|
+
order_id, jobseeker_id = extract_ids_from_contract_id(contract_id)
|
45
|
+
error_data ||= {}
|
46
|
+
validate_http_response(
|
47
|
+
response: response,
|
48
|
+
message: error_message,
|
49
|
+
error_data: error_data.merge(contract_id: contract_id, order_id: order_id, jobseeker_id: jobseeker_id, contract: contract)
|
50
|
+
)
|
51
|
+
response
|
52
|
+
end
|
53
|
+
|
54
|
+
def update_contract(wolf_token:, tenant:, wolf_platform_url:, contract_id:, contract:)
|
55
|
+
order_id, jobseeker_id = extract_ids_from_contract_id(contract_id)
|
56
|
+
parsed_http_put(
|
57
|
+
headers: { "Authorization" => "Bearer #{wolf_token}" },
|
58
|
+
url: "#{wolf_platform_url}/api/v2/contracts/#{order_id}/#{jobseeker_id}",
|
59
|
+
query: { tenant: tenant },
|
60
|
+
body: contract
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def extract_ids_from_contract_id(contract_id)
|
67
|
+
match = contract_id.match(CONTRACT_ID_REGEX)
|
68
|
+
raise_service_error(message: "Invalid contract_id format", data: { contract_id: contract_id }) unless match
|
69
|
+
order_id = match[1]
|
70
|
+
jobseeker_id = match[2]
|
71
|
+
[order_id, jobseeker_id]
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -22,15 +22,15 @@ module WolfCore
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
25
|
+
def schedule_recurring(job_id:, schedule:, target:, config: {})
|
26
|
+
Result.try do
|
27
|
+
expr = expression_from_schedule!(schedule)
|
28
|
+
normalized_target = normalize_target(target)
|
29
|
+
response = schedule_with_expression(job_id: job_id, expr: expr, target: normalized_target,
|
30
|
+
config: config)
|
31
|
+
Result.success(data: { response: response })
|
33
32
|
end
|
33
|
+
end
|
34
34
|
|
35
35
|
def cancel_schedule(job_id:, options: {})
|
36
36
|
Result.try do
|
data/lib/wolf_core/version.rb
CHANGED
data/lib/wolf_core.rb
CHANGED
@@ -1,22 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
3
|
+
require "json"
|
4
|
+
require "ostruct"
|
5
|
+
require "httparty"
|
6
|
+
require "active_support"
|
7
|
+
require "active_model"
|
8
|
+
require "active_support/core_ext"
|
9
|
+
require "aws-sdk-lambda"
|
10
|
+
require "redis"
|
11
|
+
require "aws-sdk-dynamodb"
|
12
|
+
require "aws-sdk-scheduler"
|
13
|
+
require "honeybadger"
|
13
14
|
|
14
15
|
module WolfCore; end
|
15
16
|
|
16
|
-
require
|
17
|
+
require "wolf_core/utils/file_utils"
|
17
18
|
|
18
|
-
WolfCore::FileUtils.require_relative_folder(__dir__,
|
19
|
+
WolfCore::FileUtils.require_relative_folder(__dir__, "wolf_core")
|
19
20
|
WolfCore::LambdaFunctionDataSource.init
|
20
21
|
WolfCore::InMemoryStorageDataSource.init
|
21
22
|
WolfCore::NoSqlDbDataSource.init
|
22
|
-
WolfCore::NoSqlDbInstanceDataSource.init
|
23
|
+
WolfCore::NoSqlDbInstanceDataSource.init
|
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: 1.1.
|
4
|
+
version: 1.1.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javier Roncallo
|
@@ -79,6 +79,20 @@ dependencies:
|
|
79
79
|
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '0'
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: aws-sdk-scheduler
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
type: :runtime
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
82
96
|
- !ruby/object:Gem::Dependency
|
83
97
|
name: honeybadger
|
84
98
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,6 +137,7 @@ files:
|
|
123
137
|
- lib/wolf_core/application/exception_operations.rb
|
124
138
|
- lib/wolf_core/application/integrations/change_detection.rb
|
125
139
|
- lib/wolf_core/application/integrations/client_api_operations.rb
|
140
|
+
- lib/wolf_core/application/integrations/contract_api_operations.rb
|
126
141
|
- lib/wolf_core/application/integrations/custom_value_api_operations.rb
|
127
142
|
- lib/wolf_core/application/integrations/environment_operations.rb
|
128
143
|
- lib/wolf_core/application/integrations/iterate_orders_service.rb
|