killbill-aviate 1.1.0.pre.1 → 1.1.0.pre.2

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: 89879b3fdf628ffa251342e2854f21eb8c8f3b6c738a4d5404bb3f064c4e5275
4
- data.tar.gz: 46977fab39f39d8737d4a611b4acd9e8be807bdf6c64b202d86dd68df2a5c690
3
+ metadata.gz: 351076bf3541d8c1b1b5cf46260a021bd2ac3bb5584c76882e74b5a326f91187
4
+ data.tar.gz: 914e1a98a10116f44fd42023a8f1903b5081efbdc6f1589a37cce61a76fbda29
5
5
  SHA512:
6
- metadata.gz: e575203964276a13d2e1453211524a413e3176fa926c0a90d23b1005f92ad19a112bcd965f4da776818b174e989f067e0ec59e4db6a4767dbffa65154194a5dc
7
- data.tar.gz: ba5e453cf98615607bfce226040827a511e3c7528de4826ccf0d0749fa8b3ae34a21163aeac995d4af22922023d29ba3859f298427822ffd511b3d97c57ffe00
6
+ metadata.gz: c659ff041b0dfc03cf2e0f1faf53c5f8ebf1b6344f5a88f7b490c14143b9cf4d80ba770d11e22e2614e4210fa80ee2cfb195713604b8001f085dc82491edd5b2
7
+ data.tar.gz: 97229f4998ae1519b5b48579424e85aa182486c3f5ab7bbe164e9f918a3eeed999c372391a76294408ce0f830c39bef627124d45ff064a6a6b550bf615814f15
data/lib/aviate/client.rb CHANGED
@@ -8,7 +8,19 @@ module Killbill
8
8
  class << self
9
9
  def aviate_plugin_available?(options = nil)
10
10
  path = "#{KILLBILL_AVIATE_PREFIX}/health/data"
11
- KillBillClient::API.get path, {}, get_token(options)
11
+
12
+ # Build options with proper header format for KillBillClient
13
+ request_options = {
14
+ api_key: options[:api_key],
15
+ api_secret: options[:api_secret]
16
+ }
17
+
18
+ # Add Authorization header if JWT token is present
19
+ if options[:jwt_token].present?
20
+ request_options[:head] = { 'Authorization' => "Bearer #{options[:jwt_token]}" }
21
+ end
22
+
23
+ KillBillClient::API.get path, {}, request_options
12
24
 
13
25
  [true, nil]
14
26
  rescue KillBillClient::API::ResponseError => e
@@ -28,7 +40,17 @@ module Killbill
28
40
 
29
41
  def retrieve_wallets(account_id, options = nil)
30
42
  path = "#{KILLBILL_AVIATE_PREFIX}/wallet/#{account_id}"
31
- response = KillBillClient::API.get path, {}, get_token(options)
43
+
44
+ request_options = {
45
+ api_key: options[:api_key],
46
+ api_secret: options[:api_secret]
47
+ }
48
+
49
+ if options[:jwt_token].present?
50
+ request_options[:head] = { 'Authorization' => "Bearer #{options[:jwt_token]}" }
51
+ end
52
+
53
+ response = KillBillClient::API.get path, {}, request_options
32
54
  JSON.parse(response.body)
33
55
  end
34
56
 
@@ -41,7 +63,17 @@ module Killbill
41
63
  expDurationUnit: wallet_params[:exp_duration_unit],
42
64
  expDurationLength: wallet_params[:exp_duration_length]
43
65
  }
44
- response = KillBillClient::API.put path, body.to_json, {}, get_token(options)
66
+
67
+ request_options = {
68
+ api_key: options[:api_key],
69
+ api_secret: options[:api_secret]
70
+ }
71
+
72
+ if options[:jwt_token].present?
73
+ request_options[:head] = { 'Authorization' => "Bearer #{options[:jwt_token]}" }
74
+ end
75
+
76
+ response = KillBillClient::API.put path, body.to_json, {}, request_options
45
77
  response.code
46
78
  end
47
79
 
@@ -64,7 +96,16 @@ module Killbill
64
96
  }
65
97
  }
66
98
 
67
- response = KillBillClient::API.post path, body.to_json, {}, get_token(options)
99
+ request_options = {
100
+ api_key: options[:api_key],
101
+ api_secret: options[:api_secret]
102
+ }
103
+
104
+ if options[:jwt_token].present?
105
+ request_options[:head] = { 'Authorization' => "Bearer #{options[:jwt_token]}" }
106
+ end
107
+
108
+ response = KillBillClient::API.post path, body.to_json, {}, request_options
68
109
  JSON.parse(response.body)
69
110
  rescue StandardError => e
70
111
  JSON.parse(e.message)
@@ -77,11 +118,12 @@ module Killbill
77
118
  base_url = KillBillClient::API.base_uri
78
119
  uri = URI("#{base_url}#{path}")
79
120
  http = Net::HTTP.new(uri.host, uri.port)
80
-
121
+ http.use_ssl = (uri.scheme == 'https')
122
+ http.verify_mode = OpenSSL::SSL::VERIFY_PEER
81
123
  request = Net::HTTP::Post.new(uri.path)
82
124
  request['Content-Type'] = 'application/json'
83
- request['X-killbill-apiKey'] = options[:api_key]
84
- request['X-killbill-apisecret'] = options[:api_secret]
125
+ request['X-Killbill-ApiKey'] = options[:api_key]
126
+ request['X-Killbill-ApiSecret'] = options[:api_secret]
85
127
  request['Authorization'] = "Basic #{auth}"
86
128
  request.body = {}.to_json
87
129
  response = http.request(request)
@@ -89,15 +131,6 @@ module Killbill
89
131
  rescue StandardError => e
90
132
  e.message.to_s
91
133
  end
92
-
93
- private
94
-
95
- def get_token(options = nil)
96
- {
97
- api_key: options[:api_key],
98
- api_secret: options[:api_secret]
99
- }.merge({ bearer: options[:jwt_token].to_s })
100
- end
101
134
  end
102
135
  end
103
136
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Aviate
4
- VERSION = '1.1.0.pre.1'
4
+ VERSION = '1.1.0.pre.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill-aviate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.pre.1
4
+ version: 1.1.0.pre.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kill Bill core team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-09-13 00:00:00.000000000 Z
11
+ date: 2025-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: killbill-assets-ui