phrase 1.0.7 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -9
  3. data/docs/BranchName.md +17 -0
  4. data/docs/CurrentUser.md +31 -0
  5. data/docs/Invitation.md +9 -1
  6. data/docs/InvitationCreateParameters.md +4 -0
  7. data/docs/InvitationUpdateParameters.md +4 -0
  8. data/docs/InvitationUpdateSettingsParameters.md +19 -0
  9. data/docs/InvitationsApi.md +66 -0
  10. data/docs/Job.md +5 -3
  11. data/docs/JobDetails.md +4 -2
  12. data/docs/JobLocale.md +7 -1
  13. data/docs/KeysApi.md +5 -5
  14. data/docs/LocalesApi.md +7 -4
  15. data/docs/Member.md +7 -1
  16. data/docs/MemberProjectDetail.md +35 -0
  17. data/docs/MemberProjectDetailProjectRoles.md +19 -0
  18. data/docs/MemberSpaces.md +25 -0
  19. data/docs/MemberUpdateParameters.md +4 -0
  20. data/docs/MemberUpdateSettingsParameters.md +19 -0
  21. data/docs/MembersApi.md +66 -0
  22. data/docs/ProjectUpdateParameters.md +43 -9
  23. data/docs/ScreenshotCreateParameters.md +3 -1
  24. data/docs/ScreenshotMarkerCreateParameters.md +3 -1
  25. data/docs/ScreenshotMarkerUpdateParameters.md +3 -1
  26. data/docs/ScreenshotMarkersApi.md +9 -3
  27. data/docs/ScreenshotUpdateParameters.md +3 -1
  28. data/docs/ScreenshotsApi.md +8 -2
  29. data/docs/TranslationsApi.md +25 -25
  30. data/docs/UsersApi.md +2 -2
  31. data/docs/Variable.md +23 -0
  32. data/docs/VariableCreateParameters.md +19 -0
  33. data/docs/VariableUpdateParameters.md +19 -0
  34. data/docs/VariablesApi.md +331 -0
  35. data/docs/Webhook.md +2 -0
  36. data/docs/WebhookCreateParameters.md +3 -1
  37. data/docs/WebhookUpdateParameters.md +3 -1
  38. data/lib/phrase.rb +11 -0
  39. data/lib/phrase/api/invitations_api.rb +80 -0
  40. data/lib/phrase/api/keys_api.rb +6 -6
  41. data/lib/phrase/api/locales_api.rb +8 -3
  42. data/lib/phrase/api/members_api.rb +80 -0
  43. data/lib/phrase/api/screenshot_markers_api.rb +9 -0
  44. data/lib/phrase/api/screenshots_api.rb +9 -0
  45. data/lib/phrase/api/translations_api.rb +35 -35
  46. data/lib/phrase/api/users_api.rb +3 -3
  47. data/lib/phrase/api/variables_api.rb +378 -0
  48. data/lib/phrase/api_client.rb +2 -0
  49. data/lib/phrase/models/branch_name.rb +194 -0
  50. data/lib/phrase/models/current_user.rb +257 -0
  51. data/lib/phrase/models/invitation.rb +48 -4
  52. data/lib/phrase/models/invitation_create_parameters.rb +25 -1
  53. data/lib/phrase/models/invitation_update_parameters.rb +25 -1
  54. data/lib/phrase/models/invitation_update_settings_parameters.rb +207 -0
  55. data/lib/phrase/models/job.rb +22 -13
  56. data/lib/phrase/models/job_details.rb +19 -10
  57. data/lib/phrase/models/job_locale.rb +31 -4
  58. data/lib/phrase/models/member.rb +35 -4
  59. data/lib/phrase/models/member_project_detail.rb +285 -0
  60. data/lib/phrase/models/member_project_detail_project_roles.rb +203 -0
  61. data/lib/phrase/models/member_spaces.rb +230 -0
  62. data/lib/phrase/models/member_update_parameters.rb +25 -1
  63. data/lib/phrase/models/member_update_settings_parameters.rb +207 -0
  64. data/lib/phrase/models/project_update_parameters.rb +183 -13
  65. data/lib/phrase/models/screenshot_create_parameters.rb +11 -1
  66. data/lib/phrase/models/screenshot_marker_create_parameters.rb +11 -1
  67. data/lib/phrase/models/screenshot_marker_update_parameters.rb +11 -1
  68. data/lib/phrase/models/screenshot_update_parameters.rb +11 -1
  69. data/lib/phrase/models/variable.rb +221 -0
  70. data/lib/phrase/models/variable_create_parameters.rb +205 -0
  71. data/lib/phrase/models/variable_update_parameters.rb +205 -0
  72. data/lib/phrase/models/webhook.rb +10 -1
  73. data/lib/phrase/models/webhook_create_parameters.rb +14 -4
  74. data/lib/phrase/models/webhook_update_parameters.rb +14 -4
  75. data/lib/phrase/version.rb +1 -1
  76. data/spec/api/invitations_api_spec.rb +15 -0
  77. data/spec/api/keys_api_spec.rb +2 -2
  78. data/spec/api/locales_api_spec.rb +2 -1
  79. data/spec/api/members_api_spec.rb +15 -0
  80. data/spec/api/screenshot_markers_api_spec.rb +3 -0
  81. data/spec/api/screenshots_api_spec.rb +3 -0
  82. data/spec/api/translations_api_spec.rb +10 -10
  83. data/spec/api/users_api_spec.rb +1 -1
  84. data/spec/api/variables_api_spec.rb +95 -0
  85. data/spec/models/branch_name_spec.rb +29 -0
  86. data/spec/models/current_user_spec.rb +71 -0
  87. data/spec/models/invitation_create_parameters_spec.rb +12 -0
  88. data/spec/models/invitation_spec.rb +24 -0
  89. data/spec/models/invitation_update_parameters_spec.rb +12 -0
  90. data/spec/models/invitation_update_settings_parameters_spec.rb +35 -0
  91. data/spec/models/job_details_spec.rb +9 -3
  92. data/spec/models/job_locale_spec.rb +18 -0
  93. data/spec/models/job_spec.rb +9 -3
  94. data/spec/models/member_project_detail_project_roles_spec.rb +35 -0
  95. data/spec/models/member_project_detail_spec.rb +83 -0
  96. data/spec/models/member_spaces_spec.rb +53 -0
  97. data/spec/models/member_spec.rb +18 -0
  98. data/spec/models/member_update_parameters_spec.rb +12 -0
  99. data/spec/models/member_update_settings_parameters_spec.rb +35 -0
  100. data/spec/models/project_update_parameters_spec.rb +103 -1
  101. data/spec/models/screenshot_create_parameters_spec.rb +6 -0
  102. data/spec/models/screenshot_marker_create_parameters_spec.rb +6 -0
  103. data/spec/models/screenshot_marker_update_parameters_spec.rb +6 -0
  104. data/spec/models/screenshot_update_parameters_spec.rb +6 -0
  105. data/spec/models/variable_create_parameters_spec.rb +35 -0
  106. data/spec/models/variable_spec.rb +47 -0
  107. data/spec/models/variable_update_parameters_spec.rb +35 -0
  108. data/spec/models/webhook_create_parameters_spec.rb +6 -0
  109. data/spec/models/webhook_spec.rb +6 -0
  110. data/spec/models/webhook_update_parameters_spec.rb +6 -0
  111. metadata +206 -162
