zyphr 0.1.38 → 0.1.39
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 +2 -0
- data/docs/AuthRegistrationApi.md +72 -0
- data/docs/SignInWithGooglePlayGamesRequest.md +18 -0
- data/lib/zyphr/api/auth_registration_api.rb +68 -0
- data/lib/zyphr/models/sign_in_with_google_play_games_request.rb +238 -0
- data/lib/zyphr.rb +1 -0
- data/spec/api/auth_registration_api_spec.rb +12 -0
- data/spec/models/sign_in_with_google_play_games_request_spec.rb +36 -0
- data/zyphr.gemspec +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: af0784e6badcf3428abffcf5a6a88d0deb768baf45206e8edc15c811835eb7f7
|
|
4
|
+
data.tar.gz: 349dd9342bd68316b908ec87ef9464edccc460a5eafb240f0481a612ade70b83
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a5a4366857accac4b75f1d6a5de65304f3ef9bcc99302317f3f752ab3469a6ab30324427c9b64895cfe1d43ff80f1a5dd91027ed4e793785e0d0c18c0c6ce17e
|
|
7
|
+
data.tar.gz: 814bbbfb0880eb3dc482e83ac0c08cbd24ba73b9577d74b190569c0dd966ad0520ec68060e36566ef8c19d14f9c80ca0b477f1f1c886e15741d4f35e2c05ff56
|
data/README.md
CHANGED
|
@@ -189,6 +189,7 @@ Class | Method | HTTP request | Description
|
|
|
189
189
|
*Zyphr::AuthRegistrationApi* | [**register_end_user**](docs/AuthRegistrationApi.md#register_end_user) | **POST** /auth/users/register | Register a new end user
|
|
190
190
|
*Zyphr::AuthRegistrationApi* | [**sign_in_anonymously**](docs/AuthRegistrationApi.md#sign_in_anonymously) | **POST** /auth/users/anonymous | Sign in anonymously
|
|
191
191
|
*Zyphr::AuthRegistrationApi* | [**sign_in_with_game_center**](docs/AuthRegistrationApi.md#sign_in_with_game_center) | **POST** /auth/game-center | Sign in with Apple Game Center
|
|
192
|
+
*Zyphr::AuthRegistrationApi* | [**sign_in_with_google_play_games**](docs/AuthRegistrationApi.md#sign_in_with_google_play_games) | **POST** /auth/google-play-games | Sign in with Google Play Games Services
|
|
192
193
|
*Zyphr::AuthSessionsApi* | [**list_end_user_sessions**](docs/AuthSessionsApi.md#list_end_user_sessions) | **GET** /auth/sessions | List active sessions
|
|
193
194
|
*Zyphr::AuthSessionsApi* | [**refresh_end_user_token**](docs/AuthSessionsApi.md#refresh_end_user_token) | **POST** /auth/sessions/refresh | Refresh access token
|
|
194
195
|
*Zyphr::AuthSessionsApi* | [**revoke_all_end_user_sessions**](docs/AuthSessionsApi.md#revoke_all_end_user_sessions) | **POST** /auth/sessions/revoke-all | Revoke all sessions
|
|
@@ -662,6 +663,7 @@ Class | Method | HTTP request | Description
|
|
|
662
663
|
- [Zyphr::SetPreferencesRequestPreferencesInner](docs/SetPreferencesRequestPreferencesInner.md)
|
|
663
664
|
- [Zyphr::SignInAnonymouslyRequest](docs/SignInAnonymouslyRequest.md)
|
|
664
665
|
- [Zyphr::SignInWithGameCenterRequest](docs/SignInWithGameCenterRequest.md)
|
|
666
|
+
- [Zyphr::SignInWithGooglePlayGamesRequest](docs/SignInWithGooglePlayGamesRequest.md)
|
|
665
667
|
- [Zyphr::SlackMessage](docs/SlackMessage.md)
|
|
666
668
|
- [Zyphr::SlackMessageListResponse](docs/SlackMessageListResponse.md)
|
|
667
669
|
- [Zyphr::SlackMessageListResponseMeta](docs/SlackMessageListResponseMeta.md)
|
data/docs/AuthRegistrationApi.md
CHANGED
|
@@ -8,6 +8,7 @@ All URIs are relative to *https://api.zyphr.dev/v1*
|
|
|
8
8
|
| [**register_end_user**](AuthRegistrationApi.md#register_end_user) | **POST** /auth/users/register | Register a new end user |
|
|
9
9
|
| [**sign_in_anonymously**](AuthRegistrationApi.md#sign_in_anonymously) | **POST** /auth/users/anonymous | Sign in anonymously |
|
|
10
10
|
| [**sign_in_with_game_center**](AuthRegistrationApi.md#sign_in_with_game_center) | **POST** /auth/game-center | Sign in with Apple Game Center |
|
|
11
|
+
| [**sign_in_with_google_play_games**](AuthRegistrationApi.md#sign_in_with_google_play_games) | **POST** /auth/google-play-games | Sign in with Google Play Games Services |
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
## convert_anonymous_user
|
|
@@ -291,3 +292,74 @@ end
|
|
|
291
292
|
- **Content-Type**: application/json
|
|
292
293
|
- **Accept**: application/json
|
|
293
294
|
|
|
295
|
+
|
|
296
|
+
## sign_in_with_google_play_games
|
|
297
|
+
|
|
298
|
+
> <AuthResultResponse> sign_in_with_google_play_games(sign_in_with_google_play_games_request)
|
|
299
|
+
|
|
300
|
+
Sign in with Google Play Games Services
|
|
301
|
+
|
|
302
|
+
Exchange a Google Play Games Services (GPGS) **server auth code** for a Zyphr end-user session. Unlike Game Center (which submits an Apple-signed assertion), GPGS is verified by Google: Zyphr exchanges the single-use server auth code at Google's OAuth2 token endpoint, then calls the Play Games REST API (`players/me`) server-side to obtain the trusted, tamper-proof `playerId`. The user is provisioned-or-looked-up on that server-fetched `playerId` and tokens are minted. ## Producing the server auth code (Integration) The server auth code is obtained **on-device by the Android app** — there is no server-side way to mint it. The app calls `GamesSignInClient.requestServerSideAccess(serverClientId, …)` using the Google Cloud **web (server) client id** configured for the game, which returns a single-use auth code string. Submit that string here as `serverAuthCode`. The **backend-relayed** shape is the common one: the app forwards the auth code to the customer's own backend, which relays it to this endpoint; the app never holds Zyphr keys. ## Security The `playerId` is derived **only** from Zyphr's own server-side call to Google after the token exchange — a client-supplied player id is never accepted or trusted. On any verification failure the response is a single opaque `401` `invalid_auth_code`; the specific control that failed is never disclosed.
|
|
303
|
+
|
|
304
|
+
### Examples
|
|
305
|
+
|
|
306
|
+
```ruby
|
|
307
|
+
require 'time'
|
|
308
|
+
require 'zyphr'
|
|
309
|
+
# setup authorization
|
|
310
|
+
Zyphr.configure do |config|
|
|
311
|
+
# Configure API key authorization: ApplicationPublicKey
|
|
312
|
+
config.api_key['X-Application-Key'] = 'YOUR API KEY'
|
|
313
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
314
|
+
# config.api_key_prefix['X-Application-Key'] = 'Bearer'
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
api_instance = Zyphr::AuthRegistrationApi.new
|
|
318
|
+
sign_in_with_google_play_games_request = Zyphr::SignInWithGooglePlayGamesRequest.new({server_auth_code: 'server_auth_code_example'}) # SignInWithGooglePlayGamesRequest |
|
|
319
|
+
|
|
320
|
+
begin
|
|
321
|
+
# Sign in with Google Play Games Services
|
|
322
|
+
result = api_instance.sign_in_with_google_play_games(sign_in_with_google_play_games_request)
|
|
323
|
+
p result
|
|
324
|
+
rescue Zyphr::ApiError => e
|
|
325
|
+
puts "Error when calling AuthRegistrationApi->sign_in_with_google_play_games: #{e}"
|
|
326
|
+
end
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
#### Using the sign_in_with_google_play_games_with_http_info variant
|
|
330
|
+
|
|
331
|
+
This returns an Array which contains the response data, status code and headers.
|
|
332
|
+
|
|
333
|
+
> <Array(<AuthResultResponse>, Integer, Hash)> sign_in_with_google_play_games_with_http_info(sign_in_with_google_play_games_request)
|
|
334
|
+
|
|
335
|
+
```ruby
|
|
336
|
+
begin
|
|
337
|
+
# Sign in with Google Play Games Services
|
|
338
|
+
data, status_code, headers = api_instance.sign_in_with_google_play_games_with_http_info(sign_in_with_google_play_games_request)
|
|
339
|
+
p status_code # => 2xx
|
|
340
|
+
p headers # => { ... }
|
|
341
|
+
p data # => <AuthResultResponse>
|
|
342
|
+
rescue Zyphr::ApiError => e
|
|
343
|
+
puts "Error when calling AuthRegistrationApi->sign_in_with_google_play_games_with_http_info: #{e}"
|
|
344
|
+
end
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Parameters
|
|
348
|
+
|
|
349
|
+
| Name | Type | Description | Notes |
|
|
350
|
+
| ---- | ---- | ----------- | ----- |
|
|
351
|
+
| **sign_in_with_google_play_games_request** | [**SignInWithGooglePlayGamesRequest**](SignInWithGooglePlayGamesRequest.md) | | |
|
|
352
|
+
|
|
353
|
+
### Return type
|
|
354
|
+
|
|
355
|
+
[**AuthResultResponse**](AuthResultResponse.md)
|
|
356
|
+
|
|
357
|
+
### Authorization
|
|
358
|
+
|
|
359
|
+
[ApplicationPublicKey](../README.md#ApplicationPublicKey)
|
|
360
|
+
|
|
361
|
+
### HTTP request headers
|
|
362
|
+
|
|
363
|
+
- **Content-Type**: application/json
|
|
364
|
+
- **Accept**: application/json
|
|
365
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Zyphr::SignInWithGooglePlayGamesRequest
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **server_auth_code** | **String** | The single-use server auth code from GamesSignInClient.requestServerSideAccess (obtained with the game's web/server client id). Zyphr exchanges it server-side; a client-supplied player id is neither accepted nor trusted. | |
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
require 'zyphr'
|
|
13
|
+
|
|
14
|
+
instance = Zyphr::SignInWithGooglePlayGamesRequest.new(
|
|
15
|
+
server_auth_code: null
|
|
16
|
+
)
|
|
17
|
+
```
|
|
18
|
+
|
|
@@ -290,5 +290,73 @@ module Zyphr
|
|
|
290
290
|
end
|
|
291
291
|
return data, status_code, headers
|
|
292
292
|
end
|
|
293
|
+
|
|
294
|
+
# Sign in with Google Play Games Services
|
|
295
|
+
# Exchange a Google Play Games Services (GPGS) **server auth code** for a Zyphr end-user session. Unlike Game Center (which submits an Apple-signed assertion), GPGS is verified by Google: Zyphr exchanges the single-use server auth code at Google's OAuth2 token endpoint, then calls the Play Games REST API (`players/me`) server-side to obtain the trusted, tamper-proof `playerId`. The user is provisioned-or-looked-up on that server-fetched `playerId` and tokens are minted. ## Producing the server auth code (Integration) The server auth code is obtained **on-device by the Android app** — there is no server-side way to mint it. The app calls `GamesSignInClient.requestServerSideAccess(serverClientId, …)` using the Google Cloud **web (server) client id** configured for the game, which returns a single-use auth code string. Submit that string here as `serverAuthCode`. The **backend-relayed** shape is the common one: the app forwards the auth code to the customer's own backend, which relays it to this endpoint; the app never holds Zyphr keys. ## Security The `playerId` is derived **only** from Zyphr's own server-side call to Google after the token exchange — a client-supplied player id is never accepted or trusted. On any verification failure the response is a single opaque `401` `invalid_auth_code`; the specific control that failed is never disclosed.
|
|
296
|
+
# @param sign_in_with_google_play_games_request [SignInWithGooglePlayGamesRequest]
|
|
297
|
+
# @param [Hash] opts the optional parameters
|
|
298
|
+
# @return [AuthResultResponse]
|
|
299
|
+
def sign_in_with_google_play_games(sign_in_with_google_play_games_request, opts = {})
|
|
300
|
+
data, _status_code, _headers = sign_in_with_google_play_games_with_http_info(sign_in_with_google_play_games_request, opts)
|
|
301
|
+
data
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
# Sign in with Google Play Games Services
|
|
305
|
+
# Exchange a Google Play Games Services (GPGS) **server auth code** for a Zyphr end-user session. Unlike Game Center (which submits an Apple-signed assertion), GPGS is verified by Google: Zyphr exchanges the single-use server auth code at Google's OAuth2 token endpoint, then calls the Play Games REST API (`players/me`) server-side to obtain the trusted, tamper-proof `playerId`. The user is provisioned-or-looked-up on that server-fetched `playerId` and tokens are minted. ## Producing the server auth code (Integration) The server auth code is obtained **on-device by the Android app** — there is no server-side way to mint it. The app calls `GamesSignInClient.requestServerSideAccess(serverClientId, …)` using the Google Cloud **web (server) client id** configured for the game, which returns a single-use auth code string. Submit that string here as `serverAuthCode`. The **backend-relayed** shape is the common one: the app forwards the auth code to the customer's own backend, which relays it to this endpoint; the app never holds Zyphr keys. ## Security The `playerId` is derived **only** from Zyphr's own server-side call to Google after the token exchange — a client-supplied player id is never accepted or trusted. On any verification failure the response is a single opaque `401` `invalid_auth_code`; the specific control that failed is never disclosed.
|
|
306
|
+
# @param sign_in_with_google_play_games_request [SignInWithGooglePlayGamesRequest]
|
|
307
|
+
# @param [Hash] opts the optional parameters
|
|
308
|
+
# @return [Array<(AuthResultResponse, Integer, Hash)>] AuthResultResponse data, response status code and response headers
|
|
309
|
+
def sign_in_with_google_play_games_with_http_info(sign_in_with_google_play_games_request, opts = {})
|
|
310
|
+
if @api_client.config.debugging
|
|
311
|
+
@api_client.config.logger.debug 'Calling API: AuthRegistrationApi.sign_in_with_google_play_games ...'
|
|
312
|
+
end
|
|
313
|
+
# verify the required parameter 'sign_in_with_google_play_games_request' is set
|
|
314
|
+
if @api_client.config.client_side_validation && sign_in_with_google_play_games_request.nil?
|
|
315
|
+
fail ArgumentError, "Missing the required parameter 'sign_in_with_google_play_games_request' when calling AuthRegistrationApi.sign_in_with_google_play_games"
|
|
316
|
+
end
|
|
317
|
+
# resource path
|
|
318
|
+
local_var_path = '/auth/google-play-games'
|
|
319
|
+
|
|
320
|
+
# query parameters
|
|
321
|
+
query_params = opts[:query_params] || {}
|
|
322
|
+
|
|
323
|
+
# header parameters
|
|
324
|
+
header_params = opts[:header_params] || {}
|
|
325
|
+
# HTTP header 'Accept' (if needed)
|
|
326
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
327
|
+
# HTTP header 'Content-Type'
|
|
328
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
329
|
+
if !content_type.nil?
|
|
330
|
+
header_params['Content-Type'] = content_type
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
# form parameters
|
|
334
|
+
form_params = opts[:form_params] || {}
|
|
335
|
+
|
|
336
|
+
# http body (model)
|
|
337
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(sign_in_with_google_play_games_request)
|
|
338
|
+
|
|
339
|
+
# return_type
|
|
340
|
+
return_type = opts[:debug_return_type] || 'AuthResultResponse'
|
|
341
|
+
|
|
342
|
+
# auth_names
|
|
343
|
+
auth_names = opts[:debug_auth_names] || ['ApplicationPublicKey']
|
|
344
|
+
|
|
345
|
+
new_options = opts.merge(
|
|
346
|
+
:operation => :"AuthRegistrationApi.sign_in_with_google_play_games",
|
|
347
|
+
:header_params => header_params,
|
|
348
|
+
:query_params => query_params,
|
|
349
|
+
:form_params => form_params,
|
|
350
|
+
:body => post_body,
|
|
351
|
+
:auth_names => auth_names,
|
|
352
|
+
:return_type => return_type
|
|
353
|
+
)
|
|
354
|
+
|
|
355
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
356
|
+
if @api_client.config.debugging
|
|
357
|
+
@api_client.config.logger.debug "API called: AuthRegistrationApi#sign_in_with_google_play_games\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
358
|
+
end
|
|
359
|
+
return data, status_code, headers
|
|
360
|
+
end
|
|
293
361
|
end
|
|
294
362
|
end
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Zyphr API
|
|
3
|
+
|
|
4
|
+
#Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Account Sending Status Every authenticated response carries the account's current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: support@zyphr.dev
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.12.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module Zyphr
|
|
17
|
+
class SignInWithGooglePlayGamesRequest
|
|
18
|
+
# The single-use server auth code from GamesSignInClient.requestServerSideAccess (obtained with the game's web/server client id). Zyphr exchanges it server-side; a client-supplied player id is neither accepted nor trusted.
|
|
19
|
+
attr_accessor :server_auth_code
|
|
20
|
+
|
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
22
|
+
def self.attribute_map
|
|
23
|
+
{
|
|
24
|
+
:'server_auth_code' => :'serverAuthCode'
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Returns attribute mapping this model knows about
|
|
29
|
+
def self.acceptable_attribute_map
|
|
30
|
+
attribute_map
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Returns all the JSON keys this model knows about
|
|
34
|
+
def self.acceptable_attributes
|
|
35
|
+
acceptable_attribute_map.values
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Attribute type mapping.
|
|
39
|
+
def self.openapi_types
|
|
40
|
+
{
|
|
41
|
+
:'server_auth_code' => :'String'
|
|
42
|
+
}
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# List of attributes with nullable: true
|
|
46
|
+
def self.openapi_nullable
|
|
47
|
+
Set.new([
|
|
48
|
+
])
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Initializes the object
|
|
52
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
53
|
+
def initialize(attributes = {})
|
|
54
|
+
if (!attributes.is_a?(Hash))
|
|
55
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::SignInWithGooglePlayGamesRequest` initialize method"
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
59
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
60
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
61
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
62
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::SignInWithGooglePlayGamesRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
63
|
+
end
|
|
64
|
+
h[k.to_sym] = v
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if attributes.key?(:'server_auth_code')
|
|
68
|
+
self.server_auth_code = attributes[:'server_auth_code']
|
|
69
|
+
else
|
|
70
|
+
self.server_auth_code = nil
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
75
|
+
# @return Array for valid properties with the reasons
|
|
76
|
+
def list_invalid_properties
|
|
77
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
78
|
+
invalid_properties = Array.new
|
|
79
|
+
if @server_auth_code.nil?
|
|
80
|
+
invalid_properties.push('invalid value for "server_auth_code", server_auth_code cannot be nil.')
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
invalid_properties
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Check to see if the all the properties in the model are valid
|
|
87
|
+
# @return true if the model is valid
|
|
88
|
+
def valid?
|
|
89
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
90
|
+
return false if @server_auth_code.nil?
|
|
91
|
+
true
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Custom attribute writer method with validation
|
|
95
|
+
# @param [Object] server_auth_code Value to be assigned
|
|
96
|
+
def server_auth_code=(server_auth_code)
|
|
97
|
+
if server_auth_code.nil?
|
|
98
|
+
fail ArgumentError, 'server_auth_code cannot be nil'
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
@server_auth_code = server_auth_code
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Checks equality by comparing each attribute.
|
|
105
|
+
# @param [Object] Object to be compared
|
|
106
|
+
def ==(o)
|
|
107
|
+
return true if self.equal?(o)
|
|
108
|
+
self.class == o.class &&
|
|
109
|
+
server_auth_code == o.server_auth_code
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# @see the `==` method
|
|
113
|
+
# @param [Object] Object to be compared
|
|
114
|
+
def eql?(o)
|
|
115
|
+
self == o
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Calculates hash code according to all attributes.
|
|
119
|
+
# @return [Integer] Hash code
|
|
120
|
+
def hash
|
|
121
|
+
[server_auth_code].hash
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Builds the object from hash
|
|
125
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
126
|
+
# @return [Object] Returns the model itself
|
|
127
|
+
def self.build_from_hash(attributes)
|
|
128
|
+
return nil unless attributes.is_a?(Hash)
|
|
129
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
130
|
+
transformed_hash = {}
|
|
131
|
+
openapi_types.each_pair do |key, type|
|
|
132
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
133
|
+
transformed_hash["#{key}"] = nil
|
|
134
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
135
|
+
# check to ensure the input is an array given that the attribute
|
|
136
|
+
# is documented as an array but the input is not
|
|
137
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
138
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
139
|
+
end
|
|
140
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
141
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
new(transformed_hash)
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Deserializes the data based on type
|
|
148
|
+
# @param string type Data type
|
|
149
|
+
# @param string value Value to be deserialized
|
|
150
|
+
# @return [Object] Deserialized data
|
|
151
|
+
def self._deserialize(type, value)
|
|
152
|
+
case type.to_sym
|
|
153
|
+
when :Time
|
|
154
|
+
Time.parse(value)
|
|
155
|
+
when :Date
|
|
156
|
+
Date.parse(value)
|
|
157
|
+
when :String
|
|
158
|
+
value.to_s
|
|
159
|
+
when :Integer
|
|
160
|
+
value.to_i
|
|
161
|
+
when :Float
|
|
162
|
+
value.to_f
|
|
163
|
+
when :Boolean
|
|
164
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
165
|
+
true
|
|
166
|
+
else
|
|
167
|
+
false
|
|
168
|
+
end
|
|
169
|
+
when :Object
|
|
170
|
+
# generic object (usually a Hash), return directly
|
|
171
|
+
value
|
|
172
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
173
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
174
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
175
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
176
|
+
k_type = Regexp.last_match[:k_type]
|
|
177
|
+
v_type = Regexp.last_match[:v_type]
|
|
178
|
+
{}.tap do |hash|
|
|
179
|
+
value.each do |k, v|
|
|
180
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
else # model
|
|
184
|
+
# models (e.g. Pet) or oneOf
|
|
185
|
+
klass = Zyphr.const_get(type)
|
|
186
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# Returns the string representation of the object
|
|
191
|
+
# @return [String] String presentation of the object
|
|
192
|
+
def to_s
|
|
193
|
+
to_hash.to_s
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
197
|
+
# @return [Hash] Returns the object in the form of hash
|
|
198
|
+
def to_body
|
|
199
|
+
to_hash
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# Returns the object in the form of hash
|
|
203
|
+
# @return [Hash] Returns the object in the form of hash
|
|
204
|
+
def to_hash
|
|
205
|
+
hash = {}
|
|
206
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
207
|
+
value = self.send(attr)
|
|
208
|
+
if value.nil?
|
|
209
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
210
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
hash[param] = _to_hash(value)
|
|
214
|
+
end
|
|
215
|
+
hash
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
# Outputs non-array value in the form of hash
|
|
219
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
220
|
+
# @param [Object] value Any valid value
|
|
221
|
+
# @return [Hash] Returns the value in the form of hash
|
|
222
|
+
def _to_hash(value)
|
|
223
|
+
if value.is_a?(Array)
|
|
224
|
+
value.compact.map { |v| _to_hash(v) }
|
|
225
|
+
elsif value.is_a?(Hash)
|
|
226
|
+
{}.tap do |hash|
|
|
227
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
228
|
+
end
|
|
229
|
+
elsif value.respond_to? :to_hash
|
|
230
|
+
value.to_hash
|
|
231
|
+
else
|
|
232
|
+
value
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
end
|
data/lib/zyphr.rb
CHANGED
|
@@ -298,6 +298,7 @@ require 'zyphr/models/set_preferences_request'
|
|
|
298
298
|
require 'zyphr/models/set_preferences_request_preferences_inner'
|
|
299
299
|
require 'zyphr/models/sign_in_anonymously_request'
|
|
300
300
|
require 'zyphr/models/sign_in_with_game_center_request'
|
|
301
|
+
require 'zyphr/models/sign_in_with_google_play_games_request'
|
|
301
302
|
require 'zyphr/models/slack_message'
|
|
302
303
|
require 'zyphr/models/slack_message_list_response'
|
|
303
304
|
require 'zyphr/models/slack_message_list_response_meta'
|
|
@@ -80,4 +80,16 @@ describe 'AuthRegistrationApi' do
|
|
|
80
80
|
end
|
|
81
81
|
end
|
|
82
82
|
|
|
83
|
+
# unit tests for sign_in_with_google_play_games
|
|
84
|
+
# Sign in with Google Play Games Services
|
|
85
|
+
# Exchange a Google Play Games Services (GPGS) **server auth code** for a Zyphr end-user session. Unlike Game Center (which submits an Apple-signed assertion), GPGS is verified by Google: Zyphr exchanges the single-use server auth code at Google's OAuth2 token endpoint, then calls the Play Games REST API (`players/me`) server-side to obtain the trusted, tamper-proof `playerId`. The user is provisioned-or-looked-up on that server-fetched `playerId` and tokens are minted. ## Producing the server auth code (Integration) The server auth code is obtained **on-device by the Android app** — there is no server-side way to mint it. The app calls `GamesSignInClient.requestServerSideAccess(serverClientId, …)` using the Google Cloud **web (server) client id** configured for the game, which returns a single-use auth code string. Submit that string here as `serverAuthCode`. The **backend-relayed** shape is the common one: the app forwards the auth code to the customer's own backend, which relays it to this endpoint; the app never holds Zyphr keys. ## Security The `playerId` is derived **only** from Zyphr's own server-side call to Google after the token exchange — a client-supplied player id is never accepted or trusted. On any verification failure the response is a single opaque `401` `invalid_auth_code`; the specific control that failed is never disclosed.
|
|
86
|
+
# @param sign_in_with_google_play_games_request
|
|
87
|
+
# @param [Hash] opts the optional parameters
|
|
88
|
+
# @return [AuthResultResponse]
|
|
89
|
+
describe 'sign_in_with_google_play_games test' do
|
|
90
|
+
it 'should work' do
|
|
91
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
83
95
|
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Zyphr API
|
|
3
|
+
|
|
4
|
+
#Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Account Sending Status Every authenticated response carries the account's current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: support@zyphr.dev
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.12.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'spec_helper'
|
|
14
|
+
require 'json'
|
|
15
|
+
require 'date'
|
|
16
|
+
|
|
17
|
+
# Unit tests for Zyphr::SignInWithGooglePlayGamesRequest
|
|
18
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
|
19
|
+
# Please update as you see appropriate
|
|
20
|
+
describe Zyphr::SignInWithGooglePlayGamesRequest do
|
|
21
|
+
let(:instance) { Zyphr::SignInWithGooglePlayGamesRequest.new }
|
|
22
|
+
|
|
23
|
+
describe 'test an instance of SignInWithGooglePlayGamesRequest' do
|
|
24
|
+
it 'should create an instance of SignInWithGooglePlayGamesRequest' do
|
|
25
|
+
# uncomment below to test the instance creation
|
|
26
|
+
#expect(instance).to be_instance_of(Zyphr::SignInWithGooglePlayGamesRequest)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe 'test attribute "server_auth_code"' do
|
|
31
|
+
it 'should work' do
|
|
32
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
data/zyphr.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zyphr
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.39
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Zyphr
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-07-
|
|
11
|
+
date: 2026-07-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -393,6 +393,7 @@ files:
|
|
|
393
393
|
- docs/SetPreferencesRequestPreferencesInner.md
|
|
394
394
|
- docs/SignInAnonymouslyRequest.md
|
|
395
395
|
- docs/SignInWithGameCenterRequest.md
|
|
396
|
+
- docs/SignInWithGooglePlayGamesRequest.md
|
|
396
397
|
- docs/SlackApi.md
|
|
397
398
|
- docs/SlackMessage.md
|
|
398
399
|
- docs/SlackMessageListResponse.md
|
|
@@ -879,6 +880,7 @@ files:
|
|
|
879
880
|
- lib/zyphr/models/set_preferences_request_preferences_inner.rb
|
|
880
881
|
- lib/zyphr/models/sign_in_anonymously_request.rb
|
|
881
882
|
- lib/zyphr/models/sign_in_with_game_center_request.rb
|
|
883
|
+
- lib/zyphr/models/sign_in_with_google_play_games_request.rb
|
|
882
884
|
- lib/zyphr/models/slack_message.rb
|
|
883
885
|
- lib/zyphr/models/slack_message_list_response.rb
|
|
884
886
|
- lib/zyphr/models/slack_message_list_response_meta.rb
|
|
@@ -1349,6 +1351,7 @@ files:
|
|
|
1349
1351
|
- spec/models/set_preferences_request_spec.rb
|
|
1350
1352
|
- spec/models/sign_in_anonymously_request_spec.rb
|
|
1351
1353
|
- spec/models/sign_in_with_game_center_request_spec.rb
|
|
1354
|
+
- spec/models/sign_in_with_google_play_games_request_spec.rb
|
|
1352
1355
|
- spec/models/slack_message_list_response_meta_spec.rb
|
|
1353
1356
|
- spec/models/slack_message_list_response_spec.rb
|
|
1354
1357
|
- spec/models/slack_message_response_spec.rb
|
|
@@ -1825,6 +1828,7 @@ test_files:
|
|
|
1825
1828
|
- spec/models/web_authn_status_response_data_spec.rb
|
|
1826
1829
|
- spec/models/consent_status_response_spec.rb
|
|
1827
1830
|
- spec/models/auth_email_template_preview_result_spec.rb
|
|
1831
|
+
- spec/models/sign_in_with_google_play_games_request_spec.rb
|
|
1828
1832
|
- spec/models/send_email_response_spec.rb
|
|
1829
1833
|
- spec/models/webhook_circuit_state_response_spec.rb
|
|
1830
1834
|
- spec/models/switch_organization_request_spec.rb
|