phrase 1.0.10 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +25 -9
- data/docs/CurrentUser.md +31 -0
- data/docs/Invitation.md +9 -1
- data/docs/InvitationCreateParameters.md +4 -0
- data/docs/InvitationUpdateParameters.md +4 -0
- data/docs/InvitationUpdateSettingsParameters.md +19 -0
- data/docs/InvitationsApi.md +66 -0
- data/docs/JobLocale.md +5 -1
- data/docs/KeysApi.md +5 -5
- data/docs/LocalesApi.md +5 -4
- 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/ProjectUpdateParameters.md +43 -9
- data/docs/ScreenshotCreateParameters.md +3 -1
- data/docs/ScreenshotMarkerCreateParameters.md +3 -1
- data/docs/ScreenshotMarkerUpdateParameters.md +3 -1
- data/docs/ScreenshotMarkersApi.md +9 -3
- data/docs/ScreenshotUpdateParameters.md +3 -1
- data/docs/ScreenshotsApi.md +8 -2
- data/docs/TranslationsApi.md +25 -25
- data/docs/UsersApi.md +2 -2
- data/docs/Variable.md +23 -0
- data/docs/VariableCreateParameters.md +19 -0
- data/docs/VariableUpdateParameters.md +19 -0
- data/docs/VariablesApi.md +331 -0
- data/lib/phrase.rb +10 -0
- data/lib/phrase/api/invitations_api.rb +80 -0
- data/lib/phrase/api/keys_api.rb +6 -6
- data/lib/phrase/api/locales_api.rb +5 -3
- data/lib/phrase/api/members_api.rb +80 -0
- data/lib/phrase/api/screenshot_markers_api.rb +9 -0
- data/lib/phrase/api/screenshots_api.rb +9 -0
- data/lib/phrase/api/translations_api.rb +35 -35
- data/lib/phrase/api/users_api.rb +3 -3
- data/lib/phrase/api/variables_api.rb +378 -0
- data/lib/phrase/models/current_user.rb +257 -0
- data/lib/phrase/models/invitation.rb +48 -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/invitation_update_settings_parameters.rb +207 -0
- data/lib/phrase/models/job_locale.rb +22 -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/project_update_parameters.rb +183 -13
- data/lib/phrase/models/screenshot_create_parameters.rb +11 -1
- data/lib/phrase/models/screenshot_marker_create_parameters.rb +11 -1
- data/lib/phrase/models/screenshot_marker_update_parameters.rb +11 -1
- data/lib/phrase/models/screenshot_update_parameters.rb +11 -1
- data/lib/phrase/models/variable.rb +221 -0
- data/lib/phrase/models/variable_create_parameters.rb +205 -0
- data/lib/phrase/models/variable_update_parameters.rb +205 -0
- data/lib/phrase/version.rb +1 -1
- data/spec/api/invitations_api_spec.rb +15 -0
- data/spec/api/keys_api_spec.rb +2 -2
- data/spec/api/locales_api_spec.rb +1 -1
- data/spec/api/members_api_spec.rb +15 -0
- data/spec/api/screenshot_markers_api_spec.rb +3 -0
- data/spec/api/screenshots_api_spec.rb +3 -0
- data/spec/api/translations_api_spec.rb +10 -10
- data/spec/api/users_api_spec.rb +1 -1
- data/spec/api/variables_api_spec.rb +95 -0
- data/spec/models/current_user_spec.rb +71 -0
- data/spec/models/invitation_create_parameters_spec.rb +12 -0
- data/spec/models/invitation_spec.rb +24 -0
- data/spec/models/invitation_update_parameters_spec.rb +12 -0
- data/spec/models/invitation_update_settings_parameters_spec.rb +35 -0
- data/spec/models/job_locale_spec.rb +12 -0
- 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/project_update_parameters_spec.rb +103 -1
- data/spec/models/screenshot_create_parameters_spec.rb +6 -0
- data/spec/models/screenshot_marker_create_parameters_spec.rb +6 -0
- data/spec/models/screenshot_marker_update_parameters_spec.rb +6 -0
- data/spec/models/screenshot_update_parameters_spec.rb +6 -0
- data/spec/models/variable_create_parameters_spec.rb +35 -0
- data/spec/models/variable_spec.rb +47 -0
- data/spec/models/variable_update_parameters_spec.rb +35 -0
- metadata +203 -163
data/lib/phrase/api/users_api.rb
CHANGED
@@ -11,7 +11,7 @@ module Phrase
|
|
11
11
|
# Show details for current User.
|
12
12
|
# @param [Hash] opts the optional parameters
|
13
13
|
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
14
|
-
# @return [
|
14
|
+
# @return [CurrentUser]
|
15
15
|
def show_user(opts = {})
|
16
16
|
data, _status_code, _headers = show_user_with_http_info(opts)
|
17
17
|
data
|
@@ -21,7 +21,7 @@ module Phrase
|
|
21
21
|
# Show details for current User.
|
22
22
|
# @param [Hash] opts the optional parameters
|
23
23
|
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
24
|
-
# @return [Array<(Response<(
|
24
|
+
# @return [Array<(Response<(CurrentUser)>, Integer, Hash)>] Response<(CurrentUser)> data, response status code and response headers
|
25
25
|
def show_user_with_http_info(opts = {})
|
26
26
|
if @api_client.config.debugging
|
27
27
|
@api_client.config.logger.debug 'Calling API: UsersApi.show_user ...'
|
@@ -45,7 +45,7 @@ module Phrase
|
|
45
45
|
post_body = opts[:body]
|
46
46
|
|
47
47
|
# return_type
|
48
|
-
return_type = opts[:return_type] || '
|
48
|
+
return_type = opts[:return_type] || 'CurrentUser'
|
49
49
|
|
50
50
|
# auth_names
|
51
51
|
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
@@ -0,0 +1,378 @@
|
|
1
|
+
require 'cgi'
|
2
|
+
|
3
|
+
module Phrase
|
4
|
+
class VariablesApi
|
5
|
+
attr_accessor :api_client
|
6
|
+
|
7
|
+
def initialize(api_client = ApiClient.default)
|
8
|
+
@api_client = api_client
|
9
|
+
end
|
10
|
+
# Create a variable
|
11
|
+
# Create a new variable.
|
12
|
+
# @param project_id [String] Project ID
|
13
|
+
# @param variable_create_parameters [VariableCreateParameters]
|
14
|
+
# @param [Hash] opts the optional parameters
|
15
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
16
|
+
# @return [Variable]
|
17
|
+
def variable_create(project_id, variable_create_parameters, opts = {})
|
18
|
+
data, _status_code, _headers = variable_create_with_http_info(project_id, variable_create_parameters, opts)
|
19
|
+
data
|
20
|
+
end
|
21
|
+
|
22
|
+
# Create a variable
|
23
|
+
# Create a new variable.
|
24
|
+
# @param project_id [String] Project ID
|
25
|
+
# @param variable_create_parameters [VariableCreateParameters]
|
26
|
+
# @param [Hash] opts the optional parameters
|
27
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
28
|
+
# @return [Array<(Response<(Variable)>, Integer, Hash)>] Response<(Variable)> data, response status code and response headers
|
29
|
+
def variable_create_with_http_info(project_id, variable_create_parameters, opts = {})
|
30
|
+
if @api_client.config.debugging
|
31
|
+
@api_client.config.logger.debug 'Calling API: VariablesApi.variable_create ...'
|
32
|
+
end
|
33
|
+
# verify the required parameter 'project_id' is set
|
34
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
35
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling VariablesApi.variable_create"
|
36
|
+
end
|
37
|
+
# verify the required parameter 'variable_create_parameters' is set
|
38
|
+
if @api_client.config.client_side_validation && variable_create_parameters.nil?
|
39
|
+
fail ArgumentError, "Missing the required parameter 'variable_create_parameters' when calling VariablesApi.variable_create"
|
40
|
+
end
|
41
|
+
# resource path
|
42
|
+
local_var_path = '/projects/{project_id}/variables'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s))
|
43
|
+
|
44
|
+
# query parameters
|
45
|
+
query_params = opts[:query_params] || {}
|
46
|
+
|
47
|
+
# header parameters
|
48
|
+
header_params = opts[:header_params] || {}
|
49
|
+
# HTTP header 'Accept' (if needed)
|
50
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
51
|
+
# HTTP header 'Content-Type'
|
52
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
53
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
54
|
+
|
55
|
+
# form parameters
|
56
|
+
form_params = opts[:form_params] || {}
|
57
|
+
|
58
|
+
# http body (model)
|
59
|
+
post_body = opts[:body] || @api_client.object_to_http_body(variable_create_parameters)
|
60
|
+
|
61
|
+
# return_type
|
62
|
+
return_type = opts[:return_type] || 'Variable'
|
63
|
+
|
64
|
+
# auth_names
|
65
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
66
|
+
|
67
|
+
new_options = opts.merge(
|
68
|
+
:header_params => header_params,
|
69
|
+
:query_params => query_params,
|
70
|
+
:form_params => form_params,
|
71
|
+
:body => post_body,
|
72
|
+
:auth_names => auth_names,
|
73
|
+
:return_type => return_type
|
74
|
+
)
|
75
|
+
|
76
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
77
|
+
if @api_client.config.debugging
|
78
|
+
@api_client.config.logger.debug "API called: VariablesApi#variable_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
79
|
+
end
|
80
|
+
response = ::Phrase::Response.new(data, headers)
|
81
|
+
return response, status_code, headers
|
82
|
+
end
|
83
|
+
|
84
|
+
# Delete a variable
|
85
|
+
# Delete an existing variable.
|
86
|
+
# @param project_id [String] Project ID
|
87
|
+
# @param name [String] name
|
88
|
+
# @param [Hash] opts the optional parameters
|
89
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
90
|
+
# @return [nil]
|
91
|
+
def variable_delete(project_id, name, opts = {})
|
92
|
+
data, _status_code, _headers = variable_delete_with_http_info(project_id, name, opts)
|
93
|
+
data
|
94
|
+
end
|
95
|
+
|
96
|
+
# Delete a variable
|
97
|
+
# Delete an existing variable.
|
98
|
+
# @param project_id [String] Project ID
|
99
|
+
# @param name [String] name
|
100
|
+
# @param [Hash] opts the optional parameters
|
101
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
102
|
+
# @return [Array<(Response, Integer, Hash)>] Response<(nil, response status code and response headers
|
103
|
+
def variable_delete_with_http_info(project_id, name, opts = {})
|
104
|
+
if @api_client.config.debugging
|
105
|
+
@api_client.config.logger.debug 'Calling API: VariablesApi.variable_delete ...'
|
106
|
+
end
|
107
|
+
# verify the required parameter 'project_id' is set
|
108
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
109
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling VariablesApi.variable_delete"
|
110
|
+
end
|
111
|
+
# verify the required parameter 'name' is set
|
112
|
+
if @api_client.config.client_side_validation && name.nil?
|
113
|
+
fail ArgumentError, "Missing the required parameter 'name' when calling VariablesApi.variable_delete"
|
114
|
+
end
|
115
|
+
# resource path
|
116
|
+
local_var_path = '/projects/{project_id}/variables/{name}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'name' + '}', CGI.escape(name.to_s))
|
117
|
+
|
118
|
+
# query parameters
|
119
|
+
query_params = opts[:query_params] || {}
|
120
|
+
|
121
|
+
# header parameters
|
122
|
+
header_params = opts[:header_params] || {}
|
123
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
124
|
+
|
125
|
+
# form parameters
|
126
|
+
form_params = opts[:form_params] || {}
|
127
|
+
|
128
|
+
# http body (model)
|
129
|
+
post_body = opts[:body]
|
130
|
+
|
131
|
+
# return_type
|
132
|
+
return_type = opts[:return_type]
|
133
|
+
|
134
|
+
# auth_names
|
135
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
136
|
+
|
137
|
+
new_options = opts.merge(
|
138
|
+
:header_params => header_params,
|
139
|
+
:query_params => query_params,
|
140
|
+
:form_params => form_params,
|
141
|
+
:body => post_body,
|
142
|
+
:auth_names => auth_names,
|
143
|
+
:return_type => return_type
|
144
|
+
)
|
145
|
+
|
146
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
147
|
+
if @api_client.config.debugging
|
148
|
+
@api_client.config.logger.debug "API called: VariablesApi#variable_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
149
|
+
end
|
150
|
+
response = ::Phrase::Response.new(data, headers)
|
151
|
+
return response, status_code, headers
|
152
|
+
end
|
153
|
+
|
154
|
+
# Get a single variable
|
155
|
+
# Get details on a single variable for a given project.
|
156
|
+
# @param project_id [String] Project ID
|
157
|
+
# @param name [String] name
|
158
|
+
# @param [Hash] opts the optional parameters
|
159
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
160
|
+
# @return [Variable]
|
161
|
+
def variable_show(project_id, name, opts = {})
|
162
|
+
data, _status_code, _headers = variable_show_with_http_info(project_id, name, opts)
|
163
|
+
data
|
164
|
+
end
|
165
|
+
|
166
|
+
# Get a single variable
|
167
|
+
# Get details on a single variable for a given project.
|
168
|
+
# @param project_id [String] Project ID
|
169
|
+
# @param name [String] name
|
170
|
+
# @param [Hash] opts the optional parameters
|
171
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
172
|
+
# @return [Array<(Response<(Variable)>, Integer, Hash)>] Response<(Variable)> data, response status code and response headers
|
173
|
+
def variable_show_with_http_info(project_id, name, opts = {})
|
174
|
+
if @api_client.config.debugging
|
175
|
+
@api_client.config.logger.debug 'Calling API: VariablesApi.variable_show ...'
|
176
|
+
end
|
177
|
+
# verify the required parameter 'project_id' is set
|
178
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
179
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling VariablesApi.variable_show"
|
180
|
+
end
|
181
|
+
# verify the required parameter 'name' is set
|
182
|
+
if @api_client.config.client_side_validation && name.nil?
|
183
|
+
fail ArgumentError, "Missing the required parameter 'name' when calling VariablesApi.variable_show"
|
184
|
+
end
|
185
|
+
# resource path
|
186
|
+
local_var_path = '/projects/{project_id}/variables/{name}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'name' + '}', CGI.escape(name.to_s))
|
187
|
+
|
188
|
+
# query parameters
|
189
|
+
query_params = opts[:query_params] || {}
|
190
|
+
|
191
|
+
# header parameters
|
192
|
+
header_params = opts[:header_params] || {}
|
193
|
+
# HTTP header 'Accept' (if needed)
|
194
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
195
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
196
|
+
|
197
|
+
# form parameters
|
198
|
+
form_params = opts[:form_params] || {}
|
199
|
+
|
200
|
+
# http body (model)
|
201
|
+
post_body = opts[:body]
|
202
|
+
|
203
|
+
# return_type
|
204
|
+
return_type = opts[:return_type] || 'Variable'
|
205
|
+
|
206
|
+
# auth_names
|
207
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
208
|
+
|
209
|
+
new_options = opts.merge(
|
210
|
+
:header_params => header_params,
|
211
|
+
:query_params => query_params,
|
212
|
+
:form_params => form_params,
|
213
|
+
:body => post_body,
|
214
|
+
:auth_names => auth_names,
|
215
|
+
:return_type => return_type
|
216
|
+
)
|
217
|
+
|
218
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
219
|
+
if @api_client.config.debugging
|
220
|
+
@api_client.config.logger.debug "API called: VariablesApi#variable_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
221
|
+
end
|
222
|
+
response = ::Phrase::Response.new(data, headers)
|
223
|
+
return response, status_code, headers
|
224
|
+
end
|
225
|
+
|
226
|
+
# Update a variable
|
227
|
+
# Update an existing variable.
|
228
|
+
# @param project_id [String] Project ID
|
229
|
+
# @param name [String] name
|
230
|
+
# @param variable_update_parameters [VariableUpdateParameters]
|
231
|
+
# @param [Hash] opts the optional parameters
|
232
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
233
|
+
# @return [Variable]
|
234
|
+
def variable_update(project_id, name, variable_update_parameters, opts = {})
|
235
|
+
data, _status_code, _headers = variable_update_with_http_info(project_id, name, variable_update_parameters, opts)
|
236
|
+
data
|
237
|
+
end
|
238
|
+
|
239
|
+
# Update a variable
|
240
|
+
# Update an existing variable.
|
241
|
+
# @param project_id [String] Project ID
|
242
|
+
# @param name [String] name
|
243
|
+
# @param variable_update_parameters [VariableUpdateParameters]
|
244
|
+
# @param [Hash] opts the optional parameters
|
245
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
246
|
+
# @return [Array<(Response<(Variable)>, Integer, Hash)>] Response<(Variable)> data, response status code and response headers
|
247
|
+
def variable_update_with_http_info(project_id, name, variable_update_parameters, opts = {})
|
248
|
+
if @api_client.config.debugging
|
249
|
+
@api_client.config.logger.debug 'Calling API: VariablesApi.variable_update ...'
|
250
|
+
end
|
251
|
+
# verify the required parameter 'project_id' is set
|
252
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
253
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling VariablesApi.variable_update"
|
254
|
+
end
|
255
|
+
# verify the required parameter 'name' is set
|
256
|
+
if @api_client.config.client_side_validation && name.nil?
|
257
|
+
fail ArgumentError, "Missing the required parameter 'name' when calling VariablesApi.variable_update"
|
258
|
+
end
|
259
|
+
# verify the required parameter 'variable_update_parameters' is set
|
260
|
+
if @api_client.config.client_side_validation && variable_update_parameters.nil?
|
261
|
+
fail ArgumentError, "Missing the required parameter 'variable_update_parameters' when calling VariablesApi.variable_update"
|
262
|
+
end
|
263
|
+
# resource path
|
264
|
+
local_var_path = '/projects/{project_id}/variables/{name}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'name' + '}', CGI.escape(name.to_s))
|
265
|
+
|
266
|
+
# query parameters
|
267
|
+
query_params = opts[:query_params] || {}
|
268
|
+
|
269
|
+
# header parameters
|
270
|
+
header_params = opts[:header_params] || {}
|
271
|
+
# HTTP header 'Accept' (if needed)
|
272
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
273
|
+
# HTTP header 'Content-Type'
|
274
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
275
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
276
|
+
|
277
|
+
# form parameters
|
278
|
+
form_params = opts[:form_params] || {}
|
279
|
+
|
280
|
+
# http body (model)
|
281
|
+
post_body = opts[:body] || @api_client.object_to_http_body(variable_update_parameters)
|
282
|
+
|
283
|
+
# return_type
|
284
|
+
return_type = opts[:return_type] || 'Variable'
|
285
|
+
|
286
|
+
# auth_names
|
287
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
288
|
+
|
289
|
+
new_options = opts.merge(
|
290
|
+
:header_params => header_params,
|
291
|
+
:query_params => query_params,
|
292
|
+
:form_params => form_params,
|
293
|
+
:body => post_body,
|
294
|
+
:auth_names => auth_names,
|
295
|
+
:return_type => return_type
|
296
|
+
)
|
297
|
+
|
298
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
299
|
+
if @api_client.config.debugging
|
300
|
+
@api_client.config.logger.debug "API called: VariablesApi#variable_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
301
|
+
end
|
302
|
+
response = ::Phrase::Response.new(data, headers)
|
303
|
+
return response, status_code, headers
|
304
|
+
end
|
305
|
+
|
306
|
+
# List variables
|
307
|
+
# List all variables for the current project.
|
308
|
+
# @param project_id [String] Project ID
|
309
|
+
# @param [Hash] opts the optional parameters
|
310
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
311
|
+
# @option opts [Integer] :page Page number
|
312
|
+
# @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 25 by default
|
313
|
+
# @return [Array<Variable>]
|
314
|
+
def variables_list(project_id, opts = {})
|
315
|
+
data, _status_code, _headers = variables_list_with_http_info(project_id, opts)
|
316
|
+
data
|
317
|
+
end
|
318
|
+
|
319
|
+
# List variables
|
320
|
+
# List all variables for the current project.
|
321
|
+
# @param project_id [String] Project ID
|
322
|
+
# @param [Hash] opts the optional parameters
|
323
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
324
|
+
# @option opts [Integer] :page Page number
|
325
|
+
# @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 25 by default
|
326
|
+
# @return [Array<(Response<(Array<Variable>)>, Integer, Hash)>] Response<(Array<Variable>)> data, response status code and response headers
|
327
|
+
def variables_list_with_http_info(project_id, opts = {})
|
328
|
+
if @api_client.config.debugging
|
329
|
+
@api_client.config.logger.debug 'Calling API: VariablesApi.variables_list ...'
|
330
|
+
end
|
331
|
+
# verify the required parameter 'project_id' is set
|
332
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
333
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling VariablesApi.variables_list"
|
334
|
+
end
|
335
|
+
# resource path
|
336
|
+
local_var_path = '/projects/{project_id}/variables'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s))
|
337
|
+
|
338
|
+
# query parameters
|
339
|
+
query_params = opts[:query_params] || {}
|
340
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
341
|
+
query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
|
342
|
+
|
343
|
+
# header parameters
|
344
|
+
header_params = opts[:header_params] || {}
|
345
|
+
# HTTP header 'Accept' (if needed)
|
346
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
347
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
348
|
+
|
349
|
+
# form parameters
|
350
|
+
form_params = opts[:form_params] || {}
|
351
|
+
|
352
|
+
# http body (model)
|
353
|
+
post_body = opts[:body]
|
354
|
+
|
355
|
+
# return_type
|
356
|
+
return_type = opts[:return_type] || 'Array<Variable>'
|
357
|
+
|
358
|
+
# auth_names
|
359
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
360
|
+
|
361
|
+
new_options = opts.merge(
|
362
|
+
:header_params => header_params,
|
363
|
+
:query_params => query_params,
|
364
|
+
:form_params => form_params,
|
365
|
+
:body => post_body,
|
366
|
+
:auth_names => auth_names,
|
367
|
+
:return_type => return_type
|
368
|
+
)
|
369
|
+
|
370
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
371
|
+
if @api_client.config.debugging
|
372
|
+
@api_client.config.logger.debug "API called: VariablesApi#variables_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
373
|
+
end
|
374
|
+
response = ::Phrase::Response.new(data, headers)
|
375
|
+
return response, status_code, headers
|
376
|
+
end
|
377
|
+
end
|
378
|
+
end
|
@@ -0,0 +1,257 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Phrase
|
4
|
+
class CurrentUser
|
5
|
+
attr_accessor :id
|
6
|
+
|
7
|
+
attr_accessor :username
|
8
|
+
|
9
|
+
attr_accessor :name
|
10
|
+
|
11
|
+
attr_accessor :email
|
12
|
+
|
13
|
+
attr_accessor :position
|
14
|
+
|
15
|
+
attr_accessor :language
|
16
|
+
|
17
|
+
attr_accessor :created_at
|
18
|
+
|
19
|
+
attr_accessor :updated_at
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'id' => :'id',
|
25
|
+
:'username' => :'username',
|
26
|
+
:'name' => :'name',
|
27
|
+
:'email' => :'email',
|
28
|
+
:'position' => :'position',
|
29
|
+
:'language' => :'language',
|
30
|
+
:'created_at' => :'created_at',
|
31
|
+
:'updated_at' => :'updated_at'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# Attribute type mapping.
|
36
|
+
def self.openapi_types
|
37
|
+
{
|
38
|
+
:'id' => :'String',
|
39
|
+
:'username' => :'String',
|
40
|
+
:'name' => :'String',
|
41
|
+
:'email' => :'String',
|
42
|
+
:'position' => :'String',
|
43
|
+
:'language' => :'String',
|
44
|
+
:'created_at' => :'DateTime',
|
45
|
+
:'updated_at' => :'DateTime'
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# List of attributes with nullable: true
|
50
|
+
def self.openapi_nullable
|
51
|
+
Set.new([
|
52
|
+
])
|
53
|
+
end
|
54
|
+
|
55
|
+
# Initializes the object
|
56
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
57
|
+
def initialize(attributes = {})
|
58
|
+
if (!attributes.is_a?(Hash))
|
59
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::CurrentUser` initialize method"
|
60
|
+
end
|
61
|
+
|
62
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
63
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
64
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
65
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::CurrentUser`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
66
|
+
end
|
67
|
+
h[k.to_sym] = v
|
68
|
+
}
|
69
|
+
|
70
|
+
if attributes.key?(:'id')
|
71
|
+
self.id = attributes[:'id']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.key?(:'username')
|
75
|
+
self.username = attributes[:'username']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:'name')
|
79
|
+
self.name = attributes[:'name']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.key?(:'email')
|
83
|
+
self.email = attributes[:'email']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.key?(:'position')
|
87
|
+
self.position = attributes[:'position']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.key?(:'language')
|
91
|
+
self.language = attributes[:'language']
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes.key?(:'created_at')
|
95
|
+
self.created_at = attributes[:'created_at']
|
96
|
+
end
|
97
|
+
|
98
|
+
if attributes.key?(:'updated_at')
|
99
|
+
self.updated_at = attributes[:'updated_at']
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
104
|
+
# @return Array for valid properties with the reasons
|
105
|
+
def list_invalid_properties
|
106
|
+
invalid_properties = Array.new
|
107
|
+
invalid_properties
|
108
|
+
end
|
109
|
+
|
110
|
+
# Check to see if the all the properties in the model are valid
|
111
|
+
# @return true if the model is valid
|
112
|
+
def valid?
|
113
|
+
true
|
114
|
+
end
|
115
|
+
|
116
|
+
# Checks equality by comparing each attribute.
|
117
|
+
# @param [Object] Object to be compared
|
118
|
+
def ==(o)
|
119
|
+
return true if self.equal?(o)
|
120
|
+
self.class == o.class &&
|
121
|
+
id == o.id &&
|
122
|
+
username == o.username &&
|
123
|
+
name == o.name &&
|
124
|
+
email == o.email &&
|
125
|
+
position == o.position &&
|
126
|
+
language == o.language &&
|
127
|
+
created_at == o.created_at &&
|
128
|
+
updated_at == o.updated_at
|
129
|
+
end
|
130
|
+
|
131
|
+
# @see the `==` method
|
132
|
+
# @param [Object] Object to be compared
|
133
|
+
def eql?(o)
|
134
|
+
self == o
|
135
|
+
end
|
136
|
+
|
137
|
+
# Calculates hash code according to all attributes.
|
138
|
+
# @return [Integer] Hash code
|
139
|
+
def hash
|
140
|
+
[id, username, name, email, position, language, created_at, updated_at].hash
|
141
|
+
end
|
142
|
+
|
143
|
+
# Builds the object from hash
|
144
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
145
|
+
# @return [Object] Returns the model itself
|
146
|
+
def self.build_from_hash(attributes)
|
147
|
+
new.build_from_hash(attributes)
|
148
|
+
end
|
149
|
+
|
150
|
+
# Builds the object from hash
|
151
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
152
|
+
# @return [Object] Returns the model itself
|
153
|
+
def build_from_hash(attributes)
|
154
|
+
return nil unless attributes.is_a?(Hash)
|
155
|
+
self.class.openapi_types.each_pair do |key, type|
|
156
|
+
if type =~ /\AArray<(.*)>/i
|
157
|
+
# check to ensure the input is an array given that the attribute
|
158
|
+
# is documented as an array but the input is not
|
159
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
160
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
161
|
+
end
|
162
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
163
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
164
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
165
|
+
end
|
166
|
+
|
167
|
+
self
|
168
|
+
end
|
169
|
+
|
170
|
+
# Deserializes the data based on type
|
171
|
+
# @param string type Data type
|
172
|
+
# @param string value Value to be deserialized
|
173
|
+
# @return [Object] Deserialized data
|
174
|
+
def _deserialize(type, value)
|
175
|
+
case type.to_sym
|
176
|
+
when :DateTime
|
177
|
+
DateTime.parse(value)
|
178
|
+
when :Date
|
179
|
+
Date.parse(value)
|
180
|
+
when :String
|
181
|
+
value.to_s
|
182
|
+
when :Integer
|
183
|
+
value.to_i
|
184
|
+
when :Float
|
185
|
+
value.to_f
|
186
|
+
when :Boolean
|
187
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
188
|
+
true
|
189
|
+
else
|
190
|
+
false
|
191
|
+
end
|
192
|
+
when :Object
|
193
|
+
# generic object (usually a Hash), return directly
|
194
|
+
value
|
195
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
196
|
+
inner_type = Regexp.last_match[:inner_type]
|
197
|
+
value.map { |v| _deserialize(inner_type, v) }
|
198
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
199
|
+
k_type = Regexp.last_match[:k_type]
|
200
|
+
v_type = Regexp.last_match[:v_type]
|
201
|
+
{}.tap do |hash|
|
202
|
+
value.each do |k, v|
|
203
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
else # model
|
207
|
+
Phrase.const_get(type).build_from_hash(value)
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
# Returns the string representation of the object
|
212
|
+
# @return [String] String presentation of the object
|
213
|
+
def to_s
|
214
|
+
to_hash.to_s
|
215
|
+
end
|
216
|
+
|
217
|
+
# to_body is an alias to to_hash (backward compatibility)
|
218
|
+
# @return [Hash] Returns the object in the form of hash
|
219
|
+
def to_body
|
220
|
+
to_hash
|
221
|
+
end
|
222
|
+
|
223
|
+
# Returns the object in the form of hash
|
224
|
+
# @return [Hash] Returns the object in the form of hash
|
225
|
+
def to_hash
|
226
|
+
hash = {}
|
227
|
+
self.class.attribute_map.each_pair do |attr, param|
|
228
|
+
value = self.send(attr)
|
229
|
+
if value.nil?
|
230
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
231
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
232
|
+
end
|
233
|
+
|
234
|
+
hash[param] = _to_hash(value)
|
235
|
+
end
|
236
|
+
hash
|
237
|
+
end
|
238
|
+
|
239
|
+
# Outputs non-array value in the form of hash
|
240
|
+
# For object, use to_hash. Otherwise, just return the value
|
241
|
+
# @param [Object] value Any valid value
|
242
|
+
# @return [Hash] Returns the value in the form of hash
|
243
|
+
def _to_hash(value)
|
244
|
+
if value.is_a?(Array)
|
245
|
+
value.compact.map { |v| _to_hash(v) }
|
246
|
+
elsif value.is_a?(Hash)
|
247
|
+
{}.tap do |hash|
|
248
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
249
|
+
end
|
250
|
+
elsif value.respond_to? :to_hash
|
251
|
+
value.to_hash
|
252
|
+
else
|
253
|
+
value
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|