@@ -823,8 +823,8 @@ module Phrase
823
823
  # @param [Hash] opts the optional parameters
824
824
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
825
825
  # @return [AffectedCount]
826
- def translations_exclude(project_id, translations_exclude_parameters, opts = {})
827
- data, _status_code, _headers = translations_exclude_with_http_info(project_id, translations_exclude_parameters, opts)
826
+ def translations_exclude_collection(project_id, translations_exclude_parameters, opts = {})
827
+ data, _status_code, _headers = translations_exclude_collection_with_http_info(project_id, translations_exclude_parameters, opts)
828
828
  data
829
829
  end
830
830
 
@@ -835,17 +835,17 @@ module Phrase
835
835
  # @param [Hash] opts the optional parameters
836
836
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
837
837
  # @return [Array<(Response<(AffectedCount)>, Integer, Hash)>] Response<(AffectedCount)> data, response status code and response headers
838
- def translations_exclude_with_http_info(project_id, translations_exclude_parameters, opts = {})
838
+ def translations_exclude_collection_with_http_info(project_id, translations_exclude_parameters, opts = {})
839
839
  if @api_client.config.debugging
840
- @api_client.config.logger.debug 'Calling API: TranslationsApi.translations_exclude ...'
840
+ @api_client.config.logger.debug 'Calling API: TranslationsApi.translations_exclude_collection ...'
841
841
  end
