wolf_core 0.1.43 → 0.1.45

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: 641d1e4c154ea68b57268ba3070322a32b422cffa0953b5ba8fc7efa8eac13d4
4
- data.tar.gz: 8829a6bce3dc101986ae92a4f7de4c6ca39cb8aa5884ecf789aa96a0a527c588
3
+ metadata.gz: 90c1f8f955a6f904bd51d2ee8c728979342cdce86d656f1410486489192cd419
4
+ data.tar.gz: 7b9ba63cef9b265c8942925a088e53406e75dd95cbebc6cada8c023ba7535c41
5
5
  SHA512:
6
- metadata.gz: d159bf71936794aeaabfd938fe0854de4a61d790e2ea6d36adf2727d37a1aba15ee3ad9c089a630bd85e129b9fbc6a11bd01fd9527dbb67afa7aa4b50e708f05
7
- data.tar.gz: bb9ba87004026d19b88d1c212d0c356dafe54b1bcb49a4b47744a79beb592c2ed8215d4c1f4f2f59d70710fba00a44e67c976368a4f4581973ea6d884e39883d
6
+ metadata.gz: 71132fc6ff3d9695a7c6729d71a851fdd39383bd5c04f3605cc58f348bb5ae192343b29b81fc62ab0d76262eff43e2ad24467b8e36c6ee0889ecbc68abc5e0fd
7
+ data.tar.gz: 73b0d496431e45270609aef6ad44a860e79b04520b943a5e6cab3640e2b125ff97888e3a9c08ec274eb92a996d229b516f188befe251cc3fde313ab29d78d407
@@ -8,6 +8,7 @@ module WolfCore
8
8
  'DMD' => ENV['DMD_PRICING_ID'],
9
9
  'NP' => ENV['NP_PRICING_ID'],
10
10
  'DDS' => ENV['DDS_PRICING_ID'],
11
+ 'GP' => ENV['GP_PRICING_ID'],
11
12
  }
12
13
 
13
14
  LOCUM_AVAILABILITY_MAP = {
@@ -24,27 +24,6 @@ module WolfCore
24
24
  )
25
25
  end
26
26
  end
27
-
28
- def import_order_description(order_id:, listing:)
29
- domain_url = ENV['GENERATE_JOB_DESCRIPTION_URL']
30
- path = 'barton/import/order_description'
31
- headers = {
32
- 'Authorization' => ENV['GENERATE_JOB_DESCRIPTION_TOKEN'],
33
- 'tenant' => ENV['GENERATE_JOB_DESCRIPTION_TENANT'],
34
- }
35
- body = { order_id: order_id, listing: listing }
36
-
37
- if domain_url.present?
38
- async_http_post(url: "#{domain_url}/#{path}", headers: headers, body: body)
39
- else
40
- function_name = PATH_TO_FUNCTION_NAME_MAPPING[path]
41
- body['headers'] = headers
42
- invoke_lambda(
43
- function_name: function_name,
44
- payload: body,
45
- )
46
- end
47
- end
48
27
  end
49
28
  end
50
29
  end
@@ -2,18 +2,30 @@ module WolfCore
2
2
  module HttpOperations
3
3
  include WolfCore::ExceptionOperations
4
4
  include WolfCore::AsyncUtils
5
+ include WolfCore::LoggingUtils
5
6
 
6
7
  def async_http_get(**args)
7
- puts "starting async_http_get"
8
- puts "async_http_get args are"
9
- pp args
8
+ log_object 'starting async_http_get'
9
+ log_object args, title: 'async_http_get args are'
10
10
  run_async do
11
11
  response = http_get(**args)
12
- puts "async_http_get response is"
13
- pp parse_http_response(response).to_h
12
+ log_object parse_http_response(response), title: 'async_http_get response is'
14
13
  end
15
14
  end
16
15
 
16
+ def safe_http_get(url:, headers: {}, query: nil, error_message: nil, title: nil)
17
+ response = http_get(url: url, headers: headers, query: query)
18
+ response = parse_http_response(response)
19
+
20
+ title ||= 'safe_http_get response is'
21
+ log_object response, title: title
22
+
23
+ error_message ||= 'Error on safe_http_get'
24
+ validate_http_response(response: response, message: error_message)
25
+
26
+ response
27
+ end
28
+
17
29
  def http_get(url:, headers: {}, query: nil)
18
30
  WolfCore::HttpDataSource.http_get(url: url, headers: headers, query: query)
19
31
  end
@@ -21,29 +33,54 @@ module WolfCore
21
33
  def async_http_post(**args)
22
34
  puts "starting async_http_post"
23
35
  puts "async_http_post args are"
24
- pp args
36
+ log_object args
25
37
  run_async do
26
38
  response = http_post(**args)
27
39
  puts "async_http_post response is"
28
- pp parse_http_response(response).to_h
40
+ log_object parse_http_response(response).to_h
29
41
  end
30
42
  end
31
43
 
44
+ def safe_http_post(url:, headers: {}, body: nil, query: nil, error_message: nil, title: nil)
45
+ response = http_post(url: url, headers: headers, body: body, query: query)
46
+ response = parse_http_response(response)
47
+
48
+ title ||= 'safe_http_post response is'
49
+ log_object response, title: title
50
+
51
+ error_message ||= 'Error on safe_http_post'
52
+ validate_http_response(response: response, message: error_message)
53
+
54
+ response
55
+ end
56
+
32
57
  def http_post(url:, headers: {}, body: nil, query: nil)
33
58
  WolfCore::HttpDataSource.http_post(url: url, headers: headers, query: query, body: body)
34
59
  end
35
60
 
36
61
  def async_http_put(**args)
37
- puts "starting async_http_put"
38
- puts "async_http_put args are"
39
- pp args
62
+ log_object 'starting async_http_put'
63
+ log_object args, title: 'async_http_put args are'
40
64
  run_async do
41
65
  response = http_put(**args)
42
66
  puts "async_http_put response is"
43
- pp parse_http_response(response).to_h
67
+ log_object parse_http_response(response).to_h
44
68
  end
45
69
  end
46
70
 
71
+ def safe_http_put(url:, headers: {}, body: nil, query: nil, error_message: nil, title: nil)
72
+ response = http_put(url: url, headers: headers, body: body, query: query)
73
+ response = parse_http_response(response)
74
+
75
+ title ||= 'safe_http_put response is'
76
+ log_object response, title: title
77
+
78
+ error_message ||= 'Error on safe_http_put'
79
+ validate_http_response(response: response, message: error_message)
80
+
81
+ response
82
+ end
83
+
47
84
  def http_put(url:, headers: {}, body: nil, query: nil)
48
85
  WolfCore::HttpDataSource.http_put(url: url, headers: headers, query: query, body: body)
49
86
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WolfCore
4
- VERSION = "0.1.43"
4
+ VERSION = "0.1.45"
5
5
  end
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.43
4
+ version: 0.1.45
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Roncallo