wolf_core 0.2.0 → 0.2.1
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: 5a1f0b2966c7b61301a3801b584e0c47c30d33dc41da57544a9d0ae62b40d352
|
4
|
+
data.tar.gz: 4983824766da8cf8322d6ca4f4f16e16683cc829718e4ef6a21d973ab2520c5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c766631f0310e07308c84719fc7963e79d37e4cef422fb5f1f0ba62d346f4c8c4d011abe7dfcd87d243c84e2bb27b0bf27fbeb7afdbac11477466270d258ae4b
|
7
|
+
data.tar.gz: bcb84ab0f42910f4af5fd3ab074009db17385e12db30a3079f225ad001b556d6584c2d0d998125401a4286c0ffb0bd6e3ca18fc73811da3e5c4e0881c2a2d0ae
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module WolfCore
|
2
2
|
module Integrations
|
3
3
|
module WebhooksOperations
|
4
|
-
def get_payload(
|
4
|
+
def get_payload(params:, event_type: nil)
|
5
|
+
event_type ||= get_event_type(params: params)
|
5
6
|
return if event_type == 'SubscriptionConfirmation'
|
6
7
|
params = JSON.parse(params['Message'] || '{}')
|
7
8
|
JSON.parse(params['payload'] || '{}')
|
@@ -16,7 +17,7 @@ module WolfCore
|
|
16
17
|
message['event_name']
|
17
18
|
end
|
18
19
|
|
19
|
-
def
|
20
|
+
def validate_user_is_not_admin(params:)
|
20
21
|
event_type = get_event_type(params: params)
|
21
22
|
return if event_type == 'SubscriptionConfirmation'
|
22
23
|
|
@@ -27,17 +28,15 @@ module WolfCore
|
|
27
28
|
end
|
28
29
|
|
29
30
|
def subscription_confirmation_request(url:)
|
30
|
-
|
31
|
+
safe_http_get(
|
31
32
|
url: url,
|
32
33
|
error_message: "Can not confirm subscription",
|
33
34
|
)
|
34
|
-
response
|
35
35
|
end
|
36
36
|
|
37
37
|
def process_webhook(params:)
|
38
38
|
event_type = get_event_type(params: params)
|
39
39
|
event_name = get_event_name(params: params)
|
40
|
-
# payload = get_payload(event_type: event_type, params: params)
|
41
40
|
if event_type == 'SubscriptionConfirmation'
|
42
41
|
url = params['SubscribeURL']
|
43
42
|
elsif event_type == 'Notification'
|
@@ -56,6 +55,37 @@ module WolfCore
|
|
56
55
|
params = JSON.parse(params['Message'] || '{}')
|
57
56
|
params['object_id']
|
58
57
|
end
|
58
|
+
|
59
|
+
def group_custom_values_by_custom_requirement_group(
|
60
|
+
params:,
|
61
|
+
jobseeker_file_custom_requirement_ids:,
|
62
|
+
reference_form_custom_requirement_ids:,
|
63
|
+
disclosure_form_custom_requirement_ids:
|
64
|
+
)
|
65
|
+
payload = get_payload(params: params)
|
66
|
+
custom_values = payload.dig('changes', 'custom_values')
|
67
|
+
if custom_values.blank?
|
68
|
+
custom_values = [ payload['attributes'] ]
|
69
|
+
end
|
70
|
+
|
71
|
+
custom_values.group_by do |custom_value|
|
72
|
+
custom_requirement_group = if jobseeker_file_custom_requirement_ids.include?(custom_value['custom_requirement_id'])
|
73
|
+
'jobseeker_file'
|
74
|
+
elsif reference_form_custom_requirement_ids.include?(custom_value['custom_requirement_id'])
|
75
|
+
'reference_form'
|
76
|
+
elsif disclosure_form_custom_requirement_ids.include?(custom_value['custom_requirement_id'])
|
77
|
+
'disclosure_form'
|
78
|
+
elsif custom_value['user_category'] == 'Freelancer'
|
79
|
+
'jobseeker'
|
80
|
+
elsif custom_value['user_category'] == 'Campaign'
|
81
|
+
'order'
|
82
|
+
else
|
83
|
+
'unknown_group'
|
84
|
+
end
|
85
|
+
|
86
|
+
custom_requirement_group
|
87
|
+
end
|
88
|
+
end
|
59
89
|
end
|
60
90
|
end
|
61
91
|
end
|
data/lib/wolf_core/version.rb
CHANGED