842
842
  # verify the required parameter 'project_id' is set
843
843
  if @api_client.config.client_side_validation && project_id.nil?
844
- fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translations_exclude"
844
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translations_exclude_collection"
845
845
  end
846
846
  # verify the required parameter 'translations_exclude_parameters' is set
847
847
  if @api_client.config.client_side_validation && translations_exclude_parameters.nil?
848
- fail ArgumentError, "Missing the required parameter 'translations_exclude_parameters' when calling TranslationsApi.translations_exclude"
848
+ fail ArgumentError, "Missing the required parameter 'translations_exclude_parameters' when calling TranslationsApi.translations_exclude_collection"
849
849
  end
850
850
  # resource path
851
851
  local_var_path = '/projects/{project_id}/translations/exclude'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s))
@@ -884,7 +884,7 @@ module Phrase
884
884
 
885
885
  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
886
886
  if @api_client.config.debugging
887
- @api_client.config.logger.debug "API called: TranslationsApi#translations_exclude\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
887
+ @api_client.config.logger.debug "API called: TranslationsApi#translations_exclude_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
888
888
  end
889
889
  response = ::Phrase::Response.new(data, headers)
890
890
  return response, status_code, headers
@@ -897,8 +897,8 @@ module Phrase
897
897
  # @param [Hash] opts the optional parameters
898
898
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
899
899
  # @return [AffectedCount]
900
- def translations_include(project_id, translations_include_parameters, opts = {})
901
- data, _status_code, _headers = translations_include_with_http_info(project_id, translations_include_parameters, opts)
900
+ def translations_include_collection(project_id, translations_include_parameters, opts = {})
901
+ data, _status_code, _headers = translations_include_collection_with_http_info(project_id, translations_include_parameters, opts)
902
902
  data
903
903
  end
904
904
 
@@ -909,17 +909,17 @@ module Phrase
909
909
  # @param [Hash] opts the optional parameters
910
910
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
911
911
  # @return [Array<(Response<(AffectedCount)>, Integer, Hash)>] Response<(AffectedCount)> data, response status code and response headers
912
- def translations_include_with_http_info(project_id, translations_include_parameters, opts = {})
912
+ def translations_include_collection_with_http_info(project_id, translations_include_parameters, opts = {})
913
913
  if @api_client.config.debugging
914
- @api_client.config.logger.debug 'Calling API: TranslationsApi.translations_include ...'
914
+ @api_client.config.logger.debug 'Calling API: TranslationsApi.translations_include_collection ...'
915
915
  end
916
916
  # verify the required parameter 'project_id' is set
917
917
  if @api_client.config.client_side_validation && project_id.nil?
918
- fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translations_include"
918
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translations_include_collection"
919
919
  end
920
920
  # verify the required parameter 'translations_include_parameters' is set
921
921
  if @api_client.config.client_side_validation && translations_include_parameters.nil?
922
- fail ArgumentError, "Missing the required parameter 'translations_include_parameters' when calling TranslationsApi.translations_include"
922
+ fail ArgumentError, "Missing the required parameter 'translations_include_parameters' when calling TranslationsApi.translations_include_collection"
923
923
  end
924
924
  # resource path
925
925
  local_var_path = '/projects/{project_id}/translations/include'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s))
@@ -958,7 +958,7 @@ module Phrase
958
958
 
959
959
  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
960
960
  if @api_client.config.debugging
961
- @api_client.config.logger.debug "API called: TranslationsApi#translations_include\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
961
+ @api_client.config.logger.debug "API called: TranslationsApi#translations_include_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
962
962
  end
