metrifox-sdk 1.1.1 → 1.2.0
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/README.md +26 -0
- data/lib/metrifox-sdk.rb +2 -0
- data/lib/metrifox_sdk/base_api.rb +6 -0
- data/lib/metrifox_sdk/client.rb +4 -0
- data/lib/metrifox_sdk/subscriptions/api.rb +26 -0
- data/lib/metrifox_sdk/subscriptions/module.rb +29 -0
- data/lib/metrifox_sdk/version.rb +1 -1
- metadata +8 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3cdf295c1adaab10f96e19c3075c40731a28bb799a1a696ff956abfaf2f0a724
|
|
4
|
+
data.tar.gz: 5c964c16f80530bd851132092261a09939473c60e53fe9d65ef309a9d354b9e7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7f391b66aae02c8854acd698a3f4031d0bf8996715367c28187346217b8a6be06fffce582cb42ace51de436e85bf3def974e0100c8364adeaddb5586522ec537
|
|
7
|
+
data.tar.gz: b8b03fe8d55a00d308b2affb7fc1fe6e8fe8a32a7d50b15cee248e406123690ad579e202331352a83b85bdfb75cff4f90c0b798bf59e924d3d625d2e058f8a15
|
data/README.md
CHANGED
|
@@ -232,6 +232,26 @@ checkout_config = MetrifoxSDK::Types::CheckoutConfig.new(
|
|
|
232
232
|
checkout_url = METRIFOX_SDK.checkout.url(checkout_config)
|
|
233
233
|
```
|
|
234
234
|
|
|
235
|
+
### Subscriptions
|
|
236
|
+
|
|
237
|
+
```ruby
|
|
238
|
+
# Get billing history for a subscription
|
|
239
|
+
response = METRIFOX_SDK.subscriptions.get_billing_history("subscription_uuid")
|
|
240
|
+
puts response["data"]
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
```ruby
|
|
244
|
+
# Get entitlements summary for a subscription
|
|
245
|
+
response = METRIFOX_SDK.subscriptions.get_entitlements_summary("subscription_uuid")
|
|
246
|
+
puts response["data"]
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
```ruby
|
|
250
|
+
# Get entitlements usage for a subscription
|
|
251
|
+
response = METRIFOX_SDK.subscriptions.get_entitlements_usage("subscription_uuid")
|
|
252
|
+
puts response["data"]
|
|
253
|
+
```
|
|
254
|
+
|
|
235
255
|
### Using Client Instance
|
|
236
256
|
|
|
237
257
|
```ruby
|
|
@@ -284,6 +304,12 @@ rescue MetrifoxSDK::ConfigurationError => e
|
|
|
284
304
|
end
|
|
285
305
|
```
|
|
286
306
|
|
|
307
|
+
## SSL Certificate Handling
|
|
308
|
+
|
|
309
|
+
The SDK configures a custom `OpenSSL::X509::Store` with system default certificate paths for all HTTPS requests. This ensures reliable SSL connections across different Ruby and OpenSSL versions, including environments where strict CRL (Certificate Revocation List) checking may cause verification failures.
|
|
310
|
+
|
|
311
|
+
No additional configuration is needed — SSL is handled automatically when making API calls.
|
|
312
|
+
|
|
287
313
|
## Development
|
|
288
314
|
|
|
289
315
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/metrifox-sdk.rb
CHANGED
|
@@ -9,6 +9,8 @@ require_relative "metrifox_sdk/customers/module"
|
|
|
9
9
|
require_relative "metrifox_sdk/usages/module"
|
|
10
10
|
require_relative "metrifox_sdk/checkout/api"
|
|
11
11
|
require_relative "metrifox_sdk/checkout/module"
|
|
12
|
+
require_relative "metrifox_sdk/subscriptions/api"
|
|
13
|
+
require_relative "metrifox_sdk/subscriptions/module"
|
|
12
14
|
|
|
13
15
|
module MetrifoxSDK
|
|
14
16
|
class << self
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require "net/http"
|
|
2
2
|
require "uri"
|
|
3
3
|
require "json"
|
|
4
|
+
require "openssl"
|
|
4
5
|
require "mime/types"
|
|
5
6
|
|
|
6
7
|
module MetrifoxSDK
|
|
@@ -20,6 +21,11 @@ module MetrifoxSDK
|
|
|
20
21
|
def make_raw_request(uri, method, headers, body = nil)
|
|
21
22
|
http = Net::HTTP.new(uri.host, uri.port)
|
|
22
23
|
http.use_ssl = uri.scheme == "https"
|
|
24
|
+
if http.use_ssl?
|
|
25
|
+
cert_store = OpenSSL::X509::Store.new
|
|
26
|
+
cert_store.set_default_paths
|
|
27
|
+
http.cert_store = cert_store
|
|
28
|
+
end
|
|
23
29
|
|
|
24
30
|
request = case method
|
|
25
31
|
when "GET"
|
data/lib/metrifox_sdk/client.rb
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require "net/http"
|
|
2
|
+
require "uri"
|
|
3
|
+
require "json"
|
|
4
|
+
require_relative "../base_api"
|
|
5
|
+
|
|
6
|
+
module MetrifoxSDK::Subscriptions
|
|
7
|
+
class API < MetrifoxSDK::BaseApi
|
|
8
|
+
def billing_history_request(base_url, api_key, subscription_id)
|
|
9
|
+
uri = URI.join(base_url, "subscriptions/#{subscription_id}/billing-history")
|
|
10
|
+
response = make_request(uri, "GET", api_key)
|
|
11
|
+
parse_response(response, "Failed to Fetch Billing History")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def entitlements_summary_request(base_url, api_key, subscription_id)
|
|
15
|
+
uri = URI.join(base_url, "subscriptions/#{subscription_id}/v2/entitlements-summary")
|
|
16
|
+
response = make_request(uri, "GET", api_key)
|
|
17
|
+
parse_response(response, "Failed to Fetch Entitlements Summary")
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def entitlements_usage_request(base_url, api_key, subscription_id)
|
|
21
|
+
uri = URI.join(base_url, "subscriptions/#{subscription_id}/v2/entitlements-usage")
|
|
22
|
+
response = make_request(uri, "GET", api_key)
|
|
23
|
+
parse_response(response, "Failed to Fetch Entitlements Usage")
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require_relative "api"
|
|
2
|
+
require_relative "../base_module"
|
|
3
|
+
|
|
4
|
+
module MetrifoxSDK
|
|
5
|
+
module Subscriptions
|
|
6
|
+
class Module < BaseModule
|
|
7
|
+
def get_billing_history(subscription_id)
|
|
8
|
+
validate_api_key!
|
|
9
|
+
api.billing_history_request(base_url, api_key, subscription_id)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def get_entitlements_summary(subscription_id)
|
|
13
|
+
validate_api_key!
|
|
14
|
+
api.entitlements_summary_request(base_url, api_key, subscription_id)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get_entitlements_usage(subscription_id)
|
|
18
|
+
validate_api_key!
|
|
19
|
+
api.entitlements_usage_request(base_url, api_key, subscription_id)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def api
|
|
25
|
+
@api ||= API.new
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
data/lib/metrifox_sdk/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: metrifox-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Metrifox
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: exe
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-02-16 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: json
|
|
@@ -125,6 +126,8 @@ files:
|
|
|
125
126
|
- lib/metrifox_sdk/client.rb
|
|
126
127
|
- lib/metrifox_sdk/customers/api.rb
|
|
127
128
|
- lib/metrifox_sdk/customers/module.rb
|
|
129
|
+
- lib/metrifox_sdk/subscriptions/api.rb
|
|
130
|
+
- lib/metrifox_sdk/subscriptions/module.rb
|
|
128
131
|
- lib/metrifox_sdk/types.rb
|
|
129
132
|
- lib/metrifox_sdk/usages/api.rb
|
|
130
133
|
- lib/metrifox_sdk/usages/module.rb
|
|
@@ -137,6 +140,7 @@ metadata:
|
|
|
137
140
|
homepage_uri: https://github.com/metrifox/metrifox-ruby
|
|
138
141
|
source_code_uri: https://github.com/metrifox/metrifox-ruby
|
|
139
142
|
changelog_uri: https://github.com/metrifox/metrifox-ruby/tree/main/CHANGELOG.md
|
|
143
|
+
post_install_message:
|
|
140
144
|
rdoc_options: []
|
|
141
145
|
require_paths:
|
|
142
146
|
- lib
|
|
@@ -151,7 +155,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
151
155
|
- !ruby/object:Gem::Version
|
|
152
156
|
version: '0'
|
|
153
157
|
requirements: []
|
|
154
|
-
rubygems_version: 3.
|
|
158
|
+
rubygems_version: 3.5.22
|
|
159
|
+
signing_key:
|
|
155
160
|
specification_version: 4
|
|
156
161
|
summary: Ruby SDK for Metrifox API
|
|
157
162
|
test_files: []
|