zyphr 0.1.37 → 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 +16 -1
- data/docs/AuthOAuthApi.md +12 -12
- data/docs/AuthRegistrationApi.md +145 -1
- data/docs/AuthUserDirectoryApi.md +627 -0
- data/docs/AuthUserProfileApi.md +0 -76
- data/docs/InviteEndUserRequest.md +26 -0
- data/docs/OAuthProviderName.md +15 -0
- data/docs/SetEndUserClaimsRequest.md +18 -0
- data/docs/SignInAnonymouslyRequest.md +5 -1
- data/docs/SignInWithGameCenterRequest.md +28 -0
- data/docs/SignInWithGooglePlayGamesRequest.md +18 -0
- data/docs/UpdateEndUserByApplicationRequest.md +26 -0
- data/lib/zyphr/api/auth_o_auth_api.rb +12 -12
- data/lib/zyphr/api/auth_registration_api.rb +138 -2
- data/lib/zyphr/api/auth_user_directory_api.rb +560 -0
- data/lib/zyphr/api/auth_user_profile_api.rb +0 -61
- data/lib/zyphr/models/invite_end_user_request.rb +309 -0
- data/lib/zyphr/models/o_auth_provider_name.rb +43 -0
- data/lib/zyphr/models/set_end_user_claims_request.rb +220 -0
- data/lib/zyphr/models/sign_in_anonymously_request.rb +43 -4
- data/lib/zyphr/models/sign_in_with_game_center_request.rb +373 -0
- data/lib/zyphr/models/sign_in_with_google_play_games_request.rb +238 -0
- data/lib/zyphr/models/update_end_user_by_application_request.rb +256 -0
- data/lib/zyphr.rb +7 -0
- data/spec/api/auth_registration_api_spec.rb +25 -1
- data/spec/api/auth_user_directory_api_spec.rb +136 -0
- data/spec/api/auth_user_profile_api_spec.rb +0 -12
- data/spec/models/invite_end_user_request_spec.rb +64 -0
- data/spec/models/o_auth_provider_name_spec.rb +30 -0
- data/spec/models/set_end_user_claims_request_spec.rb +36 -0
- data/spec/models/sign_in_anonymously_request_spec.rb +12 -0
- data/spec/models/sign_in_with_game_center_request_spec.rb +66 -0
- data/spec/models/sign_in_with_google_play_games_request_spec.rb +36 -0
- data/spec/models/update_end_user_by_application_request_spec.rb +60 -0
- data/zyphr.gemspec +1 -1
- metadata +450 -422
|
@@ -0,0 +1,373 @@
|
|
|
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 SignInWithGameCenterRequest
|
|
18
|
+
# The modern scoped gamePlayerID from GKLocalPlayer (NOT the deprecated legacy playerID).
|
|
19
|
+
attr_accessor :player_id
|
|
20
|
+
|
|
21
|
+
# Apple-supplied URL to the public-key certificate. Must be https on an apple.com host; server-side SSRF-guarded before fetch.
|
|
22
|
+
attr_accessor :public_key_url
|
|
23
|
+
|
|
24
|
+
# Base64-encoded RSA signature returned by GameKit.
|
|
25
|
+
attr_accessor :signature
|
|
26
|
+
|
|
27
|
+
# Base64-encoded salt bytes returned by GameKit.
|
|
28
|
+
attr_accessor :salt
|
|
29
|
+
|
|
30
|
+
# Apple-supplied timestamp (epoch milliseconds) returned by GameKit.
|
|
31
|
+
attr_accessor :timestamp
|
|
32
|
+
|
|
33
|
+
# The iOS bundle identifier the assertion was generated for. Must match a bundle id configured on the application's Game Center provider.
|
|
34
|
+
attr_accessor :bundle_id
|
|
35
|
+
|
|
36
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
37
|
+
def self.attribute_map
|
|
38
|
+
{
|
|
39
|
+
:'player_id' => :'playerId',
|
|
40
|
+
:'public_key_url' => :'publicKeyUrl',
|
|
41
|
+
:'signature' => :'signature',
|
|
42
|
+
:'salt' => :'salt',
|
|
43
|
+
:'timestamp' => :'timestamp',
|
|
44
|
+
:'bundle_id' => :'bundleId'
|
|
45
|
+
}
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Returns attribute mapping this model knows about
|
|
49
|
+
def self.acceptable_attribute_map
|
|
50
|
+
attribute_map
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Returns all the JSON keys this model knows about
|
|
54
|
+
def self.acceptable_attributes
|
|
55
|
+
acceptable_attribute_map.values
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Attribute type mapping.
|
|
59
|
+
def self.openapi_types
|
|
60
|
+
{
|
|
61
|
+
:'player_id' => :'String',
|
|
62
|
+
:'public_key_url' => :'String',
|
|
63
|
+
:'signature' => :'String',
|
|
64
|
+
:'salt' => :'String',
|
|
65
|
+
:'timestamp' => :'Float',
|
|
66
|
+
:'bundle_id' => :'String'
|
|
67
|
+
}
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# List of attributes with nullable: true
|
|
71
|
+
def self.openapi_nullable
|
|
72
|
+
Set.new([
|
|
73
|
+
])
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Initializes the object
|
|
77
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
78
|
+
def initialize(attributes = {})
|
|
79
|
+
if (!attributes.is_a?(Hash))
|
|
80
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::SignInWithGameCenterRequest` initialize method"
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
84
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
85
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
86
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
87
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::SignInWithGameCenterRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
88
|
+
end
|
|
89
|
+
h[k.to_sym] = v
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if attributes.key?(:'player_id')
|
|
93
|
+
self.player_id = attributes[:'player_id']
|
|
94
|
+
else
|
|
95
|
+
self.player_id = nil
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
if attributes.key?(:'public_key_url')
|
|
99
|
+
self.public_key_url = attributes[:'public_key_url']
|
|
100
|
+
else
|
|
101
|
+
self.public_key_url = nil
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
if attributes.key?(:'signature')
|
|
105
|
+
self.signature = attributes[:'signature']
|
|
106
|
+
else
|
|
107
|
+
self.signature = nil
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
if attributes.key?(:'salt')
|
|
111
|
+
self.salt = attributes[:'salt']
|
|
112
|
+
else
|
|
113
|
+
self.salt = nil
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
if attributes.key?(:'timestamp')
|
|
117
|
+
self.timestamp = attributes[:'timestamp']
|
|
118
|
+
else
|
|
119
|
+
self.timestamp = nil
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if attributes.key?(:'bundle_id')
|
|
123
|
+
self.bundle_id = attributes[:'bundle_id']
|
|
124
|
+
else
|
|
125
|
+
self.bundle_id = nil
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
130
|
+
# @return Array for valid properties with the reasons
|
|
131
|
+
def list_invalid_properties
|
|
132
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
133
|
+
invalid_properties = Array.new
|
|
134
|
+
if @player_id.nil?
|
|
135
|
+
invalid_properties.push('invalid value for "player_id", player_id cannot be nil.')
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
if @public_key_url.nil?
|
|
139
|
+
invalid_properties.push('invalid value for "public_key_url", public_key_url cannot be nil.')
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
if @signature.nil?
|
|
143
|
+
invalid_properties.push('invalid value for "signature", signature cannot be nil.')
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
if @salt.nil?
|
|
147
|
+
invalid_properties.push('invalid value for "salt", salt cannot be nil.')
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
if @timestamp.nil?
|
|
151
|
+
invalid_properties.push('invalid value for "timestamp", timestamp cannot be nil.')
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
if @bundle_id.nil?
|
|
155
|
+
invalid_properties.push('invalid value for "bundle_id", bundle_id cannot be nil.')
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
invalid_properties
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Check to see if the all the properties in the model are valid
|
|
162
|
+
# @return true if the model is valid
|
|
163
|
+
def valid?
|
|
164
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
165
|
+
return false if @player_id.nil?
|
|
166
|
+
return false if @public_key_url.nil?
|
|
167
|
+
return false if @signature.nil?
|
|
168
|
+
return false if @salt.nil?
|
|
169
|
+
return false if @timestamp.nil?
|
|
170
|
+
return false if @bundle_id.nil?
|
|
171
|
+
true
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Custom attribute writer method with validation
|
|
175
|
+
# @param [Object] player_id Value to be assigned
|
|
176
|
+
def player_id=(player_id)
|
|
177
|
+
if player_id.nil?
|
|
178
|
+
fail ArgumentError, 'player_id cannot be nil'
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
@player_id = player_id
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Custom attribute writer method with validation
|
|
185
|
+
# @param [Object] public_key_url Value to be assigned
|
|
186
|
+
def public_key_url=(public_key_url)
|
|
187
|
+
if public_key_url.nil?
|
|
188
|
+
fail ArgumentError, 'public_key_url cannot be nil'
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
@public_key_url = public_key_url
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# Custom attribute writer method with validation
|
|
195
|
+
# @param [Object] signature Value to be assigned
|
|
196
|
+
def signature=(signature)
|
|
197
|
+
if signature.nil?
|
|
198
|
+
fail ArgumentError, 'signature cannot be nil'
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
@signature = signature
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# Custom attribute writer method with validation
|
|
205
|
+
# @param [Object] salt Value to be assigned
|
|
206
|
+
def salt=(salt)
|
|
207
|
+
if salt.nil?
|
|
208
|
+
fail ArgumentError, 'salt cannot be nil'
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
@salt = salt
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# Custom attribute writer method with validation
|
|
215
|
+
# @param [Object] timestamp Value to be assigned
|
|
216
|
+
def timestamp=(timestamp)
|
|
217
|
+
if timestamp.nil?
|
|
218
|
+
fail ArgumentError, 'timestamp cannot be nil'
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
@timestamp = timestamp
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# Custom attribute writer method with validation
|
|
225
|
+
# @param [Object] bundle_id Value to be assigned
|
|
226
|
+
def bundle_id=(bundle_id)
|
|
227
|
+
if bundle_id.nil?
|
|
228
|
+
fail ArgumentError, 'bundle_id cannot be nil'
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
@bundle_id = bundle_id
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
# Checks equality by comparing each attribute.
|
|
235
|
+
# @param [Object] Object to be compared
|
|
236
|
+
def ==(o)
|
|
237
|
+
return true if self.equal?(o)
|
|
238
|
+
self.class == o.class &&
|
|
239
|
+
player_id == o.player_id &&
|
|
240
|
+
public_key_url == o.public_key_url &&
|
|
241
|
+
signature == o.signature &&
|
|
242
|
+
salt == o.salt &&
|
|
243
|
+
timestamp == o.timestamp &&
|
|
244
|
+
bundle_id == o.bundle_id
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
# @see the `==` method
|
|
248
|
+
# @param [Object] Object to be compared
|
|
249
|
+
def eql?(o)
|
|
250
|
+
self == o
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
# Calculates hash code according to all attributes.
|
|
254
|
+
# @return [Integer] Hash code
|
|
255
|
+
def hash
|
|
256
|
+
[player_id, public_key_url, signature, salt, timestamp, bundle_id].hash
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# Builds the object from hash
|
|
260
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
261
|
+
# @return [Object] Returns the model itself
|
|
262
|
+
def self.build_from_hash(attributes)
|
|
263
|
+
return nil unless attributes.is_a?(Hash)
|
|
264
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
265
|
+
transformed_hash = {}
|
|
266
|
+
openapi_types.each_pair do |key, type|
|
|
267
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
268
|
+
transformed_hash["#{key}"] = nil
|
|
269
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
270
|
+
# check to ensure the input is an array given that the attribute
|
|
271
|
+
# is documented as an array but the input is not
|
|
272
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
273
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
274
|
+
end
|
|
275
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
276
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
277
|
+
end
|
|
278
|
+
end
|
|
279
|
+
new(transformed_hash)
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# Deserializes the data based on type
|
|
283
|
+
# @param string type Data type
|
|
284
|
+
# @param string value Value to be deserialized
|
|
285
|
+
# @return [Object] Deserialized data
|
|
286
|
+
def self._deserialize(type, value)
|
|
287
|
+
case type.to_sym
|
|
288
|
+
when :Time
|
|
289
|
+
Time.parse(value)
|
|
290
|
+
when :Date
|
|
291
|
+
Date.parse(value)
|
|
292
|
+
when :String
|
|
293
|
+
value.to_s
|
|
294
|
+
when :Integer
|
|
295
|
+
value.to_i
|
|
296
|
+
when :Float
|
|
297
|
+
value.to_f
|
|
298
|
+
when :Boolean
|
|
299
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
300
|
+
true
|
|
301
|
+
else
|
|
302
|
+
false
|
|
303
|
+
end
|
|
304
|
+
when :Object
|
|
305
|
+
# generic object (usually a Hash), return directly
|
|
306
|
+
value
|
|
307
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
308
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
309
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
310
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
311
|
+
k_type = Regexp.last_match[:k_type]
|
|
312
|
+
v_type = Regexp.last_match[:v_type]
|
|
313
|
+
{}.tap do |hash|
|
|
314
|
+
value.each do |k, v|
|
|
315
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
316
|
+
end
|
|
317
|
+
end
|
|
318
|
+
else # model
|
|
319
|
+
# models (e.g. Pet) or oneOf
|
|
320
|
+
klass = Zyphr.const_get(type)
|
|
321
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
322
|
+
end
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
# Returns the string representation of the object
|
|
326
|
+
# @return [String] String presentation of the object
|
|
327
|
+
def to_s
|
|
328
|
+
to_hash.to_s
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
332
|
+
# @return [Hash] Returns the object in the form of hash
|
|
333
|
+
def to_body
|
|
334
|
+
to_hash
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
# Returns the object in the form of hash
|
|
338
|
+
# @return [Hash] Returns the object in the form of hash
|
|
339
|
+
def to_hash
|
|
340
|
+
hash = {}
|
|
341
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
342
|
+
value = self.send(attr)
|
|
343
|
+
if value.nil?
|
|
344
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
345
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
hash[param] = _to_hash(value)
|
|
349
|
+
end
|
|
350
|
+
hash
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
# Outputs non-array value in the form of hash
|
|
354
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
355
|
+
# @param [Object] value Any valid value
|
|
356
|
+
# @return [Hash] Returns the value in the form of hash
|
|
357
|
+
def _to_hash(value)
|
|
358
|
+
if value.is_a?(Array)
|
|
359
|
+
value.compact.map { |v| _to_hash(v) }
|
|
360
|
+
elsif value.is_a?(Hash)
|
|
361
|
+
{}.tap do |hash|
|
|
362
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
363
|
+
end
|
|
364
|
+
elsif value.respond_to? :to_hash
|
|
365
|
+
value.to_hash
|
|
366
|
+
else
|
|
367
|
+
value
|
|
368
|
+
end
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
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
|