963
963
  response = ::Phrase::Response.new(data, headers)
964
964
  return response, status_code, headers
@@ -1055,8 +1055,8 @@ module Phrase
1055
1055
  # @param [Hash] opts the optional parameters
1056
1056
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
1057
1057
  # @return [AffectedCount]
1058
- def translations_review(project_id, translations_review_parameters, opts = {})
1059
- data, _status_code, _headers = translations_review_with_http_info(project_id, translations_review_parameters, opts)
1058
+ def translations_review_collection(project_id, translations_review_parameters, opts = {})
1059
+ data, _status_code, _headers = translations_review_collection_with_http_info(project_id, translations_review_parameters, opts)
1060
1060
  data
1061
1061
  end
1062
1062
 
@@ -1067,17 +1067,17 @@ module Phrase
1067
1067
  # @param [Hash] opts the optional parameters
1068
1068
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
1069
1069
  # @return [Array<(Response<(AffectedCount)>, Integer, Hash)>] Response<(AffectedCount)> data, response status code and response headers
1070
- def translations_review_with_http_info(project_id, translations_review_parameters, opts = {})
1070
+ def translations_review_collection_with_http_info(project_id, translations_review_parameters, opts = {})
1071
1071
  if @api_client.config.debugging
1072
- @api_client.config.logger.debug 'Calling API: TranslationsApi.translations_review ...'
1072
+ @api_client.config.logger.debug 'Calling API: TranslationsApi.translations_review_collection ...'
1073
1073
  end
1074
1074
  # verify the required parameter 'project_id' is set
1075
1075
  if @api_client.config.client_side_validation && project_id.nil?
1076
- fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translations_review"
1076
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translations_review_collection"
1077
1077
  end
1078
1078
  # verify the required parameter 'translations_review_parameters' is set
1079
1079
  if @api_client.config.client_side_validation && translations_review_parameters.nil?
1080
- fail ArgumentError, "Missing the required parameter 'translations_review_parameters' when calling TranslationsApi.translations_review"
1080
+ fail ArgumentError, "Missing the required parameter 'translations_review_parameters' when calling TranslationsApi.translations_review_collection"
1081
1081
  end
1082
1082
  # resource path
1083
1083
  local_var_path = '/projects/{project_id}/translations/review'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s))
@@ -1116,7 +1116,7 @@ module Phrase
1116
1116
 
1117
1117
  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
1118
1118
  if @api_client.config.debugging
1119
- @api_client.config.logger.debug "API called: TranslationsApi#translations_review\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1119
+ @api_client.config.logger.debug "API called: TranslationsApi#translations_review_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1120
1120
  end
1121
1121
  response = ::Phrase::Response.new(data, headers)
1122
1122
  return response, status_code, headers
@@ -1209,8 +1209,8 @@ module Phrase
1209
1209
  # @param [Hash] opts the optional parameters
1210
1210
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
1211
1211
  # @return [AffectedCount]
1212
- def translations_unverify(project_id, translations_unverify_parameters, opts = {})
1213
- data, _status_code, _headers = translations_unverify_with_http_info(project_id, translations_unverify_parameters, opts)
1212
+ def translations_unverify_collection(project_id, translations_unverify_parameters, opts = {})
1213
+ data, _status_code, _headers = translations_unverify_collection_with_http_info(project_id, translations_unverify_parameters, opts)
1214
1214
  data
1215
1215
  end
1216
1216
 
@@ -1221,17 +1221,17 @@ module Phrase
1221
1221
  # @param [Hash] opts the optional parameters
1222
1222
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
1223
1223
  # @return [Array<(Response<(AffectedCount)>, Integer, Hash)>] Response<(AffectedCount)> data, response status code and response headers
1224
- def translations_unverify_with_http_info(project_id, translations_unverify_parameters, opts = {})
1224
+ def translations_unverify_collection_with_http_info(project_id, translations_unverify_parameters, opts = {})
1225
1225
  if @api_client.config.debugging
1226
- @api_client.config.logger.debug 'Calling API: TranslationsApi.translations_unverify ...'
1226
+ @api_client.config.logger.debug 'Calling API: TranslationsApi.translations_unverify_collection ...'
1227
1227
  end
