wolf_core 0.1.12 → 0.1.15

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: 914e75f9733c9a9903c60262da705977f3f51cefcca450f3f238b5d852318067
4
- data.tar.gz: 131c093c63143bcfa4a1302d748cc348af28fcf9e14e956beb8b3729ffe2d89f
3
+ metadata.gz: 608584e93f4fcf6b8a92a497045dff3b823901701b2bf366d3bff33dfbf84395
4
+ data.tar.gz: 3384c492d6a916cb07d2dabab569c2f022598afb51bebbf9ff91b3fc6fea128d
5
5
  SHA512:
6
- metadata.gz: a012ff46e2f82ed42ec569fbb80bb3aefee712646c94b63f9353dfeb91d84ea05bb950724ba8586fbade8861a9198cae089d400e57b0144c07295388c9e019dd
7
- data.tar.gz: 35f0fcc4c0431b3e15265da28c885289ff41f7070cf992cb797cf1c6d107c634c2a5c4a4eee9ac038cb31eecbac2571778f9ba23eeeafc5f1d6e3739fae72045
6
+ metadata.gz: 1fd8a35299fe06c2c54bade541155bb6a7de6b7149be86886a97e789eb1d8048b1853ee9b85fd42d5fe1cb2fe8701c1d2d5d24165af2e57b36d659d8341a8f7c
7
+ data.tar.gz: 0353c3b9625ed1555bac67970977e98ca3639bddbdc3a18a6cbc5cbc53b378c3bc4e457b3e7aadac3af20c4e8649540a31d12a14e701375bfa45a6f02e41075a
@@ -55,8 +55,9 @@ module WolfCore
55
55
  result.data.access_token
56
56
  end
57
57
 
58
- def get_salesforce_foreign_object(record_id:)
58
+ def get_salesforce_foreign_object(salesforce_access_token:, record_id:)
59
59
  foreign_object = salesforce_http_get(
60
+ salesforce_access_token: salesforce_access_token,
60
61
  query: { calltype: 'getRecord', RecordId: record_id }
61
62
  )
62
63
  puts "foreign object is"
@@ -64,10 +65,10 @@ module WolfCore
64
65
  foreign_object
65
66
  end
66
67
 
67
- def salesforce_http_get(query: nil)
68
+ def salesforce_http_get(salesforce_access_token:, query: nil)
68
69
  response = http_get(
69
70
  url: ENV['SALESFORCE_URL'],
70
- headers: { 'Authorization' => "Bearer #{@salesforce_access_token}" },
71
+ headers: { 'Authorization' => "Bearer #{salesforce_access_token}" },
71
72
  query: query
72
73
  )
73
74
  validate_salesforce_response(response)
@@ -3,7 +3,7 @@ module WolfCore
3
3
  module Mappings
4
4
  include WolfCore::ExceptionOperations
5
5
 
6
- def map_pricing_id(provider_type)
6
+ def map_provider_type_to_pricing_id(provider_type)
7
7
  case provider_type
8
8
  when 'MD'
9
9
  ENV['MD_PRICING_ID']
@@ -19,6 +19,23 @@ module WolfCore
19
19
  raise_service_error({ message: "Unknown provider type #{provider_type}" })
20
20
  end
21
21
  end
22
+
23
+ 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
38
+ end
22
39
  end
23
40
  end
24
41
  end
@@ -10,6 +10,10 @@ module WolfCore
10
10
  WolfCore::HttpDataSource.http_post(url: url, headers: headers, query: query, body: body)
11
11
  end
12
12
 
13
+ def http_put(url:, headers: {}, body: nil, query: nil)
14
+ WolfCore::HttpDataSource.http_put(url: url, headers: headers, query: query, body: body)
15
+ end
16
+
13
17
  def validate_http_response(response:, message:, error_data: nil)
14
18
  unless response.code == 200
15
19
  error_data = {
@@ -11,5 +11,11 @@ module WolfCore
11
11
  body = body&.to_json if headers['Content-Type'] == 'application/json'
12
12
  HTTParty.post(url, headers: headers, query: query, body: body)
13
13
  end
14
+
15
+ def http_put(url:, headers: {}, query: nil, body: nil)
16
+ headers['Content-Type'] ||= 'application/json'
17
+ body = body&.to_json if headers['Content-Type'] == 'application/json'
18
+ HTTParty.put(url, headers: headers, query: query, body: body)
19
+ end
14
20
  end
15
21
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WolfCore
4
- VERSION = "0.1.12"
4
+ VERSION = "0.1.15"
5
5
  end
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.12
4
+ version: 0.1.15
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-13 00:00:00.000000000 Z
11
+ date: 2024-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty