phrase 1.0.6 → 1.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -3
- data/docs/BranchName.md +17 -0
- data/docs/Invitation.md +5 -1
- data/docs/InvitationCreateParameters.md +4 -0
- data/docs/InvitationUpdateParameters.md +4 -0
- data/docs/Job.md +5 -3
- data/docs/JobDetails.md +4 -2
- data/docs/JobLocale.md +3 -1
- data/docs/LocalesApi.md +2 -0
- data/docs/Member.md +7 -1
- data/docs/MemberProjectDetail.md +35 -0
- data/docs/MemberProjectDetailProjectRoles.md +19 -0
- data/docs/MemberSpaces.md +25 -0
- data/docs/MemberUpdateParameters.md +4 -0
- data/docs/MemberUpdateSettingsParameters.md +19 -0
- data/docs/MembersApi.md +66 -0
- data/docs/ScreenshotsApi.md +3 -1
- data/docs/Webhook.md +2 -0
- data/docs/WebhookCreateParameters.md +5 -1
- data/docs/WebhookUpdateParameters.md +5 -1
- data/lib/phrase.rb +5 -0
- data/lib/phrase/api/locales_api.rb +3 -0
- data/lib/phrase/api/members_api.rb +80 -0
- data/lib/phrase/api/screenshots_api.rb +3 -0
- data/lib/phrase/api_client.rb +2 -0
- data/lib/phrase/models/branch_name.rb +194 -0
- data/lib/phrase/models/invitation.rb +26 -4
- data/lib/phrase/models/invitation_create_parameters.rb +25 -1
- data/lib/phrase/models/invitation_update_parameters.rb +25 -1
- data/lib/phrase/models/job.rb +22 -13
- data/lib/phrase/models/job_details.rb +19 -10
- data/lib/phrase/models/job_locale.rb +13 -4
- data/lib/phrase/models/member.rb +35 -4
- data/lib/phrase/models/member_project_detail.rb +285 -0
- data/lib/phrase/models/member_project_detail_project_roles.rb +203 -0
- data/lib/phrase/models/member_spaces.rb +230 -0
- data/lib/phrase/models/member_update_parameters.rb +25 -1
- data/lib/phrase/models/member_update_settings_parameters.rb +207 -0
- data/lib/phrase/models/webhook.rb +10 -1
- data/lib/phrase/models/webhook_create_parameters.rb +24 -4
- data/lib/phrase/models/webhook_update_parameters.rb +24 -4
- data/lib/phrase/version.rb +1 -1
- data/spec/api/locales_api_spec.rb +1 -0
- data/spec/api/members_api_spec.rb +15 -0
- data/spec/api/screenshots_api_spec.rb +1 -0
- data/spec/models/branch_name_spec.rb +29 -0
- data/spec/models/invitation_create_parameters_spec.rb +12 -0
- data/spec/models/invitation_spec.rb +12 -0
- data/spec/models/invitation_update_parameters_spec.rb +12 -0
- data/spec/models/job_details_spec.rb +9 -3
- data/spec/models/job_locale_spec.rb +6 -0
- data/spec/models/job_spec.rb +9 -3
- data/spec/models/member_project_detail_project_roles_spec.rb +35 -0
- data/spec/models/member_project_detail_spec.rb +83 -0
- data/spec/models/member_spaces_spec.rb +53 -0
- data/spec/models/member_spec.rb +18 -0
- data/spec/models/member_update_parameters_spec.rb +12 -0
- data/spec/models/member_update_settings_parameters_spec.rb +35 -0
- data/spec/models/webhook_create_parameters_spec.rb +12 -0
- data/spec/models/webhook_spec.rb +6 -0
- data/spec/models/webhook_update_parameters_spec.rb +12 -0
- metadata +182 -162
data/docs/ScreenshotsApi.md
CHANGED
@@ -294,7 +294,8 @@ project_id = 'project_id_example' # String | Project ID
|
|
294
294
|
opts = {
|
295
295
|
x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional)
|
296
296
|
page: 1, # Integer | Page number
|
297
|
-
per_page: 25 # Integer | allows you to specify a page size up to 100 items, 25 by default
|
297
|
+
per_page: 25, # Integer | allows you to specify a page size up to 100 items, 25 by default
|
298
|
+
key_id: 'abcd1234cdef1234abcd1234cdef1234' # String | filter by key
|
298
299
|
}
|
299
300
|
|
300
301
|
begin
|
@@ -315,6 +316,7 @@ Name | Type | Description | Notes
|
|
315
316
|
**x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional]
|
316
317
|
**page** | **Integer**| Page number | [optional]
|
317
318
|
**per_page** | **Integer**| allows you to specify a page size up to 100 items, 25 by default | [optional]
|
319
|
+
**key_id** | **String**| filter by key | [optional]
|
318
320
|
|
319
321
|
### Return type
|
320
322
|
|
data/docs/Webhook.md
CHANGED
@@ -9,6 +9,7 @@ Name | Type | Description | Notes
|
|
9
9
|
**description** | **String** | | [optional]
|
10
10
|
**events** | **Array<String>** | | [optional]
|
11
11
|
**active** | **Boolean** | | [optional]
|
12
|
+
**include_branches** | **Boolean** | | [optional]
|
12
13
|
**created_at** | **DateTime** | | [optional]
|
13
14
|
**updated_at** | **DateTime** | | [optional]
|
14
15
|
|
@@ -22,6 +23,7 @@ instance = Phrase::Webhook.new(id: null,
|
|
22
23
|
description: null,
|
23
24
|
events: null,
|
24
25
|
active: null,
|
26
|
+
include_branches: null,
|
25
27
|
created_at: null,
|
26
28
|
updated_at: null)
|
27
29
|
```
|
@@ -5,9 +5,11 @@
|
|
5
5
|
Name | Type | Description | Notes
|
6
6
|
------------ | ------------- | ------------- | -------------
|
7
7
|
**callback_url** | **String** | Callback URL to send requests to | [optional]
|
8
|
+
**secret** | **String** | Webhook secret used to calculate signature. If empty, the default project secret will be used. | [optional]
|
8
9
|
**description** | **String** | Webhook description | [optional]
|
9
10
|
**events** | **String** | List of event names to trigger the webhook (separated by comma) | [optional]
|
10
11
|
**active** | **Boolean** | Whether webhook is active or inactive | [optional]
|
12
|
+
**include_branches** | **Boolean** | If enabled, webhook will also be triggered for events from branches of the project specified. | [optional]
|
11
13
|
|
12
14
|
## Code Sample
|
13
15
|
|
@@ -15,9 +17,11 @@ Name | Type | Description | Notes
|
|
15
17
|
require 'Phrase'
|
16
18
|
|
17
19
|
instance = Phrase::WebhookCreateParameters.new(callback_url: http://example.com/hooks/phraseapp-notifications,
|
20
|
+
secret: secr3t,
|
18
21
|
description: My webhook for chat notifications,
|
19
22
|
events: locales:create,translations:update,
|
20
|
-
active: null
|
23
|
+
active: null,
|
24
|
+
include_branches: null)
|
21
25
|
```
|
22
26
|
|
23
27
|
|
@@ -5,9 +5,11 @@
|
|
5
5
|
Name | Type | Description | Notes
|
6
6
|
------------ | ------------- | ------------- | -------------
|
7
7
|
**callback_url** | **String** | Callback URL to send requests to | [optional]
|
8
|
+
**secret** | **String** | Webhook secret used to calculate signature. If empty, the default project secret will be used. | [optional]
|
8
9
|
**description** | **String** | Webhook description | [optional]
|
9
10
|
**events** | **String** | List of event names to trigger the webhook (separated by comma) | [optional]
|
10
11
|
**active** | **Boolean** | Whether webhook is active or inactive | [optional]
|
12
|
+
**include_branches** | **Boolean** | If enabled, webhook will also be triggered for events from branches of the project specified. | [optional]
|
11
13
|
|
12
14
|
## Code Sample
|
13
15
|
|
@@ -15,9 +17,11 @@ Name | Type | Description | Notes
|
|
15
17
|
require 'Phrase'
|
16
18
|
|
17
19
|
instance = Phrase::WebhookUpdateParameters.new(callback_url: http://example.com/hooks/phraseapp-notifications,
|
20
|
+
secret: secr3t,
|
18
21
|
description: My webhook for chat notifications,
|
19
22
|
events: locales:create,translations:update,
|
20
|
-
active: null
|
23
|
+
active: null,
|
24
|
+
include_branches: null)
|
21
25
|
```
|
22
26
|
|
23
27
|
|
data/lib/phrase.rb
CHANGED
@@ -28,6 +28,7 @@ require 'phrase/models/blacklisted_key_update_parameters'
|
|
28
28
|
require 'phrase/models/branch'
|
29
29
|
require 'phrase/models/branch_create_parameters'
|
30
30
|
require 'phrase/models/branch_merge_parameters'
|
31
|
+
require 'phrase/models/branch_name'
|
31
32
|
require 'phrase/models/branch_update_parameters'
|
32
33
|
require 'phrase/models/comment'
|
33
34
|
require 'phrase/models/comment_create_parameters'
|
@@ -89,7 +90,11 @@ require 'phrase/models/locale_preview'
|
|
89
90
|
require 'phrase/models/locale_statistics'
|
90
91
|
require 'phrase/models/locale_update_parameters'
|
91
92
|
require 'phrase/models/member'
|
93
|
+
require 'phrase/models/member_project_detail'
|
94
|
+
require 'phrase/models/member_project_detail_project_roles'
|
95
|
+
require 'phrase/models/member_spaces'
|
92
96
|
require 'phrase/models/member_update_parameters'
|
97
|
+
require 'phrase/models/member_update_settings_parameters'
|
93
98
|
require 'phrase/models/order_confirm_parameters'
|
94
99
|
require 'phrase/models/order_create_parameters'
|
95
100
|
require 'phrase/models/project'
|
@@ -165,6 +165,7 @@ module Phrase
|
|
165
165
|
# @option opts [String] :tags Limit results to keys tagged with a list of comma separated tag names.
|
166
166
|
# @option opts [String] :tag Limit download to tagged keys. This parameter is deprecated. Please use the \"tags\" parameter instead
|
167
167
|
# @option opts [Boolean] :include_empty_translations Indicates whether keys without translations should be included in the output as well.
|
168
|
+
# @option opts [Boolean] :exclude_empty_zero_forms Indicates whether zero forms should be included when empty in pluralized keys.
|
168
169
|
# @option opts [Boolean] :include_translated_keys Include translated keys in the locale file. Use in combination with include_empty_translations to obtain only untranslated keys.
|
169
170
|
# @option opts [Boolean] :keep_notranslate_tags Indicates whether [NOTRANSLATE] tags should be kept.
|
170
171
|
# @option opts [Boolean] :convert_emoji This option is obsolete. Projects that were created on or after Nov 29th 2019 or that did not contain emoji by then will not require this flag any longer since emoji are now supported natively.
|
@@ -191,6 +192,7 @@ module Phrase
|
|
191
192
|
# @option opts [String] :tags Limit results to keys tagged with a list of comma separated tag names.
|
192
193
|
# @option opts [String] :tag Limit download to tagged keys. This parameter is deprecated. Please use the \"tags\" parameter instead
|
193
194
|
# @option opts [Boolean] :include_empty_translations Indicates whether keys without translations should be included in the output as well.
|
195
|
+
# @option opts [Boolean] :exclude_empty_zero_forms Indicates whether zero forms should be included when empty in pluralized keys.
|
194
196
|
# @option opts [Boolean] :include_translated_keys Include translated keys in the locale file. Use in combination with include_empty_translations to obtain only untranslated keys.
|
195
197
|
# @option opts [Boolean] :keep_notranslate_tags Indicates whether [NOTRANSLATE] tags should be kept.
|
196
198
|
# @option opts [Boolean] :convert_emoji This option is obsolete. Projects that were created on or after Nov 29th 2019 or that did not contain emoji by then will not require this flag any longer since emoji are now supported natively.
|
@@ -223,6 +225,7 @@ module Phrase
|
|
223
225
|
query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?
|
224
226
|
query_params[:'tag'] = opts[:'tag'] if !opts[:'tag'].nil?
|
225
227
|
query_params[:'include_empty_translations'] = opts[:'include_empty_translations'] if !opts[:'include_empty_translations'].nil?
|
228
|
+
query_params[:'exclude_empty_zero_forms'] = opts[:'exclude_empty_zero_forms'] if !opts[:'exclude_empty_zero_forms'].nil?
|
226
229
|
query_params[:'include_translated_keys'] = opts[:'include_translated_keys'] if !opts[:'include_translated_keys'].nil?
|
227
230
|
query_params[:'keep_notranslate_tags'] = opts[:'keep_notranslate_tags'] if !opts[:'keep_notranslate_tags'].nil?
|
228
231
|
query_params[:'convert_emoji'] = opts[:'convert_emoji'] if !opts[:'convert_emoji'].nil?
|
@@ -229,6 +229,86 @@ module Phrase
|
|
229
229
|
return response, status_code, headers
|
230
230
|
end
|
231
231
|
|
232
|
+
# Update a member's project settings
|
233
|
+
# Update user settings in the project. Access token scope must include <code>team.manage</code>.
|
234
|
+
# @param project_id [String] Project ID
|
235
|
+
# @param id [String] ID
|
236
|
+
# @param member_update_settings_parameters [MemberUpdateSettingsParameters]
|
237
|
+
# @param [Hash] opts the optional parameters
|
238
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
239
|
+
# @return [MemberProjectDetail]
|
240
|
+
def member_update_settings(project_id, id, member_update_settings_parameters, opts = {})
|
241
|
+
data, _status_code, _headers = member_update_settings_with_http_info(project_id, id, member_update_settings_parameters, opts)
|
242
|
+
data
|
243
|
+
end
|
244
|
+
|
245
|
+
# Update a member's project settings
|
246
|
+
# Update user settings in the project. Access token scope must include <code>team.manage</code>.
|
247
|
+
# @param project_id [String] Project ID
|
248
|
+
# @param id [String] ID
|
249
|
+
# @param member_update_settings_parameters [MemberUpdateSettingsParameters]
|
250
|
+
# @param [Hash] opts the optional parameters
|
251
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
252
|
+
# @return [Array<(Response<(MemberProjectDetail)>, Integer, Hash)>] Response<(MemberProjectDetail)> data, response status code and response headers
|
253
|
+
def member_update_settings_with_http_info(project_id, id, member_update_settings_parameters, opts = {})
|
254
|
+
if @api_client.config.debugging
|
255
|
+
@api_client.config.logger.debug 'Calling API: MembersApi.member_update_settings ...'
|
256
|
+
end
|
257
|
+
# verify the required parameter 'project_id' is set
|
258
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
259
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling MembersApi.member_update_settings"
|
260
|
+
end
|
261
|
+
# verify the required parameter 'id' is set
|
262
|
+
if @api_client.config.client_side_validation && id.nil?
|
263
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling MembersApi.member_update_settings"
|
264
|
+
end
|
265
|
+
# verify the required parameter 'member_update_settings_parameters' is set
|
266
|
+
if @api_client.config.client_side_validation && member_update_settings_parameters.nil?
|
267
|
+
fail ArgumentError, "Missing the required parameter 'member_update_settings_parameters' when calling MembersApi.member_update_settings"
|
268
|
+
end
|
269
|
+
# resource path
|
270
|
+
local_var_path = '/projects/{project_id}/members/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
271
|
+
|
272
|
+
# query parameters
|
273
|
+
query_params = opts[:query_params] || {}
|
274
|
+
|
275
|
+
# header parameters
|
276
|
+
header_params = opts[:header_params] || {}
|
277
|
+
# HTTP header 'Accept' (if needed)
|
278
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
279
|
+
# HTTP header 'Content-Type'
|
280
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
281
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
282
|
+
|
283
|
+
# form parameters
|
284
|
+
form_params = opts[:form_params] || {}
|
285
|
+
|
286
|
+
# http body (model)
|
287
|
+
post_body = opts[:body] || @api_client.object_to_http_body(member_update_settings_parameters)
|
288
|
+
|
289
|
+
# return_type
|
290
|
+
return_type = opts[:return_type] || 'MemberProjectDetail'
|
291
|
+
|
292
|
+
# auth_names
|
293
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
294
|
+
|
295
|
+
new_options = opts.merge(
|
296
|
+
:header_params => header_params,
|
297
|
+
:query_params => query_params,
|
298
|
+
:form_params => form_params,
|
299
|
+
:body => post_body,
|
300
|
+
:auth_names => auth_names,
|
301
|
+
:return_type => return_type
|
302
|
+
)
|
303
|
+
|
304
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
305
|
+
if @api_client.config.debugging
|
306
|
+
@api_client.config.logger.debug "API called: MembersApi#member_update_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
307
|
+
end
|
308
|
+
response = ::Phrase::Response.new(data, headers)
|
309
|
+
return response, status_code, headers
|
310
|
+
end
|
311
|
+
|
232
312
|
# List members
|
233
313
|
# Get all users active in the account. It also lists resources like projects and locales the member has access to. In case nothing is shown the default access from the role is used. Access token scope must include <code>team.manage</code>.
|
234
314
|
# @param account_id [String] Account ID
|
@@ -310,6 +310,7 @@ module Phrase
|
|
310
310
|
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
311
311
|
# @option opts [Integer] :page Page number
|
312
312
|
# @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 25 by default
|
313
|
+
# @option opts [String] :key_id filter by key
|
313
314
|
# @return [Array<Screenshot>]
|
314
315
|
def screenshots_list(project_id, opts = {})
|
315
316
|
data, _status_code, _headers = screenshots_list_with_http_info(project_id, opts)
|
@@ -323,6 +324,7 @@ module Phrase
|
|
323
324
|
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
324
325
|
# @option opts [Integer] :page Page number
|
325
326
|
# @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 25 by default
|
327
|
+
# @option opts [String] :key_id filter by key
|
326
328
|
# @return [Array<(Response<(Array<Screenshot>)>, Integer, Hash)>] Response<(Array<Screenshot>)> data, response status code and response headers
|
327
329
|
def screenshots_list_with_http_info(project_id, opts = {})
|
328
330
|
if @api_client.config.debugging
|
@@ -339,6 +341,7 @@ module Phrase
|
|
339
341
|
query_params = opts[:query_params] || {}
|
340
342
|
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
341
343
|
query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
|
344
|
+
query_params[:'key_id'] = opts[:'key_id'] if !opts[:'key_id'].nil?
|
342
345
|
|
343
346
|
# header parameters
|
344
347
|
header_params = opts[:header_params] || {}
|
data/lib/phrase/api_client.rb
CHANGED
@@ -131,6 +131,8 @@ module Phrase
|
|
131
131
|
when ::File, ::Tempfile, ::Array, nil
|
132
132
|
# let typhoeus handle File, Tempfile, Array and nil parameters
|
133
133
|
data[key] = value
|
134
|
+
when ::Hash
|
135
|
+
data[key] = build_request_body(header_params, value, body)
|
134
136
|
else
|
135
137
|
data[key] = value.to_s
|
136
138
|
end
|
@@ -0,0 +1,194 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Phrase
|
4
|
+
class BranchName
|
5
|
+
attr_accessor :name
|
6
|
+
|
7
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
8
|
+
def self.attribute_map
|
9
|
+
{
|
10
|
+
:'name' => :'name'
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
# Attribute type mapping.
|
15
|
+
def self.openapi_types
|
16
|
+
{
|
17
|
+
:'name' => :'String'
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
# List of attributes with nullable: true
|
22
|
+
def self.openapi_nullable
|
23
|
+
Set.new([
|
24
|
+
])
|
25
|
+
end
|
26
|
+
|
27
|
+
# Initializes the object
|
28
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
29
|
+
def initialize(attributes = {})
|
30
|
+
if (!attributes.is_a?(Hash))
|
31
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::BranchName` initialize method"
|
32
|
+
end
|
33
|
+
|
34
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
35
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
36
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
37
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::BranchName`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
38
|
+
end
|
39
|
+
h[k.to_sym] = v
|
40
|
+
}
|
41
|
+
|
42
|
+
if attributes.key?(:'name')
|
43
|
+
self.name = attributes[:'name']
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
48
|
+
# @return Array for valid properties with the reasons
|
49
|
+
def list_invalid_properties
|
50
|
+
invalid_properties = Array.new
|
51
|
+
invalid_properties
|
52
|
+
end
|
53
|
+
|
54
|
+
# Check to see if the all the properties in the model are valid
|
55
|
+
# @return true if the model is valid
|
56
|
+
def valid?
|
57
|
+
true
|
58
|
+
end
|
59
|
+
|
60
|
+
# Checks equality by comparing each attribute.
|
61
|
+
# @param [Object] Object to be compared
|
62
|
+
def ==(o)
|
63
|
+
return true if self.equal?(o)
|
64
|
+
self.class == o.class &&
|
65
|
+
name == o.name
|
66
|
+
end
|
67
|
+
|
68
|
+
# @see the `==` method
|
69
|
+
# @param [Object] Object to be compared
|
70
|
+
def eql?(o)
|
71
|
+
self == o
|
72
|
+
end
|
73
|
+
|
74
|
+
# Calculates hash code according to all attributes.
|
75
|
+
# @return [Integer] Hash code
|
76
|
+
def hash
|
77
|
+
[name].hash
|
78
|
+
end
|
79
|
+
|
80
|
+
# Builds the object from hash
|
81
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
82
|
+
# @return [Object] Returns the model itself
|
83
|
+
def self.build_from_hash(attributes)
|
84
|
+
new.build_from_hash(attributes)
|
85
|
+
end
|
86
|
+
|
87
|
+
# Builds the object from hash
|
88
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
89
|
+
# @return [Object] Returns the model itself
|
90
|
+
def build_from_hash(attributes)
|
91
|
+
return nil unless attributes.is_a?(Hash)
|
92
|
+
self.class.openapi_types.each_pair do |key, type|
|
93
|
+
if type =~ /\AArray<(.*)>/i
|
94
|
+
# check to ensure the input is an array given that the attribute
|
95
|
+
# is documented as an array but the input is not
|
96
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
97
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
98
|
+
end
|
99
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
100
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
101
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
102
|
+
end
|
103
|
+
|
104
|
+
self
|
105
|
+
end
|
106
|
+
|
107
|
+
# Deserializes the data based on type
|
108
|
+
# @param string type Data type
|
109
|
+
# @param string value Value to be deserialized
|
110
|
+
# @return [Object] Deserialized data
|
111
|
+
def _deserialize(type, value)
|
112
|
+
case type.to_sym
|
113
|
+
when :DateTime
|
114
|
+
DateTime.parse(value)
|
115
|
+
when :Date
|
116
|
+
Date.parse(value)
|
117
|
+
when :String
|
118
|
+
value.to_s
|
119
|
+
when :Integer
|
120
|
+
value.to_i
|
121
|
+
when :Float
|
122
|
+
value.to_f
|
123
|
+
when :Boolean
|
124
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
125
|
+
true
|
126
|
+
else
|
127
|
+
false
|
128
|
+
end
|
129
|
+
when :Object
|
130
|
+
# generic object (usually a Hash), return directly
|
131
|
+
value
|
132
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
133
|
+
inner_type = Regexp.last_match[:inner_type]
|
134
|
+
value.map { |v| _deserialize(inner_type, v) }
|
135
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
136
|
+
k_type = Regexp.last_match[:k_type]
|
137
|
+
v_type = Regexp.last_match[:v_type]
|
138
|
+
{}.tap do |hash|
|
139
|
+
value.each do |k, v|
|
140
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
else # model
|
144
|
+
Phrase.const_get(type).build_from_hash(value)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
# Returns the string representation of the object
|
149
|
+
# @return [String] String presentation of the object
|
150
|
+
def to_s
|
151
|
+
to_hash.to_s
|
152
|
+
end
|
153
|
+
|
154
|
+
# to_body is an alias to to_hash (backward compatibility)
|
155
|
+
# @return [Hash] Returns the object in the form of hash
|
156
|
+
def to_body
|
157
|
+
to_hash
|
158
|
+
end
|
159
|
+
|
160
|
+
# Returns the object in the form of hash
|
161
|
+
# @return [Hash] Returns the object in the form of hash
|
162
|
+
def to_hash
|
163
|
+
hash = {}
|
164
|
+
self.class.attribute_map.each_pair do |attr, param|
|
165
|
+
value = self.send(attr)
|
166
|
+
if value.nil?
|
167
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
168
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
169
|
+
end
|
170
|
+
|
171
|
+
hash[param] = _to_hash(value)
|
172
|
+
end
|
173
|
+
hash
|
174
|
+
end
|
175
|
+
|
176
|
+
# Outputs non-array value in the form of hash
|
177
|
+
# For object, use to_hash. Otherwise, just return the value
|
178
|
+
# @param [Object] value Any valid value
|
179
|
+
# @return [Hash] Returns the value in the form of hash
|
180
|
+
def _to_hash(value)
|
181
|
+
if value.is_a?(Array)
|
182
|
+
value.compact.map { |v| _to_hash(v) }
|
183
|
+
elsif value.is_a?(Hash)
|
184
|
+
{}.tap do |hash|
|
185
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
186
|
+
end
|
187
|
+
elsif value.respond_to? :to_hash
|
188
|
+
value.to_hash
|
189
|
+
else
|
190
|
+
value
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
@@ -14,6 +14,8 @@ module Phrase
|
|
14
14
|
|
15
15
|
attr_accessor :locales
|
16
16
|
|
17
|
+
attr_accessor :default_locale_codes
|
18
|
+
|
17
19
|
attr_accessor :permissions
|
18
20
|
|
19
21
|
attr_accessor :created_at
|
@@ -22,6 +24,8 @@ module Phrase
|
|
22
24
|
|
23
25
|
attr_accessor :accepted_at
|
24
26
|
|
27
|
+
attr_accessor :spaces
|
28
|
+
|
25
29
|
# Attribute mapping from ruby-style variable name to JSON key.
|
26
30
|
def self.attribute_map
|
27
31
|
{
|
@@ -31,10 +35,12 @@ module Phrase
|
|
31
35
|
:'state' => :'state',
|
32
36
|
:'projects' => :'projects',
|
33
37
|
:'locales' => :'locales',
|
38
|
+
:'default_locale_codes' => :'default_locale_codes',
|
34
39
|
:'permissions' => :'permissions',
|
35
40
|
:'created_at' => :'created_at',
|
36
41
|
:'updated_at' => :'updated_at',
|
37
|
-
:'accepted_at' => :'accepted_at'
|
42
|
+
:'accepted_at' => :'accepted_at',
|
43
|
+
:'spaces' => :'spaces'
|
38
44
|
}
|
39
45
|
end
|
40
46
|
|
@@ -47,10 +53,12 @@ module Phrase
|
|
47
53
|
:'state' => :'String',
|
48
54
|
:'projects' => :'Array<ProjectShort>',
|
49
55
|
:'locales' => :'Array<LocalePreview>',
|
56
|
+
:'default_locale_codes' => :'Array<String>',
|
50
57
|
:'permissions' => :'Object',
|
51
58
|
:'created_at' => :'DateTime',
|
52
59
|
:'updated_at' => :'DateTime',
|
53
|
-
:'accepted_at' => :'DateTime'
|
60
|
+
:'accepted_at' => :'DateTime',
|
61
|
+
:'spaces' => :'Array<MemberSpaces>'
|
54
62
|
}
|
55
63
|
end
|
56
64
|
|
@@ -103,6 +111,12 @@ module Phrase
|
|
103
111
|
end
|
104
112
|
end
|
105
113
|
|
114
|
+
if attributes.key?(:'default_locale_codes')
|
115
|
+
if (value = attributes[:'default_locale_codes']).is_a?(Array)
|
116
|
+
self.default_locale_codes = value
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
106
120
|
if attributes.key?(:'permissions')
|
107
121
|
self.permissions = attributes[:'permissions']
|
108
122
|
end
|
@@ -118,6 +132,12 @@ module Phrase
|
|
118
132
|
if attributes.key?(:'accepted_at')
|
119
133
|
self.accepted_at = attributes[:'accepted_at']
|
120
134
|
end
|
135
|
+
|
136
|
+
if attributes.key?(:'spaces')
|
137
|
+
if (value = attributes[:'spaces']).is_a?(Array)
|
138
|
+
self.spaces = value
|
139
|
+
end
|
140
|
+
end
|
121
141
|
end
|
122
142
|
|
123
143
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -144,10 +164,12 @@ module Phrase
|
|
144
164
|
state == o.state &&
|
145
165
|
projects == o.projects &&
|
146
166
|
locales == o.locales &&
|
167
|
+
default_locale_codes == o.default_locale_codes &&
|
147
168
|
permissions == o.permissions &&
|
148
169
|
created_at == o.created_at &&
|
149
170
|
updated_at == o.updated_at &&
|
150
|
-
accepted_at == o.accepted_at
|
171
|
+
accepted_at == o.accepted_at &&
|
172
|
+
spaces == o.spaces
|
151
173
|
end
|
152
174
|
|
153
175
|
# @see the `==` method
|
@@ -159,7 +181,7 @@ module Phrase
|
|
159
181
|
# Calculates hash code according to all attributes.
|
160
182
|
# @return [Integer] Hash code
|
161
183
|
def hash
|
162
|
-
[id, email, role, state, projects, locales, permissions, created_at, updated_at, accepted_at].hash
|
184
|
+
[id, email, role, state, projects, locales, default_locale_codes, permissions, created_at, updated_at, accepted_at, spaces].hash
|
163
185
|
end
|
164
186
|
|
165
187
|
# Builds the object from hash
|