From aaee4a15dc9102c1e7ea9157f1bcf465ce4c55ad Mon Sep 17 00:00:00 2001 From: Phrase Date: Wed, 17 Jan 2024 13:59:16 +0000 Subject: [PATCH] Deploying from phrase/openapi@d22c558a --- .openapi-generator/FILES | 27 ++ README.md | 9 + docs/Error.md | 17 ++ docs/ErrorError.md | 19 ++ docs/KeyCreateParameters.md | 2 +- docs/KeyUpdateParameters.md | 2 +- docs/ProjectCreateParameters.md | 2 +- docs/ProjectUpdateParameters.md | 2 +- ...jectsQualityPerformanceScore200Response.md | 21 ++ ...QualityPerformanceScore200ResponseAnyOf.md | 19 ++ ...ityPerformanceScore200ResponseAnyOfData.md | 17 ++ ...re200ResponseAnyOfDataTranslationsInner.md | 21 ++ ...ormanceScore200ResponseAnyOfErrorsInner.md | 21 ++ .../ProjectsQualityPerformanceScoreRequest.md | 17 ++ docs/QualityPerformanceScoreApi.md | 72 ++++++ docs/ScreenshotUpdateParameters.md | 2 +- lib/phrase.rb | 9 + .../api/quality_performance_score_api.rb | 84 +++++++ lib/phrase/models/error.rb | 197 +++++++++++++++ lib/phrase/models/error_error.rb | 205 +++++++++++++++ ...s_quality_performance_score200_response.rb | 237 ++++++++++++++++++ ...ty_performance_score200_response_any_of.rb | 208 +++++++++++++++ ...rformance_score200_response_any_of_data.rb | 198 +++++++++++++++ ...response_any_of_data_translations_inner.rb | 217 ++++++++++++++++ ...e_score200_response_any_of_errors_inner.rb | 215 ++++++++++++++++ ...jects_quality_performance_score_request.rb | 199 +++++++++++++++ .../api/quality_performance_score_api_spec.rb | 37 +++ spec/models/error_error_spec.rb | 35 +++ spec/models/error_spec.rb | 29 +++ ...ance_score200_response_any_of_data_spec.rb | 29 +++ ...nse_any_of_data_translations_inner_spec.rb | 41 +++ ...re200_response_any_of_errors_inner_spec.rb | 41 +++ ...rformance_score200_response_any_of_spec.rb | 35 +++ ...lity_performance_score200_response_spec.rb | 41 +++ ..._quality_performance_score_request_spec.rb | 29 +++ 35 files changed, 2351 insertions(+), 5 deletions(-) create mode 100644 docs/Error.md create mode 100644 docs/ErrorError.md create mode 100644 docs/ProjectsQualityPerformanceScore200Response.md create mode 100644 docs/ProjectsQualityPerformanceScore200ResponseAnyOf.md create mode 100644 docs/ProjectsQualityPerformanceScore200ResponseAnyOfData.md create mode 100644 docs/ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner.md create mode 100644 docs/ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner.md create mode 100644 docs/ProjectsQualityPerformanceScoreRequest.md create mode 100644 docs/QualityPerformanceScoreApi.md create mode 100644 lib/phrase/api/quality_performance_score_api.rb create mode 100644 lib/phrase/models/error.rb create mode 100644 lib/phrase/models/error_error.rb create mode 100644 lib/phrase/models/projects_quality_performance_score200_response.rb create mode 100644 lib/phrase/models/projects_quality_performance_score200_response_any_of.rb create mode 100644 lib/phrase/models/projects_quality_performance_score200_response_any_of_data.rb create mode 100644 lib/phrase/models/projects_quality_performance_score200_response_any_of_data_translations_inner.rb create mode 100644 lib/phrase/models/projects_quality_performance_score200_response_any_of_errors_inner.rb create mode 100644 lib/phrase/models/projects_quality_performance_score_request.rb create mode 100644 spec/api/quality_performance_score_api_spec.rb create mode 100644 spec/models/error_error_spec.rb create mode 100644 spec/models/error_spec.rb create mode 100644 spec/models/projects_quality_performance_score200_response_any_of_data_spec.rb create mode 100644 spec/models/projects_quality_performance_score200_response_any_of_data_translations_inner_spec.rb create mode 100644 spec/models/projects_quality_performance_score200_response_any_of_errors_inner_spec.rb create mode 100644 spec/models/projects_quality_performance_score200_response_any_of_spec.rb create mode 100644 spec/models/projects_quality_performance_score200_response_spec.rb create mode 100644 spec/models/projects_quality_performance_score_request_spec.rb diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 1b180ec..eb40829 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -57,6 +57,8 @@ docs/DistributionUpdateParameters.md docs/DistributionsApi.md docs/Document.md docs/DocumentsApi.md +docs/Error.md +docs/ErrorError.md docs/FigmaAttachment.md docs/FigmaAttachmentCreateParameters.md docs/FigmaAttachmentUpdateParameters.md @@ -176,6 +178,13 @@ docs/ProjectReport.md docs/ProjectShort.md docs/ProjectUpdateParameters.md docs/ProjectsApi.md +docs/ProjectsQualityPerformanceScore200Response.md +docs/ProjectsQualityPerformanceScore200ResponseAnyOf.md +docs/ProjectsQualityPerformanceScore200ResponseAnyOfData.md +docs/ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner.md +docs/ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner.md +docs/ProjectsQualityPerformanceScoreRequest.md +docs/QualityPerformanceScoreApi.md docs/Release.md docs/ReleaseCreateParameters.md docs/ReleasePreview.md @@ -295,6 +304,7 @@ lib/phrase/api/orders_api.rb lib/phrase/api/organization_job_template_locales_api.rb lib/phrase/api/organization_job_templates_api.rb lib/phrase/api/projects_api.rb +lib/phrase/api/quality_performance_score_api.rb lib/phrase/api/releases_api.rb lib/phrase/api/reports_api.rb lib/phrase/api/screenshot_markers_api.rb @@ -353,6 +363,8 @@ lib/phrase/models/distribution_create_parameters.rb lib/phrase/models/distribution_preview.rb lib/phrase/models/distribution_update_parameters.rb lib/phrase/models/document.rb +lib/phrase/models/error.rb +lib/phrase/models/error_error.rb lib/phrase/models/figma_attachment.rb lib/phrase/models/figma_attachment_create_parameters.rb lib/phrase/models/figma_attachment_update_parameters.rb @@ -448,6 +460,12 @@ lib/phrase/models/project_locales.rb lib/phrase/models/project_report.rb lib/phrase/models/project_short.rb lib/phrase/models/project_update_parameters.rb +lib/phrase/models/projects_quality_performance_score200_response.rb +lib/phrase/models/projects_quality_performance_score200_response_any_of.rb +lib/phrase/models/projects_quality_performance_score200_response_any_of_data.rb +lib/phrase/models/projects_quality_performance_score200_response_any_of_data_translations_inner.rb +lib/phrase/models/projects_quality_performance_score200_response_any_of_errors_inner.rb +lib/phrase/models/projects_quality_performance_score_request.rb lib/phrase/models/release.rb lib/phrase/models/release_create_parameters.rb lib/phrase/models/release_preview.rb @@ -550,6 +568,7 @@ spec/api/orders_api_spec.rb spec/api/organization_job_template_locales_api_spec.rb spec/api/organization_job_templates_api_spec.rb spec/api/projects_api_spec.rb +spec/api/quality_performance_score_api_spec.rb spec/api/releases_api_spec.rb spec/api/reports_api_spec.rb spec/api/screenshot_markers_api_spec.rb @@ -606,6 +625,8 @@ spec/models/distribution_preview_spec.rb spec/models/distribution_spec.rb spec/models/distribution_update_parameters_spec.rb spec/models/document_spec.rb +spec/models/error_error_spec.rb +spec/models/error_spec.rb spec/models/figma_attachment_create_parameters_spec.rb spec/models/figma_attachment_spec.rb spec/models/figma_attachment_update_parameters_spec.rb @@ -701,6 +722,12 @@ spec/models/project_report_spec.rb spec/models/project_short_spec.rb spec/models/project_spec.rb spec/models/project_update_parameters_spec.rb +spec/models/projects_quality_performance_score200_response_any_of_data_spec.rb +spec/models/projects_quality_performance_score200_response_any_of_data_translations_inner_spec.rb +spec/models/projects_quality_performance_score200_response_any_of_errors_inner_spec.rb +spec/models/projects_quality_performance_score200_response_any_of_spec.rb +spec/models/projects_quality_performance_score200_response_spec.rb +spec/models/projects_quality_performance_score_request_spec.rb spec/models/release_create_parameters_spec.rb spec/models/release_preview_spec.rb spec/models/release_spec.rb diff --git a/README.md b/README.md index e18befc..306a3bd 100644 --- a/README.md +++ b/README.md @@ -305,6 +305,7 @@ Class | Method | HTTP request | Description *Phrase::ProjectsApi* | [**project_show**](docs/ProjectsApi.md#project_show) | **GET** /projects/{id} | Get a single project *Phrase::ProjectsApi* | [**project_update**](docs/ProjectsApi.md#project_update) | **PATCH** /projects/{id} | Update a project *Phrase::ProjectsApi* | [**projects_list**](docs/ProjectsApi.md#projects_list) | **GET** /projects | List projects +*Phrase::QualityPerformanceScoreApi* | [**projects_quality_performance_score**](docs/QualityPerformanceScoreApi.md#projects_quality_performance_score) | **POST** /projects/{id}/quality_performance_score | Get project's translations' quality performance scores *Phrase::ReleasesApi* | [**release_create**](docs/ReleasesApi.md#release_create) | **POST** /accounts/{account_id}/distributions/{distribution_id}/releases | Create a release *Phrase::ReleasesApi* | [**release_delete**](docs/ReleasesApi.md#release_delete) | **DELETE** /accounts/{account_id}/distributions/{distribution_id}/releases/{id} | Delete a release *Phrase::ReleasesApi* | [**release_publish**](docs/ReleasesApi.md#release_publish) | **POST** /accounts/{account_id}/distributions/{distribution_id}/releases/{id}/publish | Publish a release @@ -432,6 +433,8 @@ Class | Method | HTTP request | Description - [Phrase::DistributionPreview](docs/DistributionPreview.md) - [Phrase::DistributionUpdateParameters](docs/DistributionUpdateParameters.md) - [Phrase::Document](docs/Document.md) + - [Phrase::Error](docs/Error.md) + - [Phrase::ErrorError](docs/ErrorError.md) - [Phrase::FigmaAttachment](docs/FigmaAttachment.md) - [Phrase::FigmaAttachmentCreateParameters](docs/FigmaAttachmentCreateParameters.md) - [Phrase::FigmaAttachmentUpdateParameters](docs/FigmaAttachmentUpdateParameters.md) @@ -527,6 +530,12 @@ Class | Method | HTTP request | Description - [Phrase::ProjectReport](docs/ProjectReport.md) - [Phrase::ProjectShort](docs/ProjectShort.md) - [Phrase::ProjectUpdateParameters](docs/ProjectUpdateParameters.md) + - [Phrase::ProjectsQualityPerformanceScore200Response](docs/ProjectsQualityPerformanceScore200Response.md) + - [Phrase::ProjectsQualityPerformanceScore200ResponseAnyOf](docs/ProjectsQualityPerformanceScore200ResponseAnyOf.md) + - [Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfData](docs/ProjectsQualityPerformanceScore200ResponseAnyOfData.md) + - [Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner](docs/ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner.md) + - [Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner](docs/ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner.md) + - [Phrase::ProjectsQualityPerformanceScoreRequest](docs/ProjectsQualityPerformanceScoreRequest.md) - [Phrase::Release](docs/Release.md) - [Phrase::ReleaseCreateParameters](docs/ReleaseCreateParameters.md) - [Phrase::ReleasePreview](docs/ReleasePreview.md) diff --git a/docs/Error.md b/docs/Error.md new file mode 100644 index 0000000..4acd14a --- /dev/null +++ b/docs/Error.md @@ -0,0 +1,17 @@ +# Phrase::Error + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | [**ErrorError**](ErrorError.md) | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Error.new(error: null) +``` + + diff --git a/docs/ErrorError.md b/docs/ErrorError.md new file mode 100644 index 0000000..eb0084e --- /dev/null +++ b/docs/ErrorError.md @@ -0,0 +1,19 @@ +# Phrase::ErrorError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **String** | | [optional] +**code** | **String** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::ErrorError.new(message: null, + code: null) +``` + + diff --git a/docs/KeyCreateParameters.md b/docs/KeyCreateParameters.md index e42a24e..4484d17 100644 --- a/docs/KeyCreateParameters.md +++ b/docs/KeyCreateParameters.md @@ -35,7 +35,7 @@ instance = Phrase::KeyCreateParameters.new(branch: my-feature-branch, data_type: number, tags: awesome-feature,needs-proofreading, max_characters_allowed: 140, - screenshot: [B@73dbb666, + screenshot: [B@5bbda7e2, remove_screenshot: null, unformatted: null, default_translation_content: Default translation content, diff --git a/docs/KeyUpdateParameters.md b/docs/KeyUpdateParameters.md index 591b5d8..41acf18 100644 --- a/docs/KeyUpdateParameters.md +++ b/docs/KeyUpdateParameters.md @@ -34,7 +34,7 @@ instance = Phrase::KeyUpdateParameters.new(branch: my-feature-branch, data_type: number, tags: awesome-feature,needs-proofreading, max_characters_allowed: 140, - screenshot: [B@1bf5745, + screenshot: [B@37500808, remove_screenshot: null, unformatted: null, xml_space_preserve: null, diff --git a/docs/ProjectCreateParameters.md b/docs/ProjectCreateParameters.md index 4225663..21af6a4 100644 --- a/docs/ProjectCreateParameters.md +++ b/docs/ProjectCreateParameters.md @@ -40,7 +40,7 @@ instance = Phrase::ProjectCreateParameters.new(name: My Android Project, main_format: yml, media: Python, shares_translation_memory: true, - project_image: [B@2cf065e9, + project_image: [B@47b8e2, remove_project_image: null, account_id: abcd1234, point_of_contact: abcd1234, diff --git a/docs/ProjectUpdateParameters.md b/docs/ProjectUpdateParameters.md index 525a2e9..aed0adb 100644 --- a/docs/ProjectUpdateParameters.md +++ b/docs/ProjectUpdateParameters.md @@ -41,7 +41,7 @@ instance = Phrase::ProjectUpdateParameters.new(account_id: abcd1234, main_format: yml, media: Python, shares_translation_memory: true, - project_image: [B@d9fe131, + project_image: [B@2ba8f528, remove_project_image: false, workflow: review, machine_translation_enabled: true, diff --git a/docs/ProjectsQualityPerformanceScore200Response.md b/docs/ProjectsQualityPerformanceScore200Response.md new file mode 100644 index 0000000..a376118 --- /dev/null +++ b/docs/ProjectsQualityPerformanceScore200Response.md @@ -0,0 +1,21 @@ +# Phrase::ProjectsQualityPerformanceScore200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | [**ErrorError**](ErrorError.md) | | [optional] +**data** | [**ProjectsQualityPerformanceScore200ResponseAnyOfData**](ProjectsQualityPerformanceScore200ResponseAnyOfData.md) | | [optional] +**errors** | [**Array<ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner>**](ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner.md) | Array of errors for any failing translation ids | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::ProjectsQualityPerformanceScore200Response.new(error: null, + data: null, + errors: null) +``` + + diff --git a/docs/ProjectsQualityPerformanceScore200ResponseAnyOf.md b/docs/ProjectsQualityPerformanceScore200ResponseAnyOf.md new file mode 100644 index 0000000..8ec4117 --- /dev/null +++ b/docs/ProjectsQualityPerformanceScore200ResponseAnyOf.md @@ -0,0 +1,19 @@ +# Phrase::ProjectsQualityPerformanceScore200ResponseAnyOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**ProjectsQualityPerformanceScore200ResponseAnyOfData**](ProjectsQualityPerformanceScore200ResponseAnyOfData.md) | | [optional] +**errors** | [**Array<ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner>**](ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner.md) | Array of errors for any failing translation ids | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::ProjectsQualityPerformanceScore200ResponseAnyOf.new(data: null, + errors: null) +``` + + diff --git a/docs/ProjectsQualityPerformanceScore200ResponseAnyOfData.md b/docs/ProjectsQualityPerformanceScore200ResponseAnyOfData.md new file mode 100644 index 0000000..a7b55a2 --- /dev/null +++ b/docs/ProjectsQualityPerformanceScore200ResponseAnyOfData.md @@ -0,0 +1,17 @@ +# Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**translations** | [**Array<ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner>**](ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner.md) | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfData.new(translations: null) +``` + + diff --git a/docs/ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner.md b/docs/ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner.md new file mode 100644 index 0000000..a20aa0a --- /dev/null +++ b/docs/ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner.md @@ -0,0 +1,21 @@ +# Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**engine** | **String** | Engine used for the translation scoring | [optional] +**score** | **Float** | Quality score for the translation | [optional] +**id** | **String** | One of the translation ids passed in arguments | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner.new(engine: null, + score: null, + id: null) +``` + + diff --git a/docs/ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner.md b/docs/ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner.md new file mode 100644 index 0000000..b075529 --- /dev/null +++ b/docs/ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner.md @@ -0,0 +1,21 @@ +# Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **String** | | [optional] +**code** | **String** | | [optional] +**id** | **String** | One of the translation ids passed in arguments | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner.new(message: null, + code: null, + id: null) +``` + + diff --git a/docs/ProjectsQualityPerformanceScoreRequest.md b/docs/ProjectsQualityPerformanceScoreRequest.md new file mode 100644 index 0000000..aa4913b --- /dev/null +++ b/docs/ProjectsQualityPerformanceScoreRequest.md @@ -0,0 +1,17 @@ +# Phrase::ProjectsQualityPerformanceScoreRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**translation_ids** | **Array<String>** | Translation ids you want to get the quality performance score for | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::ProjectsQualityPerformanceScoreRequest.new(translation_ids: null) +``` + + diff --git a/docs/QualityPerformanceScoreApi.md b/docs/QualityPerformanceScoreApi.md new file mode 100644 index 0000000..667609e --- /dev/null +++ b/docs/QualityPerformanceScoreApi.md @@ -0,0 +1,72 @@ +# Phrase::QualityPerformanceScoreApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**projects_quality_performance_score**](QualityPerformanceScoreApi.md#projects_quality_performance_score) | **POST** /projects/{id}/quality_performance_score | Get project's translations' quality performance scores + + + +## projects_quality_performance_score + +> ProjectsQualityPerformanceScore200Response projects_quality_performance_score(id, projects_quality_performance_score_request, opts) + +Get project's translations' quality performance scores + +Get project's translations' quality performance scores + +### Example + +```ruby +# load the gem +require 'phrase' +# setup authorization +Phrase.configure do |config| + # Configure HTTP basic authorization: Basic + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD' + + # Configure API key authorization: Token + config.api_key['Authorization'] = 'YOUR API KEY' + config.api_key_prefix['Authorization'] = 'token' +end + +api_instance = Phrase::QualityPerformanceScoreApi.new +id = 'id_example' # String | ID +projects_quality_performance_score_request = Phrase::ProjectsQualityPerformanceScoreRequest.new # ProjectsQualityPerformanceScoreRequest | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get project's translations' quality performance scores + result = api_instance.projects_quality_performance_score(id, projects_quality_performance_score_request, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling QualityPerformanceScoreApi->projects_quality_performance_score: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| ID | + **projects_quality_performance_score_request** | [**ProjectsQualityPerformanceScoreRequest**](ProjectsQualityPerformanceScoreRequest.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**ProjectsQualityPerformanceScore200Response**](ProjectsQualityPerformanceScore200Response.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/docs/ScreenshotUpdateParameters.md b/docs/ScreenshotUpdateParameters.md index 55606be..2ad7c0e 100644 --- a/docs/ScreenshotUpdateParameters.md +++ b/docs/ScreenshotUpdateParameters.md @@ -17,7 +17,7 @@ require 'Phrase' instance = Phrase::ScreenshotUpdateParameters.new(branch: my-feature-branch, name: A screenshot name, description: A screenshot description, - filename: [B@5c2b5f27) + filename: [B@66009368) ``` diff --git a/lib/phrase.rb b/lib/phrase.rb index f6e060f..7c9da98 100644 --- a/lib/phrase.rb +++ b/lib/phrase.rb @@ -47,6 +47,8 @@ require 'phrase/models/distribution_preview' require 'phrase/models/distribution_update_parameters' require 'phrase/models/document' +require 'phrase/models/error' +require 'phrase/models/error_error' require 'phrase/models/figma_attachment' require 'phrase/models/figma_attachment_create_parameters' require 'phrase/models/figma_attachment_update_parameters' @@ -142,6 +144,12 @@ require 'phrase/models/project_report' require 'phrase/models/project_short' require 'phrase/models/project_update_parameters' +require 'phrase/models/projects_quality_performance_score200_response' +require 'phrase/models/projects_quality_performance_score200_response_any_of' +require 'phrase/models/projects_quality_performance_score200_response_any_of_data' +require 'phrase/models/projects_quality_performance_score200_response_any_of_data_translations_inner' +require 'phrase/models/projects_quality_performance_score200_response_any_of_errors_inner' +require 'phrase/models/projects_quality_performance_score_request' require 'phrase/models/release' require 'phrase/models/release_create_parameters' require 'phrase/models/release_preview' @@ -245,6 +253,7 @@ require 'phrase/api/organization_job_template_locales_api' require 'phrase/api/organization_job_templates_api' require 'phrase/api/projects_api' +require 'phrase/api/quality_performance_score_api' require 'phrase/api/releases_api' require 'phrase/api/reports_api' require 'phrase/api/screenshot_markers_api' diff --git a/lib/phrase/api/quality_performance_score_api.rb b/lib/phrase/api/quality_performance_score_api.rb new file mode 100644 index 0000000..d374e9a --- /dev/null +++ b/lib/phrase/api/quality_performance_score_api.rb @@ -0,0 +1,84 @@ +require 'cgi' + +module Phrase + class QualityPerformanceScoreApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Get project's translations' quality performance scores + # Get project's translations' quality performance scores + # @param id [String] ID + # @param projects_quality_performance_score_request [ProjectsQualityPerformanceScoreRequest] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [ProjectsQualityPerformanceScore200Response] + def projects_quality_performance_score(id, projects_quality_performance_score_request, opts = {}) + data, _status_code, _headers = projects_quality_performance_score_with_http_info(id, projects_quality_performance_score_request, opts) + data + end + + # Get project's translations' quality performance scores + # Get project's translations' quality performance scores + # @param id [String] ID + # @param projects_quality_performance_score_request [ProjectsQualityPerformanceScoreRequest] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(ProjectsQualityPerformanceScore200Response)>, Integer, Hash)>] Response<(ProjectsQualityPerformanceScore200Response)> data, response status code and response headers + def projects_quality_performance_score_with_http_info(id, projects_quality_performance_score_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: QualityPerformanceScoreApi.projects_quality_performance_score ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling QualityPerformanceScoreApi.projects_quality_performance_score" + end + # verify the required parameter 'projects_quality_performance_score_request' is set + if @api_client.config.client_side_validation && projects_quality_performance_score_request.nil? + fail ArgumentError, "Missing the required parameter 'projects_quality_performance_score_request' when calling QualityPerformanceScoreApi.projects_quality_performance_score" + end + # resource path + local_var_path = '/projects/{id}/quality_performance_score'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:body] || @api_client.object_to_http_body(projects_quality_performance_score_request) + + # return_type + return_type = opts[:return_type] || 'ProjectsQualityPerformanceScore200Response' + + # auth_names + auth_names = opts[:auth_names] || ['Basic', 'Token'] + + new_options = opts.merge( + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: QualityPerformanceScoreApi#projects_quality_performance_score\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + end +end diff --git a/lib/phrase/models/error.rb b/lib/phrase/models/error.rb new file mode 100644 index 0000000..fb37c2f --- /dev/null +++ b/lib/phrase/models/error.rb @@ -0,0 +1,197 @@ +require 'date' + +module Phrase + # Error field for when the request completely fails + class Error + attr_accessor :error + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'error' => :'error' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'error' => :'ErrorError' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::Error` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'error') + self.error = attributes[:'error'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + error == o.error + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [error].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :Time + Time.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Phrase.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/phrase/models/error_error.rb b/lib/phrase/models/error_error.rb new file mode 100644 index 0000000..ee87ec5 --- /dev/null +++ b/lib/phrase/models/error_error.rb @@ -0,0 +1,205 @@ +require 'date' + +module Phrase + class ErrorError + attr_accessor :message + + attr_accessor :code + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'message' => :'message', + :'code' => :'code' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'message' => :'String', + :'code' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::ErrorError` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::ErrorError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + message == o.message && + code == o.code + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [message, code].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :Time + Time.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Phrase.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/phrase/models/projects_quality_performance_score200_response.rb b/lib/phrase/models/projects_quality_performance_score200_response.rb new file mode 100644 index 0000000..9017603 --- /dev/null +++ b/lib/phrase/models/projects_quality_performance_score200_response.rb @@ -0,0 +1,237 @@ +require 'date' + +module Phrase + class ProjectsQualityPerformanceScore200Response + attr_accessor :error + + attr_accessor :data + + # Array of errors for any failing translation ids + attr_accessor :errors + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'error' => :'error', + :'data' => :'data', + :'errors' => :'errors' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'error' => :'ErrorError', + :'data' => :'ProjectsQualityPerformanceScore200ResponseAnyOfData', + :'errors' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + :'Error', + :'ProjectsQualityPerformanceScore200ResponseAnyOf' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::ProjectsQualityPerformanceScore200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::ProjectsQualityPerformanceScore200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'error') + self.error = attributes[:'error'] + end + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'errors') + if (value = attributes[:'errors']).is_a?(Array) + self.errors = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + _any_of_found = false + self.class.openapi_any_of.each do |_class| + _any_of = Phrase.const_get(_class).build_from_hash(self.to_hash) + if _any_of.valid? + _any_of_found = true + end + end + + if !_any_of_found + return false + end + + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + error == o.error && + data == o.data && + errors == o.errors + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [error, data, errors].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :Time + Time.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Phrase.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/phrase/models/projects_quality_performance_score200_response_any_of.rb b/lib/phrase/models/projects_quality_performance_score200_response_any_of.rb new file mode 100644 index 0000000..a6f0e40 --- /dev/null +++ b/lib/phrase/models/projects_quality_performance_score200_response_any_of.rb @@ -0,0 +1,208 @@ +require 'date' + +module Phrase + class ProjectsQualityPerformanceScore200ResponseAnyOf + attr_accessor :data + + # Array of errors for any failing translation ids + attr_accessor :errors + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data', + :'errors' => :'errors' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'ProjectsQualityPerformanceScore200ResponseAnyOfData', + :'errors' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::ProjectsQualityPerformanceScore200ResponseAnyOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::ProjectsQualityPerformanceScore200ResponseAnyOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'errors') + if (value = attributes[:'errors']).is_a?(Array) + self.errors = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + errors == o.errors + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data, errors].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :Time + Time.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Phrase.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/phrase/models/projects_quality_performance_score200_response_any_of_data.rb b/lib/phrase/models/projects_quality_performance_score200_response_any_of_data.rb new file mode 100644 index 0000000..9e33416 --- /dev/null +++ b/lib/phrase/models/projects_quality_performance_score200_response_any_of_data.rb @@ -0,0 +1,198 @@ +require 'date' + +module Phrase + class ProjectsQualityPerformanceScore200ResponseAnyOfData + attr_accessor :translations + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'translations' => :'translations' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'translations' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfData` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'translations') + if (value = attributes[:'translations']).is_a?(Array) + self.translations = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + translations == o.translations + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [translations].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :Time + Time.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Phrase.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/phrase/models/projects_quality_performance_score200_response_any_of_data_translations_inner.rb b/lib/phrase/models/projects_quality_performance_score200_response_any_of_data_translations_inner.rb new file mode 100644 index 0000000..b870f46 --- /dev/null +++ b/lib/phrase/models/projects_quality_performance_score200_response_any_of_data_translations_inner.rb @@ -0,0 +1,217 @@ +require 'date' + +module Phrase + class ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner + # Engine used for the translation scoring + attr_accessor :engine + + # Quality score for the translation + attr_accessor :score + + # One of the translation ids passed in arguments + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'engine' => :'engine', + :'score' => :'score', + :'id' => :'id' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'engine' => :'String', + :'score' => :'Float', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'engine') + self.engine = attributes[:'engine'] + end + + if attributes.key?(:'score') + self.score = attributes[:'score'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + engine == o.engine && + score == o.score && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [engine, score, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :Time + Time.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Phrase.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/phrase/models/projects_quality_performance_score200_response_any_of_errors_inner.rb b/lib/phrase/models/projects_quality_performance_score200_response_any_of_errors_inner.rb new file mode 100644 index 0000000..decd156 --- /dev/null +++ b/lib/phrase/models/projects_quality_performance_score200_response_any_of_errors_inner.rb @@ -0,0 +1,215 @@ +require 'date' + +module Phrase + class ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner + attr_accessor :message + + attr_accessor :code + + # One of the translation ids passed in arguments + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'message' => :'message', + :'code' => :'code', + :'id' => :'id' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'message' => :'String', + :'code' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + message == o.message && + code == o.code && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [message, code, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :Time + Time.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Phrase.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/phrase/models/projects_quality_performance_score_request.rb b/lib/phrase/models/projects_quality_performance_score_request.rb new file mode 100644 index 0000000..315acbc --- /dev/null +++ b/lib/phrase/models/projects_quality_performance_score_request.rb @@ -0,0 +1,199 @@ +require 'date' + +module Phrase + class ProjectsQualityPerformanceScoreRequest + # Translation ids you want to get the quality performance score for + attr_accessor :translation_ids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'translation_ids' => :'translation_ids' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'translation_ids' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::ProjectsQualityPerformanceScoreRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::ProjectsQualityPerformanceScoreRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'translation_ids') + if (value = attributes[:'translation_ids']).is_a?(Array) + self.translation_ids = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + translation_ids == o.translation_ids + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [translation_ids].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :Time + Time.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Phrase.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/spec/api/quality_performance_score_api_spec.rb b/spec/api/quality_performance_score_api_spec.rb new file mode 100644 index 0000000..f7bde93 --- /dev/null +++ b/spec/api/quality_performance_score_api_spec.rb @@ -0,0 +1,37 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::QualityPerformanceScoreApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'QualityPerformanceScoreApi' do + before do + # run before each test + @api_instance = Phrase::QualityPerformanceScoreApi.new + end + + after do + # run after each test + end + + describe 'test an instance of QualityPerformanceScoreApi' do + it 'should create an instance of QualityPerformanceScoreApi' do + expect(@api_instance).to be_instance_of(Phrase::QualityPerformanceScoreApi) + end + end + + # unit tests for projects_quality_performance_score + # Get project's translations' quality performance scores + # Get project's translations' quality performance scores + # @param id ID + # @param projects_quality_performance_score_request + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [ProjectsQualityPerformanceScore200Response] + describe 'projects_quality_performance_score test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/error_error_spec.rb b/spec/models/error_error_spec.rb new file mode 100644 index 0000000..7ec0f41 --- /dev/null +++ b/spec/models/error_error_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::ErrorError +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ErrorError' do + before do + # run before each test + @instance = Phrase::ErrorError.new + end + + after do + # run after each test + end + + describe 'test an instance of ErrorError' do + it 'should create an instance of ErrorError' do + expect(@instance).to be_instance_of(Phrase::ErrorError) + end + end + describe 'test attribute "message"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "code"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/error_spec.rb b/spec/models/error_spec.rb new file mode 100644 index 0000000..88c63bb --- /dev/null +++ b/spec/models/error_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Error +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Error' do + before do + # run before each test + @instance = Phrase::Error.new + end + + after do + # run after each test + end + + describe 'test an instance of Error' do + it 'should create an instance of Error' do + expect(@instance).to be_instance_of(Phrase::Error) + end + end + describe 'test attribute "error"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/projects_quality_performance_score200_response_any_of_data_spec.rb b/spec/models/projects_quality_performance_score200_response_any_of_data_spec.rb new file mode 100644 index 0000000..0961c7d --- /dev/null +++ b/spec/models/projects_quality_performance_score200_response_any_of_data_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfData +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ProjectsQualityPerformanceScore200ResponseAnyOfData' do + before do + # run before each test + @instance = Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfData.new + end + + after do + # run after each test + end + + describe 'test an instance of ProjectsQualityPerformanceScore200ResponseAnyOfData' do + it 'should create an instance of ProjectsQualityPerformanceScore200ResponseAnyOfData' do + expect(@instance).to be_instance_of(Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfData) + end + end + describe 'test attribute "translations"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/projects_quality_performance_score200_response_any_of_data_translations_inner_spec.rb b/spec/models/projects_quality_performance_score200_response_any_of_data_translations_inner_spec.rb new file mode 100644 index 0000000..248a212 --- /dev/null +++ b/spec/models/projects_quality_performance_score200_response_any_of_data_translations_inner_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner' do + before do + # run before each test + @instance = Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner.new + end + + after do + # run after each test + end + + describe 'test an instance of ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner' do + it 'should create an instance of ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner' do + expect(@instance).to be_instance_of(Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner) + end + end + describe 'test attribute "engine"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "score"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/projects_quality_performance_score200_response_any_of_errors_inner_spec.rb b/spec/models/projects_quality_performance_score200_response_any_of_errors_inner_spec.rb new file mode 100644 index 0000000..1823344 --- /dev/null +++ b/spec/models/projects_quality_performance_score200_response_any_of_errors_inner_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner' do + before do + # run before each test + @instance = Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner.new + end + + after do + # run after each test + end + + describe 'test an instance of ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner' do + it 'should create an instance of ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner' do + expect(@instance).to be_instance_of(Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner) + end + end + describe 'test attribute "message"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "code"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/projects_quality_performance_score200_response_any_of_spec.rb b/spec/models/projects_quality_performance_score200_response_any_of_spec.rb new file mode 100644 index 0000000..c40e82c --- /dev/null +++ b/spec/models/projects_quality_performance_score200_response_any_of_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::ProjectsQualityPerformanceScore200ResponseAnyOf +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ProjectsQualityPerformanceScore200ResponseAnyOf' do + before do + # run before each test + @instance = Phrase::ProjectsQualityPerformanceScore200ResponseAnyOf.new + end + + after do + # run after each test + end + + describe 'test an instance of ProjectsQualityPerformanceScore200ResponseAnyOf' do + it 'should create an instance of ProjectsQualityPerformanceScore200ResponseAnyOf' do + expect(@instance).to be_instance_of(Phrase::ProjectsQualityPerformanceScore200ResponseAnyOf) + end + end + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "errors"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/projects_quality_performance_score200_response_spec.rb b/spec/models/projects_quality_performance_score200_response_spec.rb new file mode 100644 index 0000000..688cc1a --- /dev/null +++ b/spec/models/projects_quality_performance_score200_response_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::ProjectsQualityPerformanceScore200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ProjectsQualityPerformanceScore200Response' do + before do + # run before each test + @instance = Phrase::ProjectsQualityPerformanceScore200Response.new + end + + after do + # run after each test + end + + describe 'test an instance of ProjectsQualityPerformanceScore200Response' do + it 'should create an instance of ProjectsQualityPerformanceScore200Response' do + expect(@instance).to be_instance_of(Phrase::ProjectsQualityPerformanceScore200Response) + end + end + describe 'test attribute "error"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "errors"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/projects_quality_performance_score_request_spec.rb b/spec/models/projects_quality_performance_score_request_spec.rb new file mode 100644 index 0000000..905a584 --- /dev/null +++ b/spec/models/projects_quality_performance_score_request_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::ProjectsQualityPerformanceScoreRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ProjectsQualityPerformanceScoreRequest' do + before do + # run before each test + @instance = Phrase::ProjectsQualityPerformanceScoreRequest.new + end + + after do + # run after each test + end + + describe 'test an instance of ProjectsQualityPerformanceScoreRequest' do + it 'should create an instance of ProjectsQualityPerformanceScoreRequest' do + expect(@instance).to be_instance_of(Phrase::ProjectsQualityPerformanceScoreRequest) + end + end + describe 'test attribute "translation_ids"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end