1228
1228
  # verify the required parameter 'project_id' is set
1229
1229
  if @api_client.config.client_side_validation && project_id.nil?
1230
- fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translations_unverify"
1230
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translations_unverify_collection"
1231
1231
  end
1232
1232
  # verify the required parameter 'translations_unverify_parameters' is set
1233
1233
  if @api_client.config.client_side_validation && translations_unverify_parameters.nil?
1234
- fail ArgumentError, "Missing the required parameter 'translations_unverify_parameters' when calling TranslationsApi.translations_unverify"
1234
+ fail ArgumentError, "Missing the required parameter 'translations_unverify_parameters' when calling TranslationsApi.translations_unverify_collection"
1235
1235
  end
1236
1236
  # resource path
1237
1237
  local_var_path = '/projects/{project_id}/translations/unverify'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s))
@@ -1270,7 +1270,7 @@ module Phrase
1270
1270
 
1271
1271
  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
1272
1272
  if @api_client.config.debugging
1273
- @api_client.config.logger.debug "API called: TranslationsApi#translations_unverify\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1273
+ @api_client.config.logger.debug "API called: TranslationsApi#translations_unverify_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1274
1274
  end
1275
1275
  response = ::Phrase::Response.new(data, headers)
1276
1276
  return response, status_code, headers
@@ -1283,8 +1283,8 @@ module Phrase
1283
1283
  # @param [Hash] opts the optional parameters
1284
1284
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
1285
1285
  # @return [AffectedCount]
1286
- def translations_verify(project_id, translations_verify_parameters, opts = {})
1287
- data, _status_code, _headers = translations_verify_with_http_info(project_id, translations_verify_parameters, opts)
1286
+ def translations_verify_collection(project_id, translations_verify_parameters, opts = {})
1287
+ data, _status_code, _headers = translations_verify_collection_with_http_info(project_id, translations_verify_parameters, opts)
1288
1288
  data
1289
1289
  end
1290
1290
 
@@ -1295,17 +1295,17 @@ module Phrase
1295
1295
  # @param [Hash] opts the optional parameters
1296
1296
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
1297
1297
  # @return [Array<(Response<(AffectedCount)>, Integer, Hash)>] Response<(AffectedCount)> data, response status code and response headers
1298
- def translations_verify_with_http_info(project_id, translations_verify_parameters, opts = {})
1298
+ def translations_verify_collection_with_http_info(project_id, translations_verify_parameters, opts = {})
1299
1299
  if @api_client.config.debugging
1300
- @api_client.config.logger.debug 'Calling API: TranslationsApi.translations_verify ...'
1300
+ @api_client.config.logger.debug 'Calling API: TranslationsApi.translations_verify_collection ...'
1301
1301
  end
1302
1302
  # verify the required parameter 'project_id' is set
1303
1303
  if @api_client.config.client_side_validation && project_id.nil?
1304
- fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translations_verify"
1304
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translations_verify_collection"
1305
1305
  end
1306
1306
  # verify the required parameter 'translations_verify_parameters' is set
1307
1307
  if @api_client.config.client_side_validation && translations_verify_parameters.nil?
1308
- fail ArgumentError, "Missing the required parameter 'translations_verify_parameters' when calling TranslationsApi.translations_verify"
1308
+ fail ArgumentError, "Missing the required parameter 'translations_verify_parameters' when calling TranslationsApi.translations_verify_collection"
1309
1309
  end
1310
1310
  # resource path
1311
1311
  local_var_path = '/projects/{project_id}/translations/verify'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s))
@@ -1344,7 +1344,7 @@ module Phrase
1344
1344
 
1345
1345
  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
1346
1346
  if @api_client.config.debugging
1347
- @api_client.config.logger.debug "API called: TranslationsApi#translations_verify\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1347
+ @api_client.config.logger.debug "API called: TranslationsApi#translations_verify_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1348
1348
  end
1349
1349
  response = ::Phrase::Response.new(data, headers)
1350
1350
  return response, status_code, headers
@@ -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 [User]
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<(User)>, Integer, Hash)>] Response<(User)> data, response status code and response headers
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] || 'User'
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