app_store_server_api_client 0.1.0 → 0.1.1

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: e0d6c54805549e9e61a26f3dc874d091722c548ecc57ed45b9086c295f9d02db
4
- data.tar.gz: 0f545da8ddc8a22a83d1e9fa382968f45e90a82d9059835822e30d02c2debf28
3
+ metadata.gz: 35b9f20bffda473cb9358a6c5aac17bb3b7d685799913db5f9efa7b4e01224d9
4
+ data.tar.gz: 8e3335360c11ed146dcb087a230231afb3432035233898e347b4e38ca4285dcd
5
5
  SHA512:
6
- metadata.gz: d478dae3696e4f0e8eda24c12f83a9ccdb4f7ffc2e3f5e95c8b0ee62ef664278384fbeba0f728044eab5f1adb8f1eb6ac71a79ae86710d66b59894c06c179f46
7
- data.tar.gz: e2106ce7f0313203f26c807f1ee90aa998cce02f4cb7dce765695f8853cdfeb8d82f9d6e3a473f6cd8bcb4cac30709713450cb4dbd04b801b10213dab1cc2c34
6
+ metadata.gz: 0a2c7f13a44cad1e56a964a08f0e839c57e56fb58d85c71560c34f1f3d9394b167624e61658dc222a5a168eb693c7a532073639e3cc0f3007218459410312cd7
7
+ data.tar.gz: 89eb093098803c083079f10a9c04192f023ff082a29f324aae25bd8d07d8d0dcbe863dce4380d4d8ed87cdb62f238b7b5dbaf485513d14e8a96eda38895fe4d7
data/README.md CHANGED
@@ -9,6 +9,7 @@ the [App Store Server API](https://developer.apple.com/documentation/appstoreser
9
9
  * [Request a Test Notification](https://developer.apple.com/documentation/appstoreserverapi/post-v1-notifications-test)
10
10
  * [Get Test Notification Status](https://developer.apple.com/documentation/appstoreserverapi/get-v1-notifications-test-_testnotificationtoken_)
11
11
  * [Get Transaction History](https://developer.apple.com/documentation/appstoreserverapi/get-v2-history-_transactionid_)
12
+ * [Get All Subscription Statuses](https://developer.apple.com/documentation/appstoreserverapi/get-v1-subscriptions-_transactionid_)
12
13
 
13
14
  ## Requirements
14
15
 
@@ -140,6 +141,29 @@ transactions = AppStoreServerApi::Utils::Decoder.decode_transactions(signed_tran
140
141
  data["signedTransactions"])
141
142
  ```
142
143
 
144
+ ### Get All Subscription Statuses
145
+
146
+ [Get All Subscription Statuses](https://developer.apple.com/documentation/appstoreserverapi/get-v1-subscriptions-_transactionid_)
147
+
148
+ Get the statuses for all of a customer’s auto-renewable subscriptions in your app.
149
+
150
+ ```ruby
151
+ # all statuses
152
+ data = client.get_all_subscription_statuses(transaction_id)
153
+
154
+ # filter by status
155
+ data = client.get_all_subscription_statuses(transaction_id, params:{status: 1})
156
+ ```
157
+
158
+ [The status of an auto-renewable subscription](https://developer.apple.com/documentation/appstoreserverapi/status)
159
+
160
+ status possible values:
161
+ * 1: The auto-renewable subscription is active.
162
+ * 2: The auto-renewable subscription is expired.
163
+ * 3: The auto-renewable subscription is in a billing retry period.
164
+ * 4: The auto-renewable subscription is in a Billing Grace Period.
165
+ * 5: The auto-renewable subscription is revoked. The App Store refunded the transaction or revoked it from Family Sharing.
166
+
143
167
  ## Error Handling
144
168
 
145
169
  ```ruby
@@ -6,6 +6,7 @@ require 'json'
6
6
  require 'openssl'
7
7
 
8
8
  module AppStoreServerApi
9
+
9
10
  class Client
10
11
  attr_reader :environment, :issuer_id, :key_id, :private_key, :bundle_id
11
12
 
@@ -78,12 +79,21 @@ module AppStoreServerApi
78
79
  # @param [String] transaction_id The identifier of a transaction
79
80
  # @param [Hash] params request params
80
81
  # @return [Hash] transaction history
81
- def get_transaction_history(transaction_id, params: {})
82
+ def get_transaction_history(transaction_id, params: nil)
82
83
  path = "/inApps/v2/history/#{transaction_id}"
83
84
  response = do_request(path, params: params)
84
85
  JSON.parse(response.body)
85
86
  end
86
87
 
88
+ # Get All Subscription Statuses
89
+ # @see https://developer.apple.com/documentation/appstoreserverapi/get-v1-subscriptions-_transactionid_
90
+ # @param [String] transaction_id The identifier of a transaction
91
+ def get_all_subscription_statuses(transaction_id, params: nil)
92
+ path = "/inApps/v1/subscriptions/#{transaction_id}"
93
+ response = do_request(path, params: params)
94
+ JSON.parse(response.body)
95
+ end
96
+
87
97
  # generate bearer token
88
98
  # @param issued_at [Time] issued at
89
99
  # @param expired_in [Integer] expired in seconds (max 3600)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module AppStoreServerApi
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_store_server_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - mingos
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-02-14 00:00:00.000000000 Z
10
+ date: 2025-02-19 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: jwt
@@ -71,7 +71,6 @@ files:
71
71
  - lib/app_store_server_api/utils/http_client.rb
72
72
  - lib/app_store_server_api/version.rb
73
73
  - lib/app_store_server_api_client.rb
74
- - lib/app_store_server_api_client.rb~
75
74
  - sig/app_store_server_api_client.rbs
76
75
  homepage: https://github.com/mingos/app-store-server-api-client
77
76
  licenses:
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'app_store_server_api/version'
4
- require_relative 'app_store_server_api/utils/decoder'
5
- require_relative 'app_store_server_api/utils/http_client'
6
- require_relative 'app_store_server_api/error'
7
- require_relative 'app_store_server_api/client'