killbill-aviate 1.0.0 → 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 +4 -4
- data/lib/aviate/client.rb +49 -16
- data/lib/aviate/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 351076bf3541d8c1b1b5cf46260a021bd2ac3bb5584c76882e74b5a326f91187
|
|
4
|
+
data.tar.gz: 914e1a98a10116f44fd42023a8f1903b5081efbdc6f1589a37cce61a76fbda29
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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-
|
|
84
|
-
request['X-
|
|
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
|
data/lib/aviate/version.rb
CHANGED
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.0.
|
|
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-
|
|
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
|
|
@@ -114,9 +114,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
114
114
|
version: '0'
|
|
115
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
116
|
requirements:
|
|
117
|
-
- - "
|
|
117
|
+
- - ">"
|
|
118
118
|
- !ruby/object:Gem::Version
|
|
119
|
-
version:
|
|
119
|
+
version: 1.3.1
|
|
120
120
|
requirements: []
|
|
121
121
|
rubygems_version: 3.4.10
|
|
122
122
|
signing_key:
|