diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..05a17cb --- /dev/null +++ b/.gitignore @@ -0,0 +1,39 @@ +# Generated by: https://openapi-generator.tech +# + +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/spec/examples.txt +/test/tmp/ +/test/version_tmp/ +/tmp/ + +## Specific to RubyMotion: +.dat* +.repl_history +build/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalization: +/.bundle/ +/vendor/bundle +/lib/bundler/man/ + +# for a library or gem, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# Gemfile.lock +# .ruby-version +# .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..8191138 --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.3.0 \ No newline at end of file diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..83e16f8 --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--color +--require spec_helper diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..df46058 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,148 @@ +# This file is based on https://github.com/rails/rails/blob/master/.rubocop.yml (MIT license) +# Automatically generated by OpenAPI Generator (https://openapi-generator.tech) +AllCops: + TargetRubyVersion: 2.4 + # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop + # to ignore them, so only the ones explicitly set in this file are enabled. + DisabledByDefault: true + Exclude: + - '**/templates/**/*' + - '**/vendor/**/*' + - 'actionpack/lib/action_dispatch/journey/parser.rb' + +# Prefer &&/|| over and/or. +Style/AndOr: + Enabled: true + +# Align `when` with `case`. +Layout/CaseIndentation: + Enabled: true + +# Align comments with method definitions. +Layout/CommentIndentation: + Enabled: true + +Layout/ElseAlignment: + Enabled: true + +Layout/EmptyLineAfterMagicComment: + Enabled: true + +# In a regular class definition, no empty lines around the body. +Layout/EmptyLinesAroundClassBody: + Enabled: true + +# In a regular method definition, no empty lines around the body. +Layout/EmptyLinesAroundMethodBody: + Enabled: true + +# In a regular module definition, no empty lines around the body. +Layout/EmptyLinesAroundModuleBody: + Enabled: true + +Layout/FirstArgumentIndentation: + Enabled: true + +# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }. +Style/HashSyntax: + Enabled: false + +# Method definitions after `private` or `protected` isolated calls need one +# extra level of indentation. +Layout/IndentationConsistency: + Enabled: true + EnforcedStyle: indented_internal_methods + +# Two spaces, no tabs (for indentation). +Layout/IndentationWidth: + Enabled: true + +Layout/LeadingCommentSpace: + Enabled: true + +Layout/SpaceAfterColon: + Enabled: true + +Layout/SpaceAfterComma: + Enabled: true + +Layout/SpaceAroundEqualsInParameterDefault: + Enabled: true + +Layout/SpaceAroundKeyword: + Enabled: true + +Layout/SpaceAroundOperators: + Enabled: true + +Layout/SpaceBeforeComma: + Enabled: true + +Layout/SpaceBeforeFirstArg: + Enabled: true + +Style/DefWithParentheses: + Enabled: true + +# Defining a method with parameters needs parentheses. +Style/MethodDefParentheses: + Enabled: true + +Style/FrozenStringLiteralComment: + Enabled: false + EnforcedStyle: always + +# Use `foo {}` not `foo{}`. +Layout/SpaceBeforeBlockBraces: + Enabled: true + +# Use `foo { bar }` not `foo {bar}`. +Layout/SpaceInsideBlockBraces: + Enabled: true + +# Use `{ a: 1 }` not `{a:1}`. +Layout/SpaceInsideHashLiteralBraces: + Enabled: true + +Layout/SpaceInsideParens: + Enabled: true + +# Check quotes usage according to lint rule below. +#Style/StringLiterals: +# Enabled: true +# EnforcedStyle: single_quotes + +# Detect hard tabs, no hard tabs. +Layout/Tab: + Enabled: true + +# Blank lines should not have any spaces. +Layout/TrailingEmptyLines: + Enabled: true + +# No trailing whitespace. +Layout/TrailingWhitespace: + Enabled: false + +# Use quotes for string literals when they are enough. +Style/RedundantPercentQ: + Enabled: true + +# Align `end` with the matching keyword or starting expression except for +# assignments, where it should be aligned with the LHS. +Layout/EndAlignment: + Enabled: true + EnforcedStyleAlignWith: variable + AutoCorrect: true + +# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg. +Lint/RequireParentheses: + Enabled: true + +Style/RedundantReturn: + Enabled: true + AllowMultipleReturnValues: true + +Style/Semicolon: + Enabled: true + AllowAsExpressionSeparator: true diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..20469e3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: ruby +cache: bundler +rvm: + - 2.3 + - 2.4 + - 2.5 +script: + - bundle install --path vendor/bundle + - bundle exec rspec + - gem build Phrase.gemspec + - gem install ./Phrase-1.0.0.gem diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..c2e3127 --- /dev/null +++ b/Gemfile @@ -0,0 +1,9 @@ +source 'https://rubygems.org' + +gemspec + +group :development, :test do + gem 'rake', '~> 13.0.1' + gem 'pry-byebug' + gem 'rubocop', '~> 0.66.0' +end diff --git a/Phrase.gemspec b/Phrase.gemspec new file mode 100644 index 0000000..884910f --- /dev/null +++ b/Phrase.gemspec @@ -0,0 +1,28 @@ +# -*- encoding: utf-8 -*- + +$:.push File.expand_path("../lib", __FILE__) +require "Phrase/version" + +Gem::Specification.new do |s| + s.name = "Phrase" + s.version = Phrase::VERSION + s.platform = Gem::Platform::RUBY + s.authors = ["Phrase"] + s.email = ["support@phrase.com"] + s.homepage = "https://developers.phrase.com/api/" + s.summary = "You can collaborate on language file translation with your team or order translations through our platform. The API allows you to import locale files, download locale files, tag keys or interact in other ways with the localization data stored in Phrase for your account." + s.description = "Phrase is a translation management platform for software projects." + s.license = 'MIT' + s.required_ruby_version = ">= 1.9" + + s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' + s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0' + s.add_runtime_dependency 'link-header-parser' + + s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0' + + s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? } + s.test_files = `find spec/*`.split("\n") + s.executables = [] + s.require_paths = ["lib"] +end diff --git a/README.md b/README.md index e96941f..d28454b 100644 --- a/README.md +++ b/README.md @@ -1 +1,775 @@ -# phrase-ruby \ No newline at end of file +# Phrase + +Phrase - the Ruby gem for the Phrase API Reference + +Phrase is a translation management platform for software projects. You can collaborate on language file translation with your team or order translations through our platform. The API allows you to import locale files, download locale files, tag keys or interact in other ways with the localization data stored in Phrase for your account. + +## API Endpoint + +
+
+
https://api.phrase.com/v2/
+
+
+ +The API is only accessible via HTTPS, the base URL is https://api.phrase.com/, and the current version is v2 which results in the base URL for all requests: https://api.phrase.com/v2/. + + +## Usage + +[curl](http://curl.haxx.se/) is used primarily to send requests to Phrase in the examples. On most you'll find a second variant using the [Phrase API v2 client](https://phrase.com/cli/) that might be more convenient to handle. For further information check its [documentation](https://help.phrase.com/help/phrase-in-your-terminal). + + +## Use of HTTP Verbs + +Phrase API v2 tries to use the appropriate HTTP verb for accessing each endpoint according to REST specification where possible: + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VerbDescription
GETRetrieve one or multiple resources
POSTCreate a resource
PUTUpdate a resource
PATCHUpdate a resource (partially)
DELETEDelete a resource
+
+ + +## Identification via User-Agent + +You must include the User-Agent header with the name of your application or project. It might be a good idea to include some sort of contact information as well, so that we can get in touch if necessary (e.g. to warn you about Rate-Limiting or badly formed requests). Examples of excellent User-Agent headers: + +
User-Agent: Frederiks Mobile App (frederik@phrase.com)
+User-Agent: ACME Inc Python Client (http://example.com/contact)
+ +If you don't send this header, you will receive a response with 400 Bad Request. + + +## Lists + +When you request a list of resources, the API will typically only return an array of resources including their most important attributes. For a detailed representation of the resource you should request its detailed representation. + +Lists are usually [paginated](#pagination). + + +## Parameters + +Many endpoints support additional parameters, e.g. for pagination. When passing them in a GET request you can send them as HTTP query string parameters: + +
$ curl -u EMAIL_OR_ACCESS_TOKEN \"https://api.phrase.com/v2/projects?page=2\"
+ +When performing a POST, PUT, PATCH or DELETE request, we recommend sending parameters that are not already included in the URL, as JSON body: + +
$ curl -H 'Content-Type: application/json' -d '{\"name\":\"My new project\"}' -u EMAIL_OR_ACCESS_TOKEN https://api.phrase.com/v2/projects
+ +Encoding parameters as JSON means better support for types (boolean, integer) and usually better readability. Don't forget to set the correct Content-Type for your request. + +*The Content-Type header is omitted in some of the following examples for better readbility.* + + +## Errors + + +### Request Errors + +If a request contains invalid JSON or is missing a required parameter (besides resource attributes), the status `400 Bad Request` is returned: + +
{
+  \"message\": \"JSON could not be parsed\"
+}
+ + +### Validation Errors + +When the validation for a resource fails, the status `422 Unprocessable Entity` is returned, along with information on the affected fields: + +
{
+  \"message\": \"Validation Failed\",
+  \"errors\": [
+    {
+      \"resource\": \"Project\",
+      \"field\": \"name\",
+      \"message\": \"can't be blank\"
+    }
+  ]
+}
+ + +## Date Format + +Times and dates are returned and expected in [ISO 8601](http://en.wikipedia.org/wiki/ISO_8601) date format: + +
YYYY-MM-DDTHH:MM:SSZ
+ +Instead of 'Z' for UTC time zone you can specify your time zone's locale offset using the following notation: + +
YYYY-MM-DDTHH:MM:SS±hh:mm
+ +Example for CET (1 hour behind UTC): + +
2015-03-31T13:00+01:00
+ +Please note that in HTTP headers, we will use the appropriate recommended date formats instead of ISO 8601. + + +## Authentication + +
For more detailed information on authentication, check out the API v2 Authentication Guide.
+ +There are two different ways to authenticate when performing API requests: + +* E-Mail and password +* Oauth Access Token + + +### E-Mail and password + +To get started easily, you can use HTTP Basic authentication with your email and password: + +
$ curl -u username:password \"https://api.phrase.com/v2/projects\"
+ + +### OAuth via Access Tokens + +You can create and manage access tokens in your [profile settings](https://app.phrase.com/settings/oauth_access_tokens) in Translation Center or via the [Authorizations API](#authorizations). + +Simply pass the access token as the username of your request: + +
$ curl -u ACCESS_TOKEN: \"https://api.phrase.com/v2/projects\"
+ +or send the access token via the `Authorization` header field: + +
$ curl -H \"Authorization: token ACCESS_TOKEN\" https://api.phrase.com/v2/projects
+ +For more detailed information on authentication, check out the API v2 Authentication Guide. + +#### Send via parameter + +As JSONP (and other) requests cannot send HTTP Basic Auth credentials, a special query parameter `access_token` can be used: + +
curl \"https://api.phrase.com/v2/projects?access_token=ACCESS_TOKEN\"
+ +You should only use this transport method if sending the authentication via header or Basic authentication is not possible. + +### Two-Factor-Authentication + +Users with Two-Factor-Authentication enabled have to send a valid token along their request with certain authentication methods (such as Basic authentication). The necessity of a Two-Factor-Authentication token is indicated by the `X-PhraseApp-OTP: required; :MFA-type` header in the response. The `:MFA-type`field indicates the source of the token, e.g. `app` (refers to your Authenticator application): + +
X-PhraseApp-OTP: required; app
+ +To provide a Two-Factor-Authentication token you can simply send it in the header of the request: + +
curl -H \"X-PhraseApp-OTP: MFA-TOKEN\" -u EMAIL https://api.phrase.com/v2/projects
+ +Since Two-Factor-Authentication tokens usually expire quickly, we recommend using an alternative authentication method such as OAuth access tokens. + +### Multiple Accounts + +Some endpoints require the account ID to be specified if the authenticated user is a member of multiple accounts. You can find the eight-digit account ID inside Translation Center by switching to the desired account and then visiting the account details page. If required, you can specify the account just like a normal parameter within the request. + +## Pagination + +Endpoints that return a list or resources will usually return paginated results and include 25 items by default. To access further pages, use the `page` parameter: + +
$ curl -u EMAIL_OR_ACCESS_TOKEN \"https://api.phrase.com/v2/projects?page=2\"
+ +Some endpoints also allow a custom page size by using the `per_page` parameter: + +
$ curl -u EMAIL_OR_ACCESS_TOKEN \"https://api.phrase.com/v2/projects?page=2&per_page=50\"
+ +Unless specified otherwise in the description of the respective endpoint, `per_page` allows you to specify a page size up to 100 items. + + +## Link-Headers + +We provide you with pagination URLs in the [Link Header field](http://tools.ietf.org/html/rfc5988). Make use of this information to avoid building pagination URLs yourself. + +
Link: ; rel=\"first\", ; rel=\"prev\", ; rel=\"next\", ; rel=\"last\"
+ +Possible `rel` values are: + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
nextURL of the next page of results
lastURL of the last page of results
firstURL of the first page of results
prevURL of the previous page of results
+
+ +## Rate Limiting + +All API endpoints are subject to rate limiting to ensure good performance for all customers. The rate limit is calculated per user: + +* 1000 requests per 5 minutes +* 4 concurrent (parallel) requests + +For your convenience we send information on the current rate limit within the response headers: + +
+ + + + + + + + + + + + + + + + + + + + + +
HeaderDescription
X-Rate-Limit-LimitNumber of max requests allowed in the current time period
X-Rate-Limit-RemainingNumber of remaining requests in the current time period
X-Rate-Limit-ResetTimestamp of end of current time period as UNIX timestamp
+
+ +If you should run into the rate limit, you will receive the HTTP status code `429: Too many requests`. + +If you should need higher rate limits, [contact us](https://phrase.com/contact). + + +## Conditional GET requests / HTTP Caching + +

Note: Conditional GET requests are currently only supported for locales#download and translations#index

+ +We will return an ETag or Last-Modified header with most GET requests. When you request a resource we recommend to store this value and submit them on subsequent requests as `If-Modified-Since` and `If-None-Match` headers. If the resource has not changed in the meantime, we will return the status `304 Not Modified` instead of rendering and returning the resource again. In most cases this is less time-consuming and makes your application/integration faster. + +Please note that all conditional requests that return a response with status 304 don't count against your rate limits. + +
$ curl -i -u EMAIL_OR_ACCESS_TOKEN \"https://api.phrase.com/v2/projects/1234abcd1234abcdefefabcd1234efab/locales/en/download\"
+HTTP/1.1 200 OK
+ETag: \"abcd1234abcdefefabcd1234efab1234\"
+Last-Modified: Wed, 28 Jan 2015 15:31:30 UTC
+Status: 200 OK
+
+$ curl -i -u EMAIL_OR_ACCESS_TOKEN \"https://api.phrase.com/v2/projects/1234abcd1234abcdefefabcd1234efab/locales/en/download\" -H 'If-None-Match: \"abcd1234abcdefefabcd1234efab1234\"'
+HTTP/1.1 304 Not Modified
+ETag: \"abcd1234abcdefefabcd1234efab1234\"
+Last-Modified: Wed, 28 Jan 2015 15:31:30 UTC
+Status: 304 Not Modified
+
+$ curl -i -u EMAIL_OR_ACCESS_TOKEN \"https://api.phrase.com/v2/projects/1234abcd1234abcdefefabcd1234efab/locales/en/download\" -H \"If-Modified-Since: Wed, 28 Jan 2015 15:31:30 UTC\"
+HTTP/1.1 304 Not Modified
+Last-Modified: Wed, 28 Jan 2015 15:31:30 UTC
+Status: 304 Not Modified
+ + +## JSONP + +The Phrase API supports [JSONP](http://en.wikipedia.org/wiki/JSONP) for all GET requests in order to deal with cross-domain request issues. Just send a `?callback` parameter along with the request to specify the Javascript function name to be called with the response content: + +
$ curl \"https://api.phrase.com/v2/projects?callback=myFunction\"
+ +The response will include the normal output for that endpoint, along with a `meta` section including header data: + +
myFunction({
+  {
+    \"meta\": {
+      \"status\": 200,
+      ...
+    },
+    \"data\": [
+      {
+        \"id\": \"1234abcd1234abc1234abcd1234abc\"
+        ...
+      }
+    ]
+  }
+});
+ +To authenticate a JSONP request, you can send a valid [access token](#authentication) as the `?access_token` parameter along the request: + +
$ curl \"https://api.phrase.com/v2/projects?callback=myFunction&access_token=ACCESS-TOKEN\"
+ + +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 2.0.0 +- Package version: 1.0.0 +- Build package: org.openapitools.codegen.languages.RubyClientCodegen +For more information, please visit [https://developers.phrase.com/api/](https://developers.phrase.com/api/) + +## Installation + +### Build a gem + +To build the Ruby code into a gem: + +```shell +gem build Phrase.gemspec +``` + +Then either install the gem locally: + +```shell +gem install ./Phrase-1.0.0.gem +``` + +(for development, run `gem install --dev ./Phrase-1.0.0.gem` to install the development dependencies) + +or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). + +Finally add this to the Gemfile: + + gem 'Phrase', '~> 1.0.0' + +### Install from Git + +If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile: + + gem 'Phrase', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git' + +### Include the Ruby code directly + +Include the Ruby code directly using `-I` as follows: + +```shell +ruby -Ilib script.rb +``` + +## Getting Started + +Please follow the [installation](#installation) procedure and then run the following code: + +```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' + + # Or configure API key authorization: Token + config.api_key['Authorization'] = 'YOUR API KEY' + config.api_key_prefix['Authorization'] = 'token' +end + +api_instance = Phrase::AccountsApi.new +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single account + result = api_instance.account_show(id, opts) + pp result + pp result.next_page? + pp result.next_page +rescue Phrase::ApiError => e + puts "Exception when calling AccountsApi->account_show: #{e}" +end + +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://api.phrase.com/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*Phrase::AccountsApi* | [**account_show**](docs/AccountsApi.md#account_show) | **GET** /accounts/{id} | Get a single account +*Phrase::AccountsApi* | [**accounts_list**](docs/AccountsApi.md#accounts_list) | **GET** /accounts | List accounts +*Phrase::AuthorizationsApi* | [**authorization_create**](docs/AuthorizationsApi.md#authorization_create) | **POST** /authorizations | Create an authorization +*Phrase::AuthorizationsApi* | [**authorization_delete**](docs/AuthorizationsApi.md#authorization_delete) | **DELETE** /authorizations/{id} | Delete an authorization +*Phrase::AuthorizationsApi* | [**authorization_show**](docs/AuthorizationsApi.md#authorization_show) | **GET** /authorizations/{id} | Get a single authorization +*Phrase::AuthorizationsApi* | [**authorization_update**](docs/AuthorizationsApi.md#authorization_update) | **PATCH** /authorizations/{id} | Update an authorization +*Phrase::AuthorizationsApi* | [**authorizations_list**](docs/AuthorizationsApi.md#authorizations_list) | **GET** /authorizations | List authorizations +*Phrase::BitbucketSyncApi* | [**bitbucket_sync_export**](docs/BitbucketSyncApi.md#bitbucket_sync_export) | **POST** /bitbucket_syncs/{id}/export | Export from Phrase to Bitbucket +*Phrase::BitbucketSyncApi* | [**bitbucket_sync_import**](docs/BitbucketSyncApi.md#bitbucket_sync_import) | **POST** /bitbucket_syncs/{id}/import | Import to Phrase from Bitbucket +*Phrase::BitbucketSyncApi* | [**bitbucket_syncs_list**](docs/BitbucketSyncApi.md#bitbucket_syncs_list) | **GET** /bitbucket_syncs | List Bitbucket syncs +*Phrase::BlacklistedKeysApi* | [**blacklisted_key_create**](docs/BlacklistedKeysApi.md#blacklisted_key_create) | **POST** /projects/{project_id}/blacklisted_keys | Create a blacklisted key +*Phrase::BlacklistedKeysApi* | [**blacklisted_key_delete**](docs/BlacklistedKeysApi.md#blacklisted_key_delete) | **DELETE** /projects/{project_id}/blacklisted_keys/{id} | Delete a blacklisted key +*Phrase::BlacklistedKeysApi* | [**blacklisted_key_show**](docs/BlacklistedKeysApi.md#blacklisted_key_show) | **GET** /projects/{project_id}/blacklisted_keys/{id} | Get a single blacklisted key +*Phrase::BlacklistedKeysApi* | [**blacklisted_key_update**](docs/BlacklistedKeysApi.md#blacklisted_key_update) | **PATCH** /projects/{project_id}/blacklisted_keys/{id} | Update a blacklisted key +*Phrase::BlacklistedKeysApi* | [**blacklisted_keys_list**](docs/BlacklistedKeysApi.md#blacklisted_keys_list) | **GET** /projects/{project_id}/blacklisted_keys | List blacklisted keys +*Phrase::BranchesApi* | [**branch_compare**](docs/BranchesApi.md#branch_compare) | **GET** /projects/{project_id}/branches/{name}/compare | Compare branches +*Phrase::BranchesApi* | [**branch_create**](docs/BranchesApi.md#branch_create) | **POST** /projects/{project_id}/branches | Create a branch +*Phrase::BranchesApi* | [**branch_delete**](docs/BranchesApi.md#branch_delete) | **DELETE** /projects/{project_id}/branches/{name} | Delete a branch +*Phrase::BranchesApi* | [**branch_merge**](docs/BranchesApi.md#branch_merge) | **PATCH** /projects/{project_id}/branches/{name}/merge | Merge a branch +*Phrase::BranchesApi* | [**branch_show**](docs/BranchesApi.md#branch_show) | **GET** /projects/{project_id}/branches/{name} | Get a single branch +*Phrase::BranchesApi* | [**branch_update**](docs/BranchesApi.md#branch_update) | **PATCH** /projects/{project_id}/branches/{name} | Update a branch +*Phrase::BranchesApi* | [**branches_list**](docs/BranchesApi.md#branches_list) | **GET** /projects/{project_id}/branches | List branches +*Phrase::CommentsApi* | [**comment_create**](docs/CommentsApi.md#comment_create) | **POST** /projects/{project_id}/keys/{key_id}/comments | Create a comment +*Phrase::CommentsApi* | [**comment_delete**](docs/CommentsApi.md#comment_delete) | **DELETE** /projects/{project_id}/keys/{key_id}/comments/{id} | Delete a comment +*Phrase::CommentsApi* | [**comment_mark_check**](docs/CommentsApi.md#comment_mark_check) | **GET** /projects/{project_id}/keys/{key_id}/comments/{id}/read | Check if comment is read +*Phrase::CommentsApi* | [**comment_mark_read**](docs/CommentsApi.md#comment_mark_read) | **PATCH** /projects/{project_id}/keys/{key_id}/comments/{id}/read | Mark a comment as read +*Phrase::CommentsApi* | [**comment_mark_unread**](docs/CommentsApi.md#comment_mark_unread) | **DELETE** /projects/{project_id}/keys/{key_id}/comments/{id}/read | Mark a comment as unread +*Phrase::CommentsApi* | [**comment_show**](docs/CommentsApi.md#comment_show) | **GET** /projects/{project_id}/keys/{key_id}/comments/{id} | Get a single comment +*Phrase::CommentsApi* | [**comment_update**](docs/CommentsApi.md#comment_update) | **PATCH** /projects/{project_id}/keys/{key_id}/comments/{id} | Update a comment +*Phrase::CommentsApi* | [**comments_list**](docs/CommentsApi.md#comments_list) | **GET** /projects/{project_id}/keys/{key_id}/comments | List comments +*Phrase::DistributionsApi* | [**distribution_create**](docs/DistributionsApi.md#distribution_create) | **POST** /accounts/{account_id}/distributions | Create a distribution +*Phrase::DistributionsApi* | [**distribution_delete**](docs/DistributionsApi.md#distribution_delete) | **DELETE** /accounts/{account_id}/distributions/{id} | Delete a distribution +*Phrase::DistributionsApi* | [**distribution_show**](docs/DistributionsApi.md#distribution_show) | **GET** /accounts/{account_id}/distributions/{id} | Get a single distribution +*Phrase::DistributionsApi* | [**distribution_update**](docs/DistributionsApi.md#distribution_update) | **PATCH** /accounts/{account_id}/distributions/{id} | Update a distribution +*Phrase::DistributionsApi* | [**distributions_list**](docs/DistributionsApi.md#distributions_list) | **GET** /accounts/{account_id}/distributions | List distributions +*Phrase::FormatsApi* | [**formats_list**](docs/FormatsApi.md#formats_list) | **GET** /formats | List formats +*Phrase::GitLabSyncApi* | [**gitlab_sync_delete**](docs/GitLabSyncApi.md#gitlab_sync_delete) | **DELETE** /gitlab_syncs/{id} | Delete single Sync Setting +*Phrase::GitLabSyncApi* | [**gitlab_sync_export**](docs/GitLabSyncApi.md#gitlab_sync_export) | **POST** /gitlab_syncs/{gitlab_sync_id}/export | Export from Phrase to GitLab +*Phrase::GitLabSyncApi* | [**gitlab_sync_history**](docs/GitLabSyncApi.md#gitlab_sync_history) | **GET** /gitlab_syncs/{gitlab_sync_id}/history | History of single Sync Setting +*Phrase::GitLabSyncApi* | [**gitlab_sync_import**](docs/GitLabSyncApi.md#gitlab_sync_import) | **POST** /gitlab_syncs/{gitlab_sync_id}/import | Import from GitLab to Phrase +*Phrase::GitLabSyncApi* | [**gitlab_sync_list**](docs/GitLabSyncApi.md#gitlab_sync_list) | **GET** /gitlab_syncs | List GitLab syncs +*Phrase::GitLabSyncApi* | [**gitlab_sync_show**](docs/GitLabSyncApi.md#gitlab_sync_show) | **GET** /gitlab_syncs/{id} | Get single Sync Setting +*Phrase::GitLabSyncApi* | [**gitlab_sync_update**](docs/GitLabSyncApi.md#gitlab_sync_update) | **PUT** /gitlab_syncs/{id} | Update single Sync Setting +*Phrase::GlossaryApi* | [**glossaries_list**](docs/GlossaryApi.md#glossaries_list) | **GET** /accounts/{account_id}/glossaries | List glossaries +*Phrase::GlossaryApi* | [**glossary_create**](docs/GlossaryApi.md#glossary_create) | **POST** /accounts/{account_id}/glossaries | Create a glossary +*Phrase::GlossaryApi* | [**glossary_delete**](docs/GlossaryApi.md#glossary_delete) | **DELETE** /accounts/{account_id}/glossaries/{id} | Delete a glossary +*Phrase::GlossaryApi* | [**glossary_show**](docs/GlossaryApi.md#glossary_show) | **GET** /accounts/{account_id}/glossaries/{id} | Get a single glossary +*Phrase::GlossaryApi* | [**glossary_update**](docs/GlossaryApi.md#glossary_update) | **PATCH** /accounts/{account_id}/glossaries/{id} | Update a glossary +*Phrase::GlossaryTermTranslationsApi* | [**glossary_term_translation_create**](docs/GlossaryTermTranslationsApi.md#glossary_term_translation_create) | **POST** /accounts/{account_id}/glossaries/{glossary_id}/terms/{term_id}/translations | Create a glossary term translation +*Phrase::GlossaryTermTranslationsApi* | [**glossary_term_translation_delete**](docs/GlossaryTermTranslationsApi.md#glossary_term_translation_delete) | **DELETE** /accounts/{account_id}/glossaries/{glossary_id}/terms/{term_id}/translations/{id} | Delete a glossary term translation +*Phrase::GlossaryTermTranslationsApi* | [**glossary_term_translation_update**](docs/GlossaryTermTranslationsApi.md#glossary_term_translation_update) | **PATCH** /accounts/{account_id}/glossaries/{glossary_id}/terms/{term_id}/translations/{id} | Update a glossary term translation +*Phrase::GlossaryTermsApi* | [**glossary_term_create**](docs/GlossaryTermsApi.md#glossary_term_create) | **POST** /accounts/{account_id}/glossaries/{glossary_id}/terms | Create a glossary term +*Phrase::GlossaryTermsApi* | [**glossary_term_delete**](docs/GlossaryTermsApi.md#glossary_term_delete) | **DELETE** /accounts/{account_id}/glossaries/{glossary_id}/terms/{id} | Delete a glossary term +*Phrase::GlossaryTermsApi* | [**glossary_term_show**](docs/GlossaryTermsApi.md#glossary_term_show) | **GET** /accounts/{account_id}/glossaries/{glossary_id}/terms/{id} | Get a single glossary term +*Phrase::GlossaryTermsApi* | [**glossary_term_update**](docs/GlossaryTermsApi.md#glossary_term_update) | **PATCH** /accounts/{account_id}/glossaries/{glossary_id}/terms/{id} | Update a glossary term +*Phrase::GlossaryTermsApi* | [**glossary_terms_list**](docs/GlossaryTermsApi.md#glossary_terms_list) | **GET** /accounts/{account_id}/glossaries/{glossary_id}/terms | List glossary terms +*Phrase::InvitationsApi* | [**invitation_create**](docs/InvitationsApi.md#invitation_create) | **POST** /accounts/{account_id}/invitations | Create a new invitation +*Phrase::InvitationsApi* | [**invitation_delete**](docs/InvitationsApi.md#invitation_delete) | **DELETE** /accounts/{account_id}/invitations/{id} | Delete an invitation +*Phrase::InvitationsApi* | [**invitation_resend**](docs/InvitationsApi.md#invitation_resend) | **POST** /accounts/{account_id}/invitations/{id}/resend | Resend an invitation +*Phrase::InvitationsApi* | [**invitation_show**](docs/InvitationsApi.md#invitation_show) | **GET** /accounts/{account_id}/invitations/{id} | Get a single invitation +*Phrase::InvitationsApi* | [**invitation_update**](docs/InvitationsApi.md#invitation_update) | **PATCH** /accounts/{account_id}/invitations/{id} | Update an invitation +*Phrase::InvitationsApi* | [**invitations_list**](docs/InvitationsApi.md#invitations_list) | **GET** /accounts/{account_id}/invitations | List invitations +*Phrase::JobLocalesApi* | [**job_locale_complete**](docs/JobLocalesApi.md#job_locale_complete) | **POST** /projects/{project_id}/jobs/{job_id}/locales/{id}/complete | Complete a job locale +*Phrase::JobLocalesApi* | [**job_locale_delete**](docs/JobLocalesApi.md#job_locale_delete) | **DELETE** /projects/{project_id}/jobs/{job_id}/locales/{id} | Delete a job locale +*Phrase::JobLocalesApi* | [**job_locale_reopen**](docs/JobLocalesApi.md#job_locale_reopen) | **POST** /projects/{project_id}/jobs/{job_id}/locales/{id}/reopen | Reopen a job locale +*Phrase::JobLocalesApi* | [**job_locale_show**](docs/JobLocalesApi.md#job_locale_show) | **GET** /projects/{project_id}/jobs/{job_id}/locale/{id} | Get a single job locale +*Phrase::JobLocalesApi* | [**job_locale_update**](docs/JobLocalesApi.md#job_locale_update) | **PATCH** /projects/{project_id}/jobs/{job_id}/locales/{id} | Update a job locale +*Phrase::JobLocalesApi* | [**job_locales_create**](docs/JobLocalesApi.md#job_locales_create) | **POST** /projects/{project_id}/jobs/{job_id}/locales | Create a job locale +*Phrase::JobLocalesApi* | [**job_locales_list**](docs/JobLocalesApi.md#job_locales_list) | **GET** /projects/{project_id}/jobs/{job_id}/locales | List job locales +*Phrase::JobsApi* | [**job_complete**](docs/JobsApi.md#job_complete) | **POST** /projects/{project_id}/jobs/{id}/complete | Complete a job +*Phrase::JobsApi* | [**job_create**](docs/JobsApi.md#job_create) | **POST** /projects/{project_id}/jobs | Create a job +*Phrase::JobsApi* | [**job_delete**](docs/JobsApi.md#job_delete) | **DELETE** /projects/{project_id}/jobs/{id} | Delete a job +*Phrase::JobsApi* | [**job_keys_create**](docs/JobsApi.md#job_keys_create) | **POST** /projects/{project_id}/jobs/{id}/keys | Add keys to job +*Phrase::JobsApi* | [**job_keys_delete**](docs/JobsApi.md#job_keys_delete) | **DELETE** /projects/{project_id}/jobs/{id}/keys | Remove keys from job +*Phrase::JobsApi* | [**job_reopen**](docs/JobsApi.md#job_reopen) | **POST** /projects/{project_id}/jobs/{id}/reopen | Reopen a job +*Phrase::JobsApi* | [**job_show**](docs/JobsApi.md#job_show) | **GET** /projects/{project_id}/jobs/{id} | Get a single job +*Phrase::JobsApi* | [**job_start**](docs/JobsApi.md#job_start) | **POST** /projects/{project_id}/jobs/{id}/start | Start a job +*Phrase::JobsApi* | [**job_update**](docs/JobsApi.md#job_update) | **PATCH** /projects/{project_id}/jobs/{id} | Update a job +*Phrase::JobsApi* | [**jobs_list**](docs/JobsApi.md#jobs_list) | **GET** /projects/{project_id}/jobs | List jobs +*Phrase::KeysApi* | [**key_create**](docs/KeysApi.md#key_create) | **POST** /projects/{project_id}/keys | Create a key +*Phrase::KeysApi* | [**key_delete**](docs/KeysApi.md#key_delete) | **DELETE** /projects/{project_id}/keys/{id} | Delete a key +*Phrase::KeysApi* | [**key_show**](docs/KeysApi.md#key_show) | **GET** /projects/{project_id}/keys/{id} | Get a single key +*Phrase::KeysApi* | [**key_update**](docs/KeysApi.md#key_update) | **PATCH** /projects/{project_id}/keys/{id} | Update a key +*Phrase::KeysApi* | [**keys_delete**](docs/KeysApi.md#keys_delete) | **DELETE** /projects/{project_id}/keys | Delete collection of keys +*Phrase::KeysApi* | [**keys_list**](docs/KeysApi.md#keys_list) | **GET** /projects/{project_id}/keys | List keys +*Phrase::KeysApi* | [**keys_search**](docs/KeysApi.md#keys_search) | **POST** /projects/{project_id}/keys/search | Search keys +*Phrase::KeysApi* | [**keys_tag**](docs/KeysApi.md#keys_tag) | **PATCH** /projects/{project_id}/keys/tag | Add tags to collection of keys +*Phrase::KeysApi* | [**keys_untag**](docs/KeysApi.md#keys_untag) | **PATCH** /projects/{project_id}/keys/untag | Remove tags from collection of keys +*Phrase::LocalesApi* | [**locale_create**](docs/LocalesApi.md#locale_create) | **POST** /projects/{project_id}/locales | Create a locale +*Phrase::LocalesApi* | [**locale_delete**](docs/LocalesApi.md#locale_delete) | **DELETE** /projects/{project_id}/locales/{id} | Delete a locale +*Phrase::LocalesApi* | [**locale_download**](docs/LocalesApi.md#locale_download) | **GET** /projects/{project_id}/locales/{id}/download | Download a locale +*Phrase::LocalesApi* | [**locale_show**](docs/LocalesApi.md#locale_show) | **GET** /projects/{project_id}/locales/{id} | Get a single locale +*Phrase::LocalesApi* | [**locale_update**](docs/LocalesApi.md#locale_update) | **PATCH** /projects/{project_id}/locales/{id} | Update a locale +*Phrase::LocalesApi* | [**locales_list**](docs/LocalesApi.md#locales_list) | **GET** /projects/{project_id}/locales | List locales +*Phrase::MembersApi* | [**member_delete**](docs/MembersApi.md#member_delete) | **DELETE** /accounts/{account_id}/members/{id} | Remove a user from the account +*Phrase::MembersApi* | [**member_show**](docs/MembersApi.md#member_show) | **GET** /accounts/{account_id}/members/{id} | Get single member +*Phrase::MembersApi* | [**member_update**](docs/MembersApi.md#member_update) | **PATCH** /accounts/{account_id}/members/{id} | Update a member +*Phrase::MembersApi* | [**members_list**](docs/MembersApi.md#members_list) | **GET** /accounts/{account_id}/members | List members +*Phrase::OrdersApi* | [**order_confirm**](docs/OrdersApi.md#order_confirm) | **PATCH** /projects/{project_id}/orders/{id}/confirm | Confirm an order +*Phrase::OrdersApi* | [**order_create**](docs/OrdersApi.md#order_create) | **POST** /projects/{project_id}/orders | Create a new order +*Phrase::OrdersApi* | [**order_delete**](docs/OrdersApi.md#order_delete) | **DELETE** /projects/{project_id}/orders/{id} | Cancel an order +*Phrase::OrdersApi* | [**order_show**](docs/OrdersApi.md#order_show) | **GET** /projects/{project_id}/orders/{id} | Get a single order +*Phrase::OrdersApi* | [**orders_list**](docs/OrdersApi.md#orders_list) | **GET** /projects/{project_id}/orders | List orders +*Phrase::ProjectsApi* | [**project_create**](docs/ProjectsApi.md#project_create) | **POST** /projects | Create a project +*Phrase::ProjectsApi* | [**project_delete**](docs/ProjectsApi.md#project_delete) | **DELETE** /projects/{id} | Delete a project +*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::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 +*Phrase::ReleasesApi* | [**release_show**](docs/ReleasesApi.md#release_show) | **GET** /accounts/{account_id}/distributions/{distribution_id}/releases/{id} | Get a single release +*Phrase::ReleasesApi* | [**release_update**](docs/ReleasesApi.md#release_update) | **PATCH** /accounts/{account_id}/distributions/{distribution_id}/releases/{id} | Update a release +*Phrase::ReleasesApi* | [**releases_list**](docs/ReleasesApi.md#releases_list) | **GET** /accounts/{account_id}/distributions/{distribution_id}/releases | List releases +*Phrase::ScreenshotMarkersApi* | [**screenshot_marker_create**](docs/ScreenshotMarkersApi.md#screenshot_marker_create) | **POST** /projects/{project_id}/screenshots/{screenshot_id}/markers | Create a screenshot marker +*Phrase::ScreenshotMarkersApi* | [**screenshot_marker_delete**](docs/ScreenshotMarkersApi.md#screenshot_marker_delete) | **DELETE** /projects/{project_id}/screenshots/{screenshot_id}/markers | Delete a screenshot marker +*Phrase::ScreenshotMarkersApi* | [**screenshot_marker_show**](docs/ScreenshotMarkersApi.md#screenshot_marker_show) | **GET** /projects/{project_id}/screenshots/{screenshot_id}/markers/{id} | Get a single screenshot marker +*Phrase::ScreenshotMarkersApi* | [**screenshot_marker_update**](docs/ScreenshotMarkersApi.md#screenshot_marker_update) | **PATCH** /projects/{project_id}/screenshots/{screenshot_id}/markers | Update a screenshot marker +*Phrase::ScreenshotMarkersApi* | [**screenshot_markers_list**](docs/ScreenshotMarkersApi.md#screenshot_markers_list) | **GET** /projects/{project_id}/screenshots/{id}/markers | List screenshot markers +*Phrase::ScreenshotsApi* | [**screenshot_create**](docs/ScreenshotsApi.md#screenshot_create) | **POST** /projects/{project_id}/screenshots | Create a screenshot +*Phrase::ScreenshotsApi* | [**screenshot_delete**](docs/ScreenshotsApi.md#screenshot_delete) | **DELETE** /projects/{project_id}/screenshots/{id} | Delete a screenshot +*Phrase::ScreenshotsApi* | [**screenshot_show**](docs/ScreenshotsApi.md#screenshot_show) | **GET** /projects/{project_id}/screenshots/{id} | Get a single screenshot +*Phrase::ScreenshotsApi* | [**screenshot_update**](docs/ScreenshotsApi.md#screenshot_update) | **PATCH** /projects/{project_id}/screenshots/{id} | Update a screenshot +*Phrase::ScreenshotsApi* | [**screenshots_list**](docs/ScreenshotsApi.md#screenshots_list) | **GET** /projects/{project_id}/screenshots | List screenshots +*Phrase::SpacesApi* | [**space_create**](docs/SpacesApi.md#space_create) | **POST** /accounts/{account_id}/spaces | Create a Space +*Phrase::SpacesApi* | [**space_delete**](docs/SpacesApi.md#space_delete) | **DELETE** /accounts/{account_id}/spaces/{id} | Delete Space +*Phrase::SpacesApi* | [**space_show**](docs/SpacesApi.md#space_show) | **GET** /accounts/{account_id}/spaces/{id} | Get Space +*Phrase::SpacesApi* | [**space_update**](docs/SpacesApi.md#space_update) | **PATCH** /accounts/{account_id}/spaces/{id} | Update Space +*Phrase::SpacesApi* | [**spaces_list**](docs/SpacesApi.md#spaces_list) | **GET** /accounts/{account_id}/spaces | List Spaces +*Phrase::SpacesApi* | [**spaces_projects_create**](docs/SpacesApi.md#spaces_projects_create) | **POST** /accounts/{account_id}/spaces/{space_id}/projects | Add Project +*Phrase::SpacesApi* | [**spaces_projects_delete**](docs/SpacesApi.md#spaces_projects_delete) | **DELETE** /accounts/{account_id}/spaces/{space_id}/projects/{id} | Remove Project +*Phrase::SpacesApi* | [**spaces_projects_list**](docs/SpacesApi.md#spaces_projects_list) | **GET** /accounts/{account_id}/spaces/{space_id}/projects | List Projects +*Phrase::StyleGuidesApi* | [**styleguide_create**](docs/StyleGuidesApi.md#styleguide_create) | **POST** /projects/{project_id}/styleguides | Create a style guide +*Phrase::StyleGuidesApi* | [**styleguide_delete**](docs/StyleGuidesApi.md#styleguide_delete) | **DELETE** /projects/{project_id}/styleguides/{id} | Delete a style guide +*Phrase::StyleGuidesApi* | [**styleguide_show**](docs/StyleGuidesApi.md#styleguide_show) | **GET** /projects/{project_id}/styleguides/{id} | Get a single style guide +*Phrase::StyleGuidesApi* | [**styleguide_update**](docs/StyleGuidesApi.md#styleguide_update) | **PATCH** /projects/{project_id}/styleguides/{id} | Update a style guide +*Phrase::StyleGuidesApi* | [**styleguides_list**](docs/StyleGuidesApi.md#styleguides_list) | **GET** /projects/{project_id}/styleguides | List style guides +*Phrase::TagsApi* | [**tag_create**](docs/TagsApi.md#tag_create) | **POST** /projects/{project_id}/tags | Create a tag +*Phrase::TagsApi* | [**tag_delete**](docs/TagsApi.md#tag_delete) | **DELETE** /projects/{project_id}/tags/{name} | Delete a tag +*Phrase::TagsApi* | [**tag_show**](docs/TagsApi.md#tag_show) | **GET** /projects/{project_id}/tags/{name} | Get a single tag +*Phrase::TagsApi* | [**tags_list**](docs/TagsApi.md#tags_list) | **GET** /projects/{project_id}/tags | List tags +*Phrase::TranslationsApi* | [**translation_create**](docs/TranslationsApi.md#translation_create) | **POST** /projects/{project_id}/translations | Create a translation +*Phrase::TranslationsApi* | [**translation_exclude**](docs/TranslationsApi.md#translation_exclude) | **PATCH** /projects/{project_id}/translations/{id}/exclude | Exclude a translation from export +*Phrase::TranslationsApi* | [**translation_include**](docs/TranslationsApi.md#translation_include) | **PATCH** /projects/{project_id}/translations/{id}/include | Revoke exclusion of a translation in export +*Phrase::TranslationsApi* | [**translation_review**](docs/TranslationsApi.md#translation_review) | **PATCH** /projects/{project_id}/translations/{id}/review | Review a translation +*Phrase::TranslationsApi* | [**translation_show**](docs/TranslationsApi.md#translation_show) | **GET** /projects/{project_id}/translations/{id} | Get a single translation +*Phrase::TranslationsApi* | [**translation_unverify**](docs/TranslationsApi.md#translation_unverify) | **PATCH** /projects/{project_id}/translations/{id}/unverify | Mark a translation as unverified +*Phrase::TranslationsApi* | [**translation_update**](docs/TranslationsApi.md#translation_update) | **PATCH** /projects/{project_id}/translations/{id} | Update a translation +*Phrase::TranslationsApi* | [**translation_verify**](docs/TranslationsApi.md#translation_verify) | **PATCH** /projects/{project_id}/translations/{id}/verify | Verify a translation +*Phrase::TranslationsApi* | [**translations_by_key**](docs/TranslationsApi.md#translations_by_key) | **GET** /projects/{project_id}/keys/{key_id}/translations | List translations by key +*Phrase::TranslationsApi* | [**translations_by_locale**](docs/TranslationsApi.md#translations_by_locale) | **GET** /projects/{project_id}/locales/{locale_id}/translations | List translations by locale +*Phrase::TranslationsApi* | [**translations_exclude**](docs/TranslationsApi.md#translations_exclude) | **PATCH** /projects/{project_id}/translations/exclude | Set exclude from export flag on translations selected by query +*Phrase::TranslationsApi* | [**translations_include**](docs/TranslationsApi.md#translations_include) | **PATCH** /projects/{project_id}/translations/include | Remove exlude from import flag from translations selected by query +*Phrase::TranslationsApi* | [**translations_list**](docs/TranslationsApi.md#translations_list) | **GET** /projects/{project_id}/translations | List all translations +*Phrase::TranslationsApi* | [**translations_review**](docs/TranslationsApi.md#translations_review) | **PATCH** /projects/{project_id}/translations/review | Review translations selected by query +*Phrase::TranslationsApi* | [**translations_search**](docs/TranslationsApi.md#translations_search) | **POST** /projects/{project_id}/translations/search | Search translations +*Phrase::TranslationsApi* | [**translations_unverify**](docs/TranslationsApi.md#translations_unverify) | **PATCH** /projects/{project_id}/translations/unverify | Mark translations selected by query as unverified +*Phrase::TranslationsApi* | [**translations_verify**](docs/TranslationsApi.md#translations_verify) | **PATCH** /projects/{project_id}/translations/verify | Verify translations selected by query +*Phrase::UploadsApi* | [**upload_create**](docs/UploadsApi.md#upload_create) | **POST** /projects/{project_id}/uploads | Upload a new file +*Phrase::UploadsApi* | [**upload_show**](docs/UploadsApi.md#upload_show) | **GET** /projects/{project_id}/uploads/{id} | View upload details +*Phrase::UploadsApi* | [**uploads_list**](docs/UploadsApi.md#uploads_list) | **GET** /projects/{project_id}/uploads | List uploads +*Phrase::UsersApi* | [**show_user**](docs/UsersApi.md#show_user) | **GET** /user | Show current User +*Phrase::VersionsHistoryApi* | [**version_show**](docs/VersionsHistoryApi.md#version_show) | **GET** /projects/{project_id}/translations/{translation_id}/versions/{id} | Get a single version +*Phrase::VersionsHistoryApi* | [**versions_list**](docs/VersionsHistoryApi.md#versions_list) | **GET** /projects/{project_id}/translations/{translation_id}/versions | List all versions +*Phrase::WebhooksApi* | [**webhook_create**](docs/WebhooksApi.md#webhook_create) | **POST** /projects/{project_id}/webhooks | Create a webhook +*Phrase::WebhooksApi* | [**webhook_delete**](docs/WebhooksApi.md#webhook_delete) | **DELETE** /projects/{project_id}/webhooks/{id} | Delete a webhook +*Phrase::WebhooksApi* | [**webhook_show**](docs/WebhooksApi.md#webhook_show) | **GET** /projects/{project_id}/webhooks/{id} | Get a single webhook +*Phrase::WebhooksApi* | [**webhook_test**](docs/WebhooksApi.md#webhook_test) | **POST** /projects/{project_id}/webhooks/{id}/test | Test a webhook +*Phrase::WebhooksApi* | [**webhook_update**](docs/WebhooksApi.md#webhook_update) | **PATCH** /projects/{project_id}/webhooks/{id} | Update a webhook +*Phrase::WebhooksApi* | [**webhooks_list**](docs/WebhooksApi.md#webhooks_list) | **GET** /projects/{project_id}/webhooks | List webhooks + + +## Documentation for Models + + - [Phrase::Account](docs/Account.md) + - [Phrase::AffectedCount](docs/AffectedCount.md) + - [Phrase::AffectedResources](docs/AffectedResources.md) + - [Phrase::Authorization](docs/Authorization.md) + - [Phrase::AuthorizationCreate](docs/AuthorizationCreate.md) + - [Phrase::AuthorizationUpdate](docs/AuthorizationUpdate.md) + - [Phrase::BitbucketSync](docs/BitbucketSync.md) + - [Phrase::BitbucketSyncExport](docs/BitbucketSyncExport.md) + - [Phrase::BitbucketSyncExportResponse](docs/BitbucketSyncExportResponse.md) + - [Phrase::BitbucketSyncImport](docs/BitbucketSyncImport.md) + - [Phrase::BitbucketSyncsList](docs/BitbucketSyncsList.md) + - [Phrase::BlacklistedKey](docs/BlacklistedKey.md) + - [Phrase::BlacklistedKeyCreate](docs/BlacklistedKeyCreate.md) + - [Phrase::BlacklistedKeyUpdate](docs/BlacklistedKeyUpdate.md) + - [Phrase::Branch](docs/Branch.md) + - [Phrase::BranchCompare](docs/BranchCompare.md) + - [Phrase::BranchCreate](docs/BranchCreate.md) + - [Phrase::BranchMerge](docs/BranchMerge.md) + - [Phrase::BranchUpdate](docs/BranchUpdate.md) + - [Phrase::Comment](docs/Comment.md) + - [Phrase::CommentCreate](docs/CommentCreate.md) + - [Phrase::CommentDelete](docs/CommentDelete.md) + - [Phrase::CommentMarkCheck](docs/CommentMarkCheck.md) + - [Phrase::CommentMarkRead](docs/CommentMarkRead.md) + - [Phrase::CommentMarkUnread](docs/CommentMarkUnread.md) + - [Phrase::CommentShow](docs/CommentShow.md) + - [Phrase::CommentUpdate](docs/CommentUpdate.md) + - [Phrase::CommentsList](docs/CommentsList.md) + - [Phrase::Distribution](docs/Distribution.md) + - [Phrase::DistributionCreate](docs/DistributionCreate.md) + - [Phrase::DistributionPreview](docs/DistributionPreview.md) + - [Phrase::DistributionUpdate](docs/DistributionUpdate.md) + - [Phrase::Errors](docs/Errors.md) + - [Phrase::ErrorsErrors](docs/ErrorsErrors.md) + - [Phrase::Format](docs/Format.md) + - [Phrase::GitlabSync](docs/GitlabSync.md) + - [Phrase::GitlabSyncDelete](docs/GitlabSyncDelete.md) + - [Phrase::GitlabSyncExport](docs/GitlabSyncExport.md) + - [Phrase::GitlabSyncExport1](docs/GitlabSyncExport1.md) + - [Phrase::GitlabSyncHistory](docs/GitlabSyncHistory.md) + - [Phrase::GitlabSyncHistory1](docs/GitlabSyncHistory1.md) + - [Phrase::GitlabSyncImport](docs/GitlabSyncImport.md) + - [Phrase::GitlabSyncList](docs/GitlabSyncList.md) + - [Phrase::GitlabSyncShow](docs/GitlabSyncShow.md) + - [Phrase::GitlabSyncUpdate](docs/GitlabSyncUpdate.md) + - [Phrase::Glossary](docs/Glossary.md) + - [Phrase::GlossaryCreate](docs/GlossaryCreate.md) + - [Phrase::GlossaryTerm](docs/GlossaryTerm.md) + - [Phrase::GlossaryTermCreate](docs/GlossaryTermCreate.md) + - [Phrase::GlossaryTermTranslation](docs/GlossaryTermTranslation.md) + - [Phrase::GlossaryTermTranslationCreate](docs/GlossaryTermTranslationCreate.md) + - [Phrase::GlossaryTermTranslationUpdate](docs/GlossaryTermTranslationUpdate.md) + - [Phrase::GlossaryTermUpdate](docs/GlossaryTermUpdate.md) + - [Phrase::GlossaryUpdate](docs/GlossaryUpdate.md) + - [Phrase::Invitation](docs/Invitation.md) + - [Phrase::InvitationCreate](docs/InvitationCreate.md) + - [Phrase::InvitationUpdate](docs/InvitationUpdate.md) + - [Phrase::Job](docs/Job.md) + - [Phrase::JobComplete](docs/JobComplete.md) + - [Phrase::JobCreate](docs/JobCreate.md) + - [Phrase::JobDelete](docs/JobDelete.md) + - [Phrase::JobKeysCreate](docs/JobKeysCreate.md) + - [Phrase::JobKeysDelete](docs/JobKeysDelete.md) + - [Phrase::JobLocale](docs/JobLocale.md) + - [Phrase::JobLocaleComplete](docs/JobLocaleComplete.md) + - [Phrase::JobLocaleDelete](docs/JobLocaleDelete.md) + - [Phrase::JobLocaleReopen](docs/JobLocaleReopen.md) + - [Phrase::JobLocaleShow](docs/JobLocaleShow.md) + - [Phrase::JobLocaleUpdate](docs/JobLocaleUpdate.md) + - [Phrase::JobLocalesCreate](docs/JobLocalesCreate.md) + - [Phrase::JobLocalesList](docs/JobLocalesList.md) + - [Phrase::JobPreview](docs/JobPreview.md) + - [Phrase::JobReopen](docs/JobReopen.md) + - [Phrase::JobShow](docs/JobShow.md) + - [Phrase::JobStart](docs/JobStart.md) + - [Phrase::JobUpdate](docs/JobUpdate.md) + - [Phrase::JobsList](docs/JobsList.md) + - [Phrase::KeyCreate](docs/KeyCreate.md) + - [Phrase::KeyDelete](docs/KeyDelete.md) + - [Phrase::KeyPreview](docs/KeyPreview.md) + - [Phrase::KeyShow](docs/KeyShow.md) + - [Phrase::KeyUpdate](docs/KeyUpdate.md) + - [Phrase::KeysDelete](docs/KeysDelete.md) + - [Phrase::KeysList](docs/KeysList.md) + - [Phrase::KeysSearch](docs/KeysSearch.md) + - [Phrase::KeysTag](docs/KeysTag.md) + - [Phrase::KeysUntag](docs/KeysUntag.md) + - [Phrase::Locale](docs/Locale.md) + - [Phrase::LocaleCreate](docs/LocaleCreate.md) + - [Phrase::LocaleDelete](docs/LocaleDelete.md) + - [Phrase::LocaleDownload](docs/LocaleDownload.md) + - [Phrase::LocalePreview](docs/LocalePreview.md) + - [Phrase::LocaleShow](docs/LocaleShow.md) + - [Phrase::LocaleUpdate](docs/LocaleUpdate.md) + - [Phrase::LocalesList](docs/LocalesList.md) + - [Phrase::Member](docs/Member.md) + - [Phrase::MemberUpdate](docs/MemberUpdate.md) + - [Phrase::OrderConfirm](docs/OrderConfirm.md) + - [Phrase::OrderCreate](docs/OrderCreate.md) + - [Phrase::OrderDelete](docs/OrderDelete.md) + - [Phrase::OrderShow](docs/OrderShow.md) + - [Phrase::OrdersList](docs/OrdersList.md) + - [Phrase::Project](docs/Project.md) + - [Phrase::ProjectCreate](docs/ProjectCreate.md) + - [Phrase::ProjectShort](docs/ProjectShort.md) + - [Phrase::ProjectUpdate](docs/ProjectUpdate.md) + - [Phrase::Release](docs/Release.md) + - [Phrase::ReleaseCreate](docs/ReleaseCreate.md) + - [Phrase::ReleasePreview](docs/ReleasePreview.md) + - [Phrase::ReleaseUpdate](docs/ReleaseUpdate.md) + - [Phrase::Screenshot](docs/Screenshot.md) + - [Phrase::ScreenshotCreate](docs/ScreenshotCreate.md) + - [Phrase::ScreenshotMarker](docs/ScreenshotMarker.md) + - [Phrase::ScreenshotMarkerCreate](docs/ScreenshotMarkerCreate.md) + - [Phrase::ScreenshotMarkerUpdate](docs/ScreenshotMarkerUpdate.md) + - [Phrase::ScreenshotUpdate](docs/ScreenshotUpdate.md) + - [Phrase::Space](docs/Space.md) + - [Phrase::SpaceCreate](docs/SpaceCreate.md) + - [Phrase::SpaceUpdate](docs/SpaceUpdate.md) + - [Phrase::SpacesProjectsCreate](docs/SpacesProjectsCreate.md) + - [Phrase::Styleguide](docs/Styleguide.md) + - [Phrase::StyleguideCreate](docs/StyleguideCreate.md) + - [Phrase::StyleguidePreview](docs/StyleguidePreview.md) + - [Phrase::StyleguideUpdate](docs/StyleguideUpdate.md) + - [Phrase::Tag](docs/Tag.md) + - [Phrase::TagCreate](docs/TagCreate.md) + - [Phrase::TagDelete](docs/TagDelete.md) + - [Phrase::TagShow](docs/TagShow.md) + - [Phrase::TagsList](docs/TagsList.md) + - [Phrase::Translation](docs/Translation.md) + - [Phrase::TranslationCreate](docs/TranslationCreate.md) + - [Phrase::TranslationExclude](docs/TranslationExclude.md) + - [Phrase::TranslationInclude](docs/TranslationInclude.md) + - [Phrase::TranslationKey](docs/TranslationKey.md) + - [Phrase::TranslationOrder](docs/TranslationOrder.md) + - [Phrase::TranslationReview](docs/TranslationReview.md) + - [Phrase::TranslationShow](docs/TranslationShow.md) + - [Phrase::TranslationUnverify](docs/TranslationUnverify.md) + - [Phrase::TranslationUpdate](docs/TranslationUpdate.md) + - [Phrase::TranslationVerify](docs/TranslationVerify.md) + - [Phrase::TranslationVersion](docs/TranslationVersion.md) + - [Phrase::TranslationsByKey](docs/TranslationsByKey.md) + - [Phrase::TranslationsByLocale](docs/TranslationsByLocale.md) + - [Phrase::TranslationsExclude](docs/TranslationsExclude.md) + - [Phrase::TranslationsInclude](docs/TranslationsInclude.md) + - [Phrase::TranslationsList](docs/TranslationsList.md) + - [Phrase::TranslationsReview](docs/TranslationsReview.md) + - [Phrase::TranslationsSearch](docs/TranslationsSearch.md) + - [Phrase::TranslationsUnverify](docs/TranslationsUnverify.md) + - [Phrase::TranslationsVerify](docs/TranslationsVerify.md) + - [Phrase::Upload](docs/Upload.md) + - [Phrase::UploadCreate](docs/UploadCreate.md) + - [Phrase::UploadShow](docs/UploadShow.md) + - [Phrase::UploadSummary](docs/UploadSummary.md) + - [Phrase::UploadsList](docs/UploadsList.md) + - [Phrase::User](docs/User.md) + - [Phrase::UserPreview](docs/UserPreview.md) + - [Phrase::VersionShow](docs/VersionShow.md) + - [Phrase::VersionsList](docs/VersionsList.md) + - [Phrase::Webhook](docs/Webhook.md) + - [Phrase::WebhookCreate](docs/WebhookCreate.md) + - [Phrase::WebhookUpdate](docs/WebhookUpdate.md) + + +## Documentation for Authorization + + +### Basic + +- **Type**: HTTP basic authentication + +### Token + + +- **Type**: API key +- **API key parameter name**: Authorization +- **Location**: HTTP header + diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..c72ca30 --- /dev/null +++ b/Rakefile @@ -0,0 +1,10 @@ +require "bundler/gem_tasks" + +begin + require 'rspec/core/rake_task' + + RSpec::Core::RakeTask.new(:spec) + task default: :spec +rescue LoadError + # no rspec available +end diff --git a/docs/Account.md b/docs/Account.md new file mode 100644 index 0000000..55937f3 --- /dev/null +++ b/docs/Account.md @@ -0,0 +1,25 @@ +# Phrase::Account + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**name** | **String** | | [optional] +**company** | **String** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Account.new(id: null, + name: null, + company: null, + created_at: null, + updated_at: null) +``` + + diff --git a/docs/AccountsApi.md b/docs/AccountsApi.md new file mode 100644 index 0000000..46ca3e9 --- /dev/null +++ b/docs/AccountsApi.md @@ -0,0 +1,136 @@ +# Phrase::AccountsApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**account_show**](AccountsApi.md#account_show) | **GET** /accounts/{id} | Get a single account +[**accounts_list**](AccountsApi.md#accounts_list) | **GET** /accounts | List accounts + + + +## account_show + +> Account account_show(id, opts) + +Get a single account + +Get details on a single account. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::AccountsApi.new +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single account + result = api_instance.account_show(id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling AccountsApi->account_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**Account**](Account.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## accounts_list + +> Array<Account> accounts_list(opts) + +List accounts + +List all accounts the current user has access to. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::AccountsApi.new +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List accounts + result = api_instance.accounts_list(opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling AccountsApi->accounts_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<([**Array<Account>**](Account.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/docs/AffectedCount.md b/docs/AffectedCount.md new file mode 100644 index 0000000..0feca65 --- /dev/null +++ b/docs/AffectedCount.md @@ -0,0 +1,17 @@ +# Phrase::AffectedCount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**records_affected** | **Integer** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::AffectedCount.new(records_affected: null) +``` + + diff --git a/docs/AffectedResources.md b/docs/AffectedResources.md new file mode 100644 index 0000000..e78e220 --- /dev/null +++ b/docs/AffectedResources.md @@ -0,0 +1,17 @@ +# Phrase::AffectedResources + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**records_affected** | **Integer** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::AffectedResources.new(records_affected: null) +``` + + diff --git a/docs/Authorization.md b/docs/Authorization.md new file mode 100644 index 0000000..9185489 --- /dev/null +++ b/docs/Authorization.md @@ -0,0 +1,31 @@ +# Phrase::Authorization + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**note** | **String** | | [optional] +**token_last_eight** | **String** | | [optional] +**hashed_token** | **String** | | [optional] +**scopes** | **Array<String>** | | [optional] +**expires_at** | **DateTime** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Authorization.new(id: null, + note: null, + token_last_eight: null, + hashed_token: null, + scopes: null, + expires_at: null, + created_at: null, + updated_at: null) +``` + + diff --git a/docs/AuthorizationCreate.md b/docs/AuthorizationCreate.md new file mode 100644 index 0000000..3b35e63 --- /dev/null +++ b/docs/AuthorizationCreate.md @@ -0,0 +1,21 @@ +# Phrase::AuthorizationCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**note** | **String** | A note to help you remember what the access is used for. | [optional] +**scopes** | **String** | A list of scopes that the access can be used for. | [optional] +**expires_at** | **String** | Expiration date for the authorization token. Null means no expiration date (default). | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::AuthorizationCreate.new(note: My Deploy Script, + scopes: ["read","write"], + expires_at: 2015-03-30T09:52:53Z) +``` + + diff --git a/docs/AuthorizationUpdate.md b/docs/AuthorizationUpdate.md new file mode 100644 index 0000000..f6ede41 --- /dev/null +++ b/docs/AuthorizationUpdate.md @@ -0,0 +1,21 @@ +# Phrase::AuthorizationUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**note** | **String** | A note to help you remember what the access is used for. | [optional] +**scopes** | **String** | A list of scopes that the access can be used for. | [optional] +**expires_at** | **String** | Expiration date for the authorization token. Null means no expiration date (default). | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::AuthorizationUpdate.new(note: My Deploy Script, + scopes: ["read","write"], + expires_at: 2015-03-30T09:52:53Z) +``` + + diff --git a/docs/AuthorizationsApi.md b/docs/AuthorizationsApi.md new file mode 100644 index 0000000..caf7bb4 --- /dev/null +++ b/docs/AuthorizationsApi.md @@ -0,0 +1,325 @@ +# Phrase::AuthorizationsApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**authorization_create**](AuthorizationsApi.md#authorization_create) | **POST** /authorizations | Create an authorization +[**authorization_delete**](AuthorizationsApi.md#authorization_delete) | **DELETE** /authorizations/{id} | Delete an authorization +[**authorization_show**](AuthorizationsApi.md#authorization_show) | **GET** /authorizations/{id} | Get a single authorization +[**authorization_update**](AuthorizationsApi.md#authorization_update) | **PATCH** /authorizations/{id} | Update an authorization +[**authorizations_list**](AuthorizationsApi.md#authorizations_list) | **GET** /authorizations | List authorizations + + + +## authorization_create + +> authorization_create(authorization_create, opts) + +Create an authorization + +Create a new authorization. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::AuthorizationsApi.new +authorization_create = Phrase::AuthorizationCreate.new # AuthorizationCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create an authorization + api_instance.authorization_create(authorization_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling AuthorizationsApi->authorization_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **authorization_create** | [**AuthorizationCreate**](AuthorizationCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## authorization_delete + +> authorization_delete(id, opts) + +Delete an authorization + +Delete an existing authorization. API calls using that token will stop working. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::AuthorizationsApi.new +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete an authorization + api_instance.authorization_delete(id, opts) +rescue Phrase::ApiError => e + puts "Exception when calling AuthorizationsApi->authorization_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## authorization_show + +> Authorization authorization_show(id, opts) + +Get a single authorization + +Get details on a single authorization. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::AuthorizationsApi.new +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single authorization + result = api_instance.authorization_show(id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling AuthorizationsApi->authorization_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**Authorization**](Authorization.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## authorization_update + +> Object authorization_update(id, authorization_update, opts) + +Update an authorization + +Update an existing authorization. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::AuthorizationsApi.new +id = 'id_example' # String | ID +authorization_update = Phrase::AuthorizationUpdate.new # AuthorizationUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update an authorization + result = api_instance.authorization_update(id, authorization_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling AuthorizationsApi->authorization_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| ID | + **authorization_update** | [**AuthorizationUpdate**](AuthorizationUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## authorizations_list + +> Array<Object> authorizations_list(opts) + +List authorizations + +List all your authorizations. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::AuthorizationsApi.new +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List authorizations + result = api_instance.authorizations_list(opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling AuthorizationsApi->authorizations_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<(**Array<Object>**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/docs/BitbucketSync.md b/docs/BitbucketSync.md new file mode 100644 index 0000000..f3b61c4 --- /dev/null +++ b/docs/BitbucketSync.md @@ -0,0 +1,27 @@ +# Phrase::BitbucketSync + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**repository_name** | **String** | | [optional] +**last_export_to_bitbucket_at** | **DateTime** | | [optional] +**last_import_from_bitbucket_at** | **DateTime** | | [optional] +**valid_phraseapp_yaml** | **Boolean** | | [optional] +**phraseapp_projects** | **Array<Object>** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::BitbucketSync.new(id: null, + repository_name: null, + last_export_to_bitbucket_at: null, + last_import_from_bitbucket_at: null, + valid_phraseapp_yaml: null, + phraseapp_projects: null) +``` + + diff --git a/docs/BitbucketSyncApi.md b/docs/BitbucketSyncApi.md new file mode 100644 index 0000000..6f44c15 --- /dev/null +++ b/docs/BitbucketSyncApi.md @@ -0,0 +1,200 @@ +# Phrase::BitbucketSyncApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**bitbucket_sync_export**](BitbucketSyncApi.md#bitbucket_sync_export) | **POST** /bitbucket_syncs/{id}/export | Export from Phrase to Bitbucket +[**bitbucket_sync_import**](BitbucketSyncApi.md#bitbucket_sync_import) | **POST** /bitbucket_syncs/{id}/import | Import to Phrase from Bitbucket +[**bitbucket_syncs_list**](BitbucketSyncApi.md#bitbucket_syncs_list) | **GET** /bitbucket_syncs | List Bitbucket syncs + + + +## bitbucket_sync_export + +> BitbucketSyncExportResponse bitbucket_sync_export(id, bitbucket_sync_export, opts) + +Export from Phrase to Bitbucket + +Export translations from Phrase to Bitbucket according to the .phraseapp.yml file within the Bitbucket Repository. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::BitbucketSyncApi.new +id = 'id_example' # String | ID +bitbucket_sync_export = Phrase::BitbucketSyncExport.new # BitbucketSyncExport | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Export from Phrase to Bitbucket + result = api_instance.bitbucket_sync_export(id, bitbucket_sync_export, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling BitbucketSyncApi->bitbucket_sync_export: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| ID | + **bitbucket_sync_export** | [**BitbucketSyncExport**](BitbucketSyncExport.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**BitbucketSyncExportResponse**](BitbucketSyncExportResponse.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## bitbucket_sync_import + +> bitbucket_sync_import(id, bitbucket_sync_import, opts) + +Import to Phrase from Bitbucket + +Import translations from Bitbucket to Phrase according to the .phraseapp.yml file within the Bitbucket repository. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::BitbucketSyncApi.new +id = 'id_example' # String | ID +bitbucket_sync_import = Phrase::BitbucketSyncImport.new # BitbucketSyncImport | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Import to Phrase from Bitbucket + api_instance.bitbucket_sync_import(id, bitbucket_sync_import, opts) +rescue Phrase::ApiError => e + puts "Exception when calling BitbucketSyncApi->bitbucket_sync_import: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| ID | + **bitbucket_sync_import** | [**BitbucketSyncImport**](BitbucketSyncImport.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## bitbucket_syncs_list + +> Array<BitbucketSync> bitbucket_syncs_list(bitbucket_syncs_list, opts) + +List Bitbucket syncs + +List all Bitbucket repositories for which synchronisation with Phrase is activated. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::BitbucketSyncApi.new +bitbucket_syncs_list = Phrase::BitbucketSyncsList.new # BitbucketSyncsList | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #List Bitbucket syncs + result = api_instance.bitbucket_syncs_list(bitbucket_syncs_list, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling BitbucketSyncApi->bitbucket_syncs_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **bitbucket_syncs_list** | [**BitbucketSyncsList**](BitbucketSyncsList.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**Array<BitbucketSync>**](BitbucketSync.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/docs/BitbucketSyncExport.md b/docs/BitbucketSyncExport.md new file mode 100644 index 0000000..6aa9cf6 --- /dev/null +++ b/docs/BitbucketSyncExport.md @@ -0,0 +1,17 @@ +# Phrase::BitbucketSyncExport + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_id** | **String** | Account ID to specify the actual account the project should be created in. Required if the requesting user is a member of multiple accounts. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::BitbucketSyncExport.new(account_id: abcd1234) +``` + + diff --git a/docs/BitbucketSyncExportResponse.md b/docs/BitbucketSyncExportResponse.md new file mode 100644 index 0000000..a194afc --- /dev/null +++ b/docs/BitbucketSyncExportResponse.md @@ -0,0 +1,17 @@ +# Phrase::BitbucketSyncExportResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status_path** | **String** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::BitbucketSyncExportResponse.new(status_path: null) +``` + + diff --git a/docs/BitbucketSyncImport.md b/docs/BitbucketSyncImport.md new file mode 100644 index 0000000..6f1334b --- /dev/null +++ b/docs/BitbucketSyncImport.md @@ -0,0 +1,17 @@ +# Phrase::BitbucketSyncImport + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_id** | **String** | Account ID to specify the actual account the project should be created in. Required if the requesting user is a member of multiple accounts. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::BitbucketSyncImport.new(account_id: abcd1234) +``` + + diff --git a/docs/BitbucketSyncsList.md b/docs/BitbucketSyncsList.md new file mode 100644 index 0000000..cd23865 --- /dev/null +++ b/docs/BitbucketSyncsList.md @@ -0,0 +1,17 @@ +# Phrase::BitbucketSyncsList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_id** | **String** | Account ID to specify the actual account the project should be created in. Required if the requesting user is a member of multiple accounts. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::BitbucketSyncsList.new(account_id: abcd1234) +``` + + diff --git a/docs/BlacklistedKey.md b/docs/BlacklistedKey.md new file mode 100644 index 0000000..bdd988c --- /dev/null +++ b/docs/BlacklistedKey.md @@ -0,0 +1,23 @@ +# Phrase::BlacklistedKey + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**name** | **String** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::BlacklistedKey.new(id: null, + name: null, + created_at: null, + updated_at: null) +``` + + diff --git a/docs/BlacklistedKeyCreate.md b/docs/BlacklistedKeyCreate.md new file mode 100644 index 0000000..b970497 --- /dev/null +++ b/docs/BlacklistedKeyCreate.md @@ -0,0 +1,17 @@ +# Phrase::BlacklistedKeyCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Blacklisted key name | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::BlacklistedKeyCreate.new(name: date.formats.*) +``` + + diff --git a/docs/BlacklistedKeyUpdate.md b/docs/BlacklistedKeyUpdate.md new file mode 100644 index 0000000..8e8c587 --- /dev/null +++ b/docs/BlacklistedKeyUpdate.md @@ -0,0 +1,17 @@ +# Phrase::BlacklistedKeyUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Blacklisted key name | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::BlacklistedKeyUpdate.new(name: date.formats.*) +``` + + diff --git a/docs/BlacklistedKeysApi.md b/docs/BlacklistedKeysApi.md new file mode 100644 index 0000000..aab3aad --- /dev/null +++ b/docs/BlacklistedKeysApi.md @@ -0,0 +1,335 @@ +# Phrase::BlacklistedKeysApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**blacklisted_key_create**](BlacklistedKeysApi.md#blacklisted_key_create) | **POST** /projects/{project_id}/blacklisted_keys | Create a blacklisted key +[**blacklisted_key_delete**](BlacklistedKeysApi.md#blacklisted_key_delete) | **DELETE** /projects/{project_id}/blacklisted_keys/{id} | Delete a blacklisted key +[**blacklisted_key_show**](BlacklistedKeysApi.md#blacklisted_key_show) | **GET** /projects/{project_id}/blacklisted_keys/{id} | Get a single blacklisted key +[**blacklisted_key_update**](BlacklistedKeysApi.md#blacklisted_key_update) | **PATCH** /projects/{project_id}/blacklisted_keys/{id} | Update a blacklisted key +[**blacklisted_keys_list**](BlacklistedKeysApi.md#blacklisted_keys_list) | **GET** /projects/{project_id}/blacklisted_keys | List blacklisted keys + + + +## blacklisted_key_create + +> blacklisted_key_create(project_id, blacklisted_key_create, opts) + +Create a blacklisted key + +Create a new rule for blacklisting keys. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::BlacklistedKeysApi.new +project_id = 'project_id_example' # String | Project ID +blacklisted_key_create = Phrase::BlacklistedKeyCreate.new # BlacklistedKeyCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a blacklisted key + api_instance.blacklisted_key_create(project_id, blacklisted_key_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling BlacklistedKeysApi->blacklisted_key_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **blacklisted_key_create** | [**BlacklistedKeyCreate**](BlacklistedKeyCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## blacklisted_key_delete + +> blacklisted_key_delete(project_id, id, opts) + +Delete a blacklisted key + +Delete an existing rule for blacklisting keys. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::BlacklistedKeysApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete a blacklisted key + api_instance.blacklisted_key_delete(project_id, id, opts) +rescue Phrase::ApiError => e + puts "Exception when calling BlacklistedKeysApi->blacklisted_key_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## blacklisted_key_show + +> BlacklistedKey blacklisted_key_show(project_id, id, opts) + +Get a single blacklisted key + +Get details on a single rule for blacklisting keys for a given project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::BlacklistedKeysApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single blacklisted key + result = api_instance.blacklisted_key_show(project_id, id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling BlacklistedKeysApi->blacklisted_key_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**BlacklistedKey**](BlacklistedKey.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## blacklisted_key_update + +> Object blacklisted_key_update(project_id, id, blacklisted_key_update, opts) + +Update a blacklisted key + +Update an existing rule for blacklisting keys. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::BlacklistedKeysApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +blacklisted_key_update = Phrase::BlacklistedKeyUpdate.new # BlacklistedKeyUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update a blacklisted key + result = api_instance.blacklisted_key_update(project_id, id, blacklisted_key_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling BlacklistedKeysApi->blacklisted_key_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **blacklisted_key_update** | [**BlacklistedKeyUpdate**](BlacklistedKeyUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## blacklisted_keys_list + +> Array<Object> blacklisted_keys_list(project_id, opts) + +List blacklisted keys + +List all rules for blacklisting keys for the given project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::BlacklistedKeysApi.new +project_id = 'project_id_example' # String | Project ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List blacklisted keys + result = api_instance.blacklisted_keys_list(project_id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling BlacklistedKeysApi->blacklisted_keys_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<(**Array<Object>**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/docs/Branch.md b/docs/Branch.md new file mode 100644 index 0000000..c838859 --- /dev/null +++ b/docs/Branch.md @@ -0,0 +1,29 @@ +# Phrase::Branch + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] +**merged_at** | **DateTime** | | [optional] +**merged_by** | [**UserPreview**](UserPreview.md) | | [optional] +**created_by** | **Object** | | [optional] +**state** | **String** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Branch.new(name: null, + created_at: null, + updated_at: null, + merged_at: null, + merged_by: null, + created_by: null, + state: null) +``` + + diff --git a/docs/BranchCompare.md b/docs/BranchCompare.md new file mode 100644 index 0000000..afddf3a --- /dev/null +++ b/docs/BranchCompare.md @@ -0,0 +1,17 @@ +# Phrase::BranchCompare + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Name of the branch | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::BranchCompare.new(name: my-branch) +``` + + diff --git a/docs/BranchCreate.md b/docs/BranchCreate.md new file mode 100644 index 0000000..876ef9c --- /dev/null +++ b/docs/BranchCreate.md @@ -0,0 +1,17 @@ +# Phrase::BranchCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Name of the branch | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::BranchCreate.new(name: my-branch) +``` + + diff --git a/docs/BranchMerge.md b/docs/BranchMerge.md new file mode 100644 index 0000000..d9b06ef --- /dev/null +++ b/docs/BranchMerge.md @@ -0,0 +1,17 @@ +# Phrase::BranchMerge + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**strategy** | **String** | strategy used for merge blocking, use_master or use_branch | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::BranchMerge.new(strategy: use_master) +``` + + diff --git a/docs/BranchUpdate.md b/docs/BranchUpdate.md new file mode 100644 index 0000000..2e076de --- /dev/null +++ b/docs/BranchUpdate.md @@ -0,0 +1,17 @@ +# Phrase::BranchUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Name of the branch | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::BranchUpdate.new(name: my-branch) +``` + + diff --git a/docs/BranchesApi.md b/docs/BranchesApi.md new file mode 100644 index 0000000..4011ee1 --- /dev/null +++ b/docs/BranchesApi.md @@ -0,0 +1,467 @@ +# Phrase::BranchesApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**branch_compare**](BranchesApi.md#branch_compare) | **GET** /projects/{project_id}/branches/{name}/compare | Compare branches +[**branch_create**](BranchesApi.md#branch_create) | **POST** /projects/{project_id}/branches | Create a branch +[**branch_delete**](BranchesApi.md#branch_delete) | **DELETE** /projects/{project_id}/branches/{name} | Delete a branch +[**branch_merge**](BranchesApi.md#branch_merge) | **PATCH** /projects/{project_id}/branches/{name}/merge | Merge a branch +[**branch_show**](BranchesApi.md#branch_show) | **GET** /projects/{project_id}/branches/{name} | Get a single branch +[**branch_update**](BranchesApi.md#branch_update) | **PATCH** /projects/{project_id}/branches/{name} | Update a branch +[**branches_list**](BranchesApi.md#branches_list) | **GET** /projects/{project_id}/branches | List branches + + + +## branch_compare + +> branch_compare(project_id, name, branch_compare, opts) + +Compare branches + +Compare branch with main branch. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::BranchesApi.new +project_id = 'project_id_example' # String | Project ID +name = 'name_example' # String | name +branch_compare = Phrase::BranchCompare.new # BranchCompare | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Compare branches + api_instance.branch_compare(project_id, name, branch_compare, opts) +rescue Phrase::ApiError => e + puts "Exception when calling BranchesApi->branch_compare: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **name** | **String**| name | + **branch_compare** | [**BranchCompare**](BranchCompare.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## branch_create + +> branch_create(project_id, branch_create, opts) + +Create a branch + +Create a new branch. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::BranchesApi.new +project_id = 'project_id_example' # String | Project ID +branch_create = Phrase::BranchCreate.new # BranchCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a branch + api_instance.branch_create(project_id, branch_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling BranchesApi->branch_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **branch_create** | [**BranchCreate**](BranchCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## branch_delete + +> branch_delete(project_id, name, opts) + +Delete a branch + +Delete an existing branch. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::BranchesApi.new +project_id = 'project_id_example' # String | Project ID +name = 'name_example' # String | name +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete a branch + api_instance.branch_delete(project_id, name, opts) +rescue Phrase::ApiError => e + puts "Exception when calling BranchesApi->branch_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **name** | **String**| name | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## branch_merge + +> branch_merge(project_id, name, branch_merge, opts) + +Merge a branch + +Merge an existing branch. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::BranchesApi.new +project_id = 'project_id_example' # String | Project ID +name = 'name_example' # String | name +branch_merge = Phrase::BranchMerge.new # BranchMerge | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Merge a branch + api_instance.branch_merge(project_id, name, branch_merge, opts) +rescue Phrase::ApiError => e + puts "Exception when calling BranchesApi->branch_merge: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **name** | **String**| name | + **branch_merge** | [**BranchMerge**](BranchMerge.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## branch_show + +> Branch branch_show(project_id, name, opts) + +Get a single branch + +Get details on a single branch for a given project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::BranchesApi.new +project_id = 'project_id_example' # String | Project ID +name = 'name_example' # String | name +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single branch + result = api_instance.branch_show(project_id, name, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling BranchesApi->branch_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **name** | **String**| name | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**Branch**](Branch.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## branch_update + +> Object branch_update(project_id, name, branch_update, opts) + +Update a branch + +Update an existing branch. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::BranchesApi.new +project_id = 'project_id_example' # String | Project ID +name = 'name_example' # String | name +branch_update = Phrase::BranchUpdate.new # BranchUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update a branch + result = api_instance.branch_update(project_id, name, branch_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling BranchesApi->branch_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **name** | **String**| name | + **branch_update** | [**BranchUpdate**](BranchUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## branches_list + +> Array<Object> branches_list(project_id, opts) + +List branches + +List all branches the of the current project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::BranchesApi.new +project_id = 'project_id_example' # String | Project ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List branches + result = api_instance.branches_list(project_id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling BranchesApi->branches_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<(**Array<Object>**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/docs/Comment.md b/docs/Comment.md new file mode 100644 index 0000000..0c69815 --- /dev/null +++ b/docs/Comment.md @@ -0,0 +1,25 @@ +# Phrase::Comment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**message** | **String** | | [optional] +**user** | **Object** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Comment.new(id: null, + message: null, + user: null, + created_at: null, + updated_at: null) +``` + + diff --git a/docs/CommentCreate.md b/docs/CommentCreate.md new file mode 100644 index 0000000..2f5e4ce --- /dev/null +++ b/docs/CommentCreate.md @@ -0,0 +1,19 @@ +# Phrase::CommentCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**message** | **String** | Comment message | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::CommentCreate.new(branch: my-feature-branch, + message: Some message...) +``` + + diff --git a/docs/CommentDelete.md b/docs/CommentDelete.md new file mode 100644 index 0000000..f95fc9c --- /dev/null +++ b/docs/CommentDelete.md @@ -0,0 +1,17 @@ +# Phrase::CommentDelete + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::CommentDelete.new(branch: my-feature-branch) +``` + + diff --git a/docs/CommentMarkCheck.md b/docs/CommentMarkCheck.md new file mode 100644 index 0000000..a27530c --- /dev/null +++ b/docs/CommentMarkCheck.md @@ -0,0 +1,17 @@ +# Phrase::CommentMarkCheck + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::CommentMarkCheck.new(branch: my-feature-branch) +``` + + diff --git a/docs/CommentMarkRead.md b/docs/CommentMarkRead.md new file mode 100644 index 0000000..393211e --- /dev/null +++ b/docs/CommentMarkRead.md @@ -0,0 +1,17 @@ +# Phrase::CommentMarkRead + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::CommentMarkRead.new(branch: my-feature-branch) +``` + + diff --git a/docs/CommentMarkUnread.md b/docs/CommentMarkUnread.md new file mode 100644 index 0000000..915e573 --- /dev/null +++ b/docs/CommentMarkUnread.md @@ -0,0 +1,17 @@ +# Phrase::CommentMarkUnread + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::CommentMarkUnread.new(branch: my-feature-branch) +``` + + diff --git a/docs/CommentShow.md b/docs/CommentShow.md new file mode 100644 index 0000000..ed5231c --- /dev/null +++ b/docs/CommentShow.md @@ -0,0 +1,17 @@ +# Phrase::CommentShow + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::CommentShow.new(branch: my-feature-branch) +``` + + diff --git a/docs/CommentUpdate.md b/docs/CommentUpdate.md new file mode 100644 index 0000000..02e43af --- /dev/null +++ b/docs/CommentUpdate.md @@ -0,0 +1,19 @@ +# Phrase::CommentUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**message** | **String** | Comment message | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::CommentUpdate.new(branch: my-feature-branch, + message: Some message...) +``` + + diff --git a/docs/CommentsApi.md b/docs/CommentsApi.md new file mode 100644 index 0000000..12d4e09 --- /dev/null +++ b/docs/CommentsApi.md @@ -0,0 +1,555 @@ +# Phrase::CommentsApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**comment_create**](CommentsApi.md#comment_create) | **POST** /projects/{project_id}/keys/{key_id}/comments | Create a comment +[**comment_delete**](CommentsApi.md#comment_delete) | **DELETE** /projects/{project_id}/keys/{key_id}/comments/{id} | Delete a comment +[**comment_mark_check**](CommentsApi.md#comment_mark_check) | **GET** /projects/{project_id}/keys/{key_id}/comments/{id}/read | Check if comment is read +[**comment_mark_read**](CommentsApi.md#comment_mark_read) | **PATCH** /projects/{project_id}/keys/{key_id}/comments/{id}/read | Mark a comment as read +[**comment_mark_unread**](CommentsApi.md#comment_mark_unread) | **DELETE** /projects/{project_id}/keys/{key_id}/comments/{id}/read | Mark a comment as unread +[**comment_show**](CommentsApi.md#comment_show) | **GET** /projects/{project_id}/keys/{key_id}/comments/{id} | Get a single comment +[**comment_update**](CommentsApi.md#comment_update) | **PATCH** /projects/{project_id}/keys/{key_id}/comments/{id} | Update a comment +[**comments_list**](CommentsApi.md#comments_list) | **GET** /projects/{project_id}/keys/{key_id}/comments | List comments + + + +## comment_create + +> comment_create(project_id, key_id, comment_create, opts) + +Create a comment + +Create a new comment for a key. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::CommentsApi.new +project_id = 'project_id_example' # String | Project ID +key_id = 'key_id_example' # String | Translation Key ID +comment_create = Phrase::CommentCreate.new # CommentCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a comment + api_instance.comment_create(project_id, key_id, comment_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling CommentsApi->comment_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **key_id** | **String**| Translation Key ID | + **comment_create** | [**CommentCreate**](CommentCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## comment_delete + +> comment_delete(project_id, key_id, id, comment_delete, opts) + +Delete a comment + +Delete an existing comment. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::CommentsApi.new +project_id = 'project_id_example' # String | Project ID +key_id = 'key_id_example' # String | Translation Key ID +id = 'id_example' # String | ID +comment_delete = Phrase::CommentDelete.new # CommentDelete | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete a comment + api_instance.comment_delete(project_id, key_id, id, comment_delete, opts) +rescue Phrase::ApiError => e + puts "Exception when calling CommentsApi->comment_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **key_id** | **String**| Translation Key ID | + **id** | **String**| ID | + **comment_delete** | [**CommentDelete**](CommentDelete.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## comment_mark_check + +> comment_mark_check(project_id, key_id, id, comment_mark_check, opts) + +Check if comment is read + +Check if comment was marked as read. Returns 204 if read, 404 if unread. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::CommentsApi.new +project_id = 'project_id_example' # String | Project ID +key_id = 'key_id_example' # String | Translation Key ID +id = 'id_example' # String | ID +comment_mark_check = Phrase::CommentMarkCheck.new # CommentMarkCheck | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Check if comment is read + api_instance.comment_mark_check(project_id, key_id, id, comment_mark_check, opts) +rescue Phrase::ApiError => e + puts "Exception when calling CommentsApi->comment_mark_check: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **key_id** | **String**| Translation Key ID | + **id** | **String**| ID | + **comment_mark_check** | [**CommentMarkCheck**](CommentMarkCheck.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## comment_mark_read + +> comment_mark_read(project_id, key_id, id, comment_mark_read, opts) + +Mark a comment as read + +Mark a comment as read. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::CommentsApi.new +project_id = 'project_id_example' # String | Project ID +key_id = 'key_id_example' # String | Translation Key ID +id = 'id_example' # String | ID +comment_mark_read = Phrase::CommentMarkRead.new # CommentMarkRead | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Mark a comment as read + api_instance.comment_mark_read(project_id, key_id, id, comment_mark_read, opts) +rescue Phrase::ApiError => e + puts "Exception when calling CommentsApi->comment_mark_read: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **key_id** | **String**| Translation Key ID | + **id** | **String**| ID | + **comment_mark_read** | [**CommentMarkRead**](CommentMarkRead.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## comment_mark_unread + +> comment_mark_unread(project_id, key_id, id, comment_mark_unread, opts) + +Mark a comment as unread + +Mark a comment as unread. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::CommentsApi.new +project_id = 'project_id_example' # String | Project ID +key_id = 'key_id_example' # String | Translation Key ID +id = 'id_example' # String | ID +comment_mark_unread = Phrase::CommentMarkUnread.new # CommentMarkUnread | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Mark a comment as unread + api_instance.comment_mark_unread(project_id, key_id, id, comment_mark_unread, opts) +rescue Phrase::ApiError => e + puts "Exception when calling CommentsApi->comment_mark_unread: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **key_id** | **String**| Translation Key ID | + **id** | **String**| ID | + **comment_mark_unread** | [**CommentMarkUnread**](CommentMarkUnread.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## comment_show + +> Comment comment_show(project_id, key_id, id, comment_show, opts) + +Get a single comment + +Get details on a single comment. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::CommentsApi.new +project_id = 'project_id_example' # String | Project ID +key_id = 'key_id_example' # String | Translation Key ID +id = 'id_example' # String | ID +comment_show = Phrase::CommentShow.new # CommentShow | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single comment + result = api_instance.comment_show(project_id, key_id, id, comment_show, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling CommentsApi->comment_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **key_id** | **String**| Translation Key ID | + **id** | **String**| ID | + **comment_show** | [**CommentShow**](CommentShow.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**Comment**](Comment.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## comment_update + +> Object comment_update(project_id, key_id, id, comment_update, opts) + +Update a comment + +Update an existing comment. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::CommentsApi.new +project_id = 'project_id_example' # String | Project ID +key_id = 'key_id_example' # String | Translation Key ID +id = 'id_example' # String | ID +comment_update = Phrase::CommentUpdate.new # CommentUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update a comment + result = api_instance.comment_update(project_id, key_id, id, comment_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling CommentsApi->comment_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **key_id** | **String**| Translation Key ID | + **id** | **String**| ID | + **comment_update** | [**CommentUpdate**](CommentUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## comments_list + +> Array<Object> comments_list(project_id, key_id, comments_list, opts) + +List comments + +List all comments for a key. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::CommentsApi.new +project_id = 'project_id_example' # String | Project ID +key_id = 'key_id_example' # String | Translation Key ID +comments_list = Phrase::CommentsList.new # CommentsList | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List comments + result = api_instance.comments_list(project_id, key_id, comments_list, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling CommentsApi->comments_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **key_id** | **String**| Translation Key ID | + **comments_list** | [**CommentsList**](CommentsList.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<(**Array<Object>**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/docs/CommentsList.md b/docs/CommentsList.md new file mode 100644 index 0000000..74f3bf7 --- /dev/null +++ b/docs/CommentsList.md @@ -0,0 +1,17 @@ +# Phrase::CommentsList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::CommentsList.new(branch: my-feature-branch) +``` + + diff --git a/docs/Distribution.md b/docs/Distribution.md new file mode 100644 index 0000000..0093160 --- /dev/null +++ b/docs/Distribution.md @@ -0,0 +1,29 @@ +# Phrase::Distribution + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**name** | **String** | | [optional] +**project** | [**ProjectShort**](ProjectShort.md) | | [optional] +**platforms** | **Array<String>** | | [optional] +**releases** | **Array<Object>** | | [optional] +**created_at** | **DateTime** | | [optional] +**deleted_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Distribution.new(id: null, + name: null, + project: null, + platforms: null, + releases: null, + created_at: null, + deleted_at: null) +``` + + diff --git a/docs/DistributionCreate.md b/docs/DistributionCreate.md new file mode 100644 index 0000000..df94825 --- /dev/null +++ b/docs/DistributionCreate.md @@ -0,0 +1,29 @@ +# Phrase::DistributionCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Name of the distribution | [optional] +**project_id** | **String** | Project id the distribution should be assigned to. | [optional] +**platforms** | **String** | List of platforms the distribution should support. | [optional] +**format_options** | **String** | Additional formatting and render options. Only <code>enclose_in_cdata</code> is available for platform <code>android</code>. | [optional] +**fallback_to_non_regional_locale** | **String** | Indicates whether to fallback to non regional locale when locale can not be found | [optional] +**fallback_to_default_locale** | **String** | Indicates whether to fallback to projects default locale when locale can not be found | [optional] +**use_last_reviewed_version** | **String** | Use last reviewed instead of latest translation in a project | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::DistributionCreate.new(name: My Android Distribution, + project_id: abcd1234abcd1234abcd1234, + platforms: ["android","ios"], + format_options: {xml:{enclose_in_cdata:'1'}}, + fallback_to_non_regional_locale: true, + fallback_to_default_locale: true, + use_last_reviewed_version: true) +``` + + diff --git a/docs/DistributionPreview.md b/docs/DistributionPreview.md new file mode 100644 index 0000000..978acf6 --- /dev/null +++ b/docs/DistributionPreview.md @@ -0,0 +1,29 @@ +# Phrase::DistributionPreview + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**name** | **String** | | [optional] +**project** | **Object** | | [optional] +**platforms** | **Array<String>** | | [optional] +**release_count** | **Integer** | | [optional] +**created_at** | **DateTime** | | [optional] +**deleted_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::DistributionPreview.new(id: null, + name: null, + project: null, + platforms: null, + release_count: null, + created_at: null, + deleted_at: null) +``` + + diff --git a/docs/DistributionUpdate.md b/docs/DistributionUpdate.md new file mode 100644 index 0000000..9b738cb --- /dev/null +++ b/docs/DistributionUpdate.md @@ -0,0 +1,29 @@ +# Phrase::DistributionUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Name of the distribution | [optional] +**project_id** | **String** | Project id the distribution should be assigned to. | [optional] +**platforms** | **String** | List of platforms the distribution should support. | [optional] +**format_options** | **String** | Additional formatting and render options. Only <code>enclose_in_cdata</code> is available for platform <code>android</code>. | [optional] +**fallback_to_non_regional_locale** | **String** | Indicates whether to fallback to non regional locale when locale can not be found | [optional] +**fallback_to_default_locale** | **String** | Indicates whether to fallback to projects default locale when locale can not be found | [optional] +**use_last_reviewed_version** | **String** | Use last reviewed instead of latest translation in a project | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::DistributionUpdate.new(name: My Android Distribution, + project_id: abcd1234abcd1234abcd1234, + platforms: ["android","ios"], + format_options: {xml:{enclose_in_cdata:'1'}}, + fallback_to_non_regional_locale: true, + fallback_to_default_locale: true, + use_last_reviewed_version: true) +``` + + diff --git a/docs/DistributionsApi.md b/docs/DistributionsApi.md new file mode 100644 index 0000000..f339e00 --- /dev/null +++ b/docs/DistributionsApi.md @@ -0,0 +1,335 @@ +# Phrase::DistributionsApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**distribution_create**](DistributionsApi.md#distribution_create) | **POST** /accounts/{account_id}/distributions | Create a distribution +[**distribution_delete**](DistributionsApi.md#distribution_delete) | **DELETE** /accounts/{account_id}/distributions/{id} | Delete a distribution +[**distribution_show**](DistributionsApi.md#distribution_show) | **GET** /accounts/{account_id}/distributions/{id} | Get a single distribution +[**distribution_update**](DistributionsApi.md#distribution_update) | **PATCH** /accounts/{account_id}/distributions/{id} | Update a distribution +[**distributions_list**](DistributionsApi.md#distributions_list) | **GET** /accounts/{account_id}/distributions | List distributions + + + +## distribution_create + +> distribution_create(account_id, distribution_create, opts) + +Create a distribution + +Create a new distribution. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::DistributionsApi.new +account_id = 'account_id_example' # String | Account ID +distribution_create = Phrase::DistributionCreate.new # DistributionCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a distribution + api_instance.distribution_create(account_id, distribution_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling DistributionsApi->distribution_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **distribution_create** | [**DistributionCreate**](DistributionCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## distribution_delete + +> distribution_delete(account_id, id, opts) + +Delete a distribution + +Delete an existing distribution. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::DistributionsApi.new +account_id = 'account_id_example' # String | Account ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete a distribution + api_instance.distribution_delete(account_id, id, opts) +rescue Phrase::ApiError => e + puts "Exception when calling DistributionsApi->distribution_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## distribution_show + +> Distribution distribution_show(account_id, id, opts) + +Get a single distribution + +Get details on a single distribution. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::DistributionsApi.new +account_id = 'account_id_example' # String | Account ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single distribution + result = api_instance.distribution_show(account_id, id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling DistributionsApi->distribution_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**Distribution**](Distribution.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## distribution_update + +> Object distribution_update(account_id, id, distribution_update, opts) + +Update a distribution + +Update an existing distribution. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::DistributionsApi.new +account_id = 'account_id_example' # String | Account ID +id = 'id_example' # String | ID +distribution_update = Phrase::DistributionUpdate.new # DistributionUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update a distribution + result = api_instance.distribution_update(account_id, id, distribution_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling DistributionsApi->distribution_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **id** | **String**| ID | + **distribution_update** | [**DistributionUpdate**](DistributionUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## distributions_list + +> Array<DistributionPreview> distributions_list(account_id, opts) + +List distributions + +List all distributions for the given account. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::DistributionsApi.new +account_id = 'account_id_example' # String | Account ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List distributions + result = api_instance.distributions_list(account_id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling DistributionsApi->distributions_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<([**Array<DistributionPreview>**](DistributionPreview.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/docs/Errors.md b/docs/Errors.md new file mode 100644 index 0000000..b1f6a19 --- /dev/null +++ b/docs/Errors.md @@ -0,0 +1,19 @@ +# Phrase::Errors + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **String** | | [optional] +**errors** | [**Array<ErrorsErrors>**](ErrorsErrors.md) | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Errors.new(message: null, + errors: null) +``` + + diff --git a/docs/ErrorsErrors.md b/docs/ErrorsErrors.md new file mode 100644 index 0000000..9ea7573 --- /dev/null +++ b/docs/ErrorsErrors.md @@ -0,0 +1,21 @@ +# Phrase::ErrorsErrors + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**resource** | **String** | | [optional] +**field** | **String** | | [optional] +**message** | **String** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::ErrorsErrors.new(resource: null, + field: null, + message: null) +``` + + diff --git a/docs/Format.md b/docs/Format.md new file mode 100644 index 0000000..9f23b61 --- /dev/null +++ b/docs/Format.md @@ -0,0 +1,35 @@ +# Phrase::Format + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | [optional] +**api_name** | **String** | | [optional] +**description** | **String** | | [optional] +**extension** | **String** | | [optional] +**default_encoding** | **String** | | [optional] +**importable** | **Boolean** | | [optional] +**exportable** | **Boolean** | | [optional] +**default_file** | **String** | | [optional] +**renders_default_locale** | **Boolean** | | [optional] +**includes_locale_information** | **Boolean** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Format.new(name: null, + api_name: null, + description: null, + extension: null, + default_encoding: null, + importable: null, + exportable: null, + default_file: null, + renders_default_locale: null, + includes_locale_information: null) +``` + + diff --git a/docs/FormatsApi.md b/docs/FormatsApi.md new file mode 100644 index 0000000..00c22cf --- /dev/null +++ b/docs/FormatsApi.md @@ -0,0 +1,69 @@ +# Phrase::FormatsApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**formats_list**](FormatsApi.md#formats_list) | **GET** /formats | List formats + + + +## formats_list + +> Array<Format> formats_list(opts) + +List formats + +Get a handy list of all localization file formats supported in Phrase. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::FormatsApi.new +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #List formats + result = api_instance.formats_list(opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling FormatsApi->formats_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**Array<Format>**](Format.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/docs/GitLabSyncApi.md b/docs/GitLabSyncApi.md new file mode 100644 index 0000000..acad466 --- /dev/null +++ b/docs/GitLabSyncApi.md @@ -0,0 +1,464 @@ +# Phrase::GitLabSyncApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**gitlab_sync_delete**](GitLabSyncApi.md#gitlab_sync_delete) | **DELETE** /gitlab_syncs/{id} | Delete single Sync Setting +[**gitlab_sync_export**](GitLabSyncApi.md#gitlab_sync_export) | **POST** /gitlab_syncs/{gitlab_sync_id}/export | Export from Phrase to GitLab +[**gitlab_sync_history**](GitLabSyncApi.md#gitlab_sync_history) | **GET** /gitlab_syncs/{gitlab_sync_id}/history | History of single Sync Setting +[**gitlab_sync_import**](GitLabSyncApi.md#gitlab_sync_import) | **POST** /gitlab_syncs/{gitlab_sync_id}/import | Import from GitLab to Phrase +[**gitlab_sync_list**](GitLabSyncApi.md#gitlab_sync_list) | **GET** /gitlab_syncs | List GitLab syncs +[**gitlab_sync_show**](GitLabSyncApi.md#gitlab_sync_show) | **GET** /gitlab_syncs/{id} | Get single Sync Setting +[**gitlab_sync_update**](GitLabSyncApi.md#gitlab_sync_update) | **PUT** /gitlab_syncs/{id} | Update single Sync Setting + + + +## gitlab_sync_delete + +> gitlab_sync_delete(id, gitlab_sync_delete, opts) + +Delete single Sync Setting + +Deletes a single GitLab Sync Setting. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::GitLabSyncApi.new +id = 'id_example' # String | ID +gitlab_sync_delete = Phrase::GitlabSyncDelete.new # GitlabSyncDelete | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete single Sync Setting + api_instance.gitlab_sync_delete(id, gitlab_sync_delete, opts) +rescue Phrase::ApiError => e + puts "Exception when calling GitLabSyncApi->gitlab_sync_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| ID | + **gitlab_sync_delete** | [**GitlabSyncDelete**](GitlabSyncDelete.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## gitlab_sync_export + +> GitlabSyncExport1 gitlab_sync_export(gitlab_sync_id, gitlab_sync_export, opts) + +Export from Phrase to GitLab + +Export translations from Phrase to GitLab according to the .phraseapp.yml file within the GitLab repository. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::GitLabSyncApi.new +gitlab_sync_id = 'gitlab_sync_id_example' # String | Gitlab Sync ID +gitlab_sync_export = Phrase::GitlabSyncExport.new # GitlabSyncExport | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Export from Phrase to GitLab + result = api_instance.gitlab_sync_export(gitlab_sync_id, gitlab_sync_export, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling GitLabSyncApi->gitlab_sync_export: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **gitlab_sync_id** | **String**| Gitlab Sync ID | + **gitlab_sync_export** | [**GitlabSyncExport**](GitlabSyncExport.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**GitlabSyncExport1**](GitlabSyncExport1.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## gitlab_sync_history + +> Array<GitlabSyncHistory1> gitlab_sync_history(gitlab_sync_id, gitlab_sync_history, opts) + +History of single Sync Setting + +List history for a single Sync Setting. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::GitLabSyncApi.new +gitlab_sync_id = 'gitlab_sync_id_example' # String | Gitlab Sync ID +gitlab_sync_history = Phrase::GitlabSyncHistory.new # GitlabSyncHistory | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #History of single Sync Setting + result = api_instance.gitlab_sync_history(gitlab_sync_id, gitlab_sync_history, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling GitLabSyncApi->gitlab_sync_history: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **gitlab_sync_id** | **String**| Gitlab Sync ID | + **gitlab_sync_history** | [**GitlabSyncHistory**](GitlabSyncHistory.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<([**Array<GitlabSyncHistory1>**](GitlabSyncHistory1.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## gitlab_sync_import + +> Array<Object> gitlab_sync_import(gitlab_sync_id, gitlab_sync_import, opts) + +Import from GitLab to Phrase + +Import translations from GitLab to Phrase according to the .phraseapp.yml file within the GitLab repository. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::GitLabSyncApi.new +gitlab_sync_id = 'gitlab_sync_id_example' # String | Gitlab Sync ID +gitlab_sync_import = Phrase::GitlabSyncImport.new # GitlabSyncImport | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Import from GitLab to Phrase + result = api_instance.gitlab_sync_import(gitlab_sync_id, gitlab_sync_import, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling GitLabSyncApi->gitlab_sync_import: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **gitlab_sync_id** | **String**| Gitlab Sync ID | + **gitlab_sync_import** | [**GitlabSyncImport**](GitlabSyncImport.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Array<Object>**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## gitlab_sync_list + +> Array<Object> gitlab_sync_list(gitlab_sync_list, opts) + +List GitLab syncs + +List all GitLab Sync Settings for which synchronisation with Phrase and GitLab is activated. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::GitLabSyncApi.new +gitlab_sync_list = Phrase::GitlabSyncList.new # GitlabSyncList | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #List GitLab syncs + result = api_instance.gitlab_sync_list(gitlab_sync_list, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling GitLabSyncApi->gitlab_sync_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **gitlab_sync_list** | [**GitlabSyncList**](GitlabSyncList.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Array<Object>**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## gitlab_sync_show + +> GitlabSync gitlab_sync_show(id, gitlab_sync_show, opts) + +Get single Sync Setting + +Shows a single GitLab Sync Setting. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::GitLabSyncApi.new +id = 'id_example' # String | ID +gitlab_sync_show = Phrase::GitlabSyncShow.new # GitlabSyncShow | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get single Sync Setting + result = api_instance.gitlab_sync_show(id, gitlab_sync_show, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling GitLabSyncApi->gitlab_sync_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| ID | + **gitlab_sync_show** | [**GitlabSyncShow**](GitlabSyncShow.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**GitlabSync**](GitlabSync.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## gitlab_sync_update + +> Object gitlab_sync_update(id, gitlab_sync_update, opts) + +Update single Sync Setting + +Updates a single GitLab Sync Setting. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::GitLabSyncApi.new +id = 'id_example' # String | ID +gitlab_sync_update = Phrase::GitlabSyncUpdate.new # GitlabSyncUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update single Sync Setting + result = api_instance.gitlab_sync_update(id, gitlab_sync_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling GitLabSyncApi->gitlab_sync_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| ID | + **gitlab_sync_update** | [**GitlabSyncUpdate**](GitlabSyncUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/docs/GitlabSync.md b/docs/GitlabSync.md new file mode 100644 index 0000000..1692f4c --- /dev/null +++ b/docs/GitlabSync.md @@ -0,0 +1,37 @@ +# Phrase::GitlabSync + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**project_id** | **String** | | [optional] +**gitlab_project_id** | **Integer** | | [optional] +**gitlab_branch_name** | **String** | | [optional] +**auto_import** | **Boolean** | | [optional] +**auto_import_secret** | **String** | | [optional] +**auto_import_url** | **String** | | [optional] +**self_hosted_api_url** | **String** | | [optional] +**last_exported_at** | **DateTime** | | [optional] +**last_imported_at** | **DateTime** | | [optional] +**last_status** | **String** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::GitlabSync.new(id: null, + project_id: null, + gitlab_project_id: null, + gitlab_branch_name: null, + auto_import: null, + auto_import_secret: null, + auto_import_url: null, + self_hosted_api_url: null, + last_exported_at: null, + last_imported_at: null, + last_status: null) +``` + + diff --git a/docs/GitlabSyncDelete.md b/docs/GitlabSyncDelete.md new file mode 100644 index 0000000..513a513 --- /dev/null +++ b/docs/GitlabSyncDelete.md @@ -0,0 +1,17 @@ +# Phrase::GitlabSyncDelete + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_id** | **String** | Account ID to specify the actual account the GitLab Sync should be created in. Required if the requesting user is a member of multiple accounts. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::GitlabSyncDelete.new(account_id: abcd1234) +``` + + diff --git a/docs/GitlabSyncExport.md b/docs/GitlabSyncExport.md new file mode 100644 index 0000000..db32e64 --- /dev/null +++ b/docs/GitlabSyncExport.md @@ -0,0 +1,17 @@ +# Phrase::GitlabSyncExport + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_id** | **String** | Account ID to specify the actual account the GitLab Sync should be created in. Required if the requesting user is a member of multiple accounts. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::GitlabSyncExport.new(account_id: abcd1234) +``` + + diff --git a/docs/GitlabSyncExport1.md b/docs/GitlabSyncExport1.md new file mode 100644 index 0000000..3918e29 --- /dev/null +++ b/docs/GitlabSyncExport1.md @@ -0,0 +1,19 @@ +# Phrase::GitlabSyncExport1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**merge_request_id** | **Integer** | | [optional] +**merge_request_web_url** | **String** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::GitlabSyncExport1.new(merge_request_id: null, + merge_request_web_url: null) +``` + + diff --git a/docs/GitlabSyncHistory.md b/docs/GitlabSyncHistory.md new file mode 100644 index 0000000..29d4aa4 --- /dev/null +++ b/docs/GitlabSyncHistory.md @@ -0,0 +1,17 @@ +# Phrase::GitlabSyncHistory + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_id** | **String** | Account ID to specify the actual account the GitLab Sync should be created in. Required if the requesting user is a member of multiple accounts. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::GitlabSyncHistory.new(account_id: abcd1234) +``` + + diff --git a/docs/GitlabSyncHistory1.md b/docs/GitlabSyncHistory1.md new file mode 100644 index 0000000..8711a0f --- /dev/null +++ b/docs/GitlabSyncHistory1.md @@ -0,0 +1,25 @@ +# Phrase::GitlabSyncHistory1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **Integer** | | [optional] +**action** | **String** | | [optional] +**errors** | **Array<String>** | | [optional] +**date** | **DateTime** | | [optional] +**details** | [**Object**](.md) | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::GitlabSyncHistory1.new(status: null, + action: null, + errors: null, + date: null, + details: null) +``` + + diff --git a/docs/GitlabSyncImport.md b/docs/GitlabSyncImport.md new file mode 100644 index 0000000..2c42280 --- /dev/null +++ b/docs/GitlabSyncImport.md @@ -0,0 +1,17 @@ +# Phrase::GitlabSyncImport + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_id** | **String** | Account ID to specify the actual account the GitLab Sync should be created in. Required if the requesting user is a member of multiple accounts. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::GitlabSyncImport.new(account_id: abcd1234) +``` + + diff --git a/docs/GitlabSyncList.md b/docs/GitlabSyncList.md new file mode 100644 index 0000000..3fc17ca --- /dev/null +++ b/docs/GitlabSyncList.md @@ -0,0 +1,17 @@ +# Phrase::GitlabSyncList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_id** | **String** | Account ID to specify the actual account the GitLab Sync should be created in. Required if the requesting user is a member of multiple accounts. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::GitlabSyncList.new(account_id: abcd1234) +``` + + diff --git a/docs/GitlabSyncShow.md b/docs/GitlabSyncShow.md new file mode 100644 index 0000000..17ddea1 --- /dev/null +++ b/docs/GitlabSyncShow.md @@ -0,0 +1,17 @@ +# Phrase::GitlabSyncShow + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_id** | **String** | Account ID to specify the actual account the GitLab Sync should be created in. Required if the requesting user is a member of multiple accounts. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::GitlabSyncShow.new(account_id: abcd1234) +``` + + diff --git a/docs/GitlabSyncUpdate.md b/docs/GitlabSyncUpdate.md new file mode 100644 index 0000000..0da324e --- /dev/null +++ b/docs/GitlabSyncUpdate.md @@ -0,0 +1,23 @@ +# Phrase::GitlabSyncUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_id** | **String** | Account ID to specify the actual account the GitLab Sync should be created in. Required if the requesting user is a member of multiple accounts. | [optional] +**phrase_project_code** | **String** | Code of the related Phrase Project. | [optional] +**gitlab_project_id** | **String** | ID of the related GitLab Project. | [optional] +**gitlab_branch_name** | **String** | Name of the GitLab Branch. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::GitlabSyncUpdate.new(account_id: abcd1234, + phrase_project_code: 3456abcd, + gitlab_project_id: 12345, + gitlab_branch_name: feature-development) +``` + + diff --git a/docs/Glossary.md b/docs/Glossary.md new file mode 100644 index 0000000..de5c8c4 --- /dev/null +++ b/docs/Glossary.md @@ -0,0 +1,25 @@ +# Phrase::Glossary + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**name** | **String** | | [optional] +**projects** | **Array<Object>** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Glossary.new(id: null, + name: null, + projects: null, + created_at: null, + updated_at: null) +``` + + diff --git a/docs/GlossaryApi.md b/docs/GlossaryApi.md new file mode 100644 index 0000000..15a8439 --- /dev/null +++ b/docs/GlossaryApi.md @@ -0,0 +1,335 @@ +# Phrase::GlossaryApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**glossaries_list**](GlossaryApi.md#glossaries_list) | **GET** /accounts/{account_id}/glossaries | List glossaries +[**glossary_create**](GlossaryApi.md#glossary_create) | **POST** /accounts/{account_id}/glossaries | Create a glossary +[**glossary_delete**](GlossaryApi.md#glossary_delete) | **DELETE** /accounts/{account_id}/glossaries/{id} | Delete a glossary +[**glossary_show**](GlossaryApi.md#glossary_show) | **GET** /accounts/{account_id}/glossaries/{id} | Get a single glossary +[**glossary_update**](GlossaryApi.md#glossary_update) | **PATCH** /accounts/{account_id}/glossaries/{id} | Update a glossary + + + +## glossaries_list + +> Array<Object> glossaries_list(account_id, opts) + +List glossaries + +List all glossaries the current user has access to. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::GlossaryApi.new +account_id = 'account_id_example' # String | Account ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List glossaries + result = api_instance.glossaries_list(account_id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling GlossaryApi->glossaries_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<(**Array<Object>**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## glossary_create + +> glossary_create(account_id, glossary_create, opts) + +Create a glossary + +Create a new glossary. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::GlossaryApi.new +account_id = 'account_id_example' # String | Account ID +glossary_create = Phrase::GlossaryCreate.new # GlossaryCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a glossary + api_instance.glossary_create(account_id, glossary_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling GlossaryApi->glossary_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **glossary_create** | [**GlossaryCreate**](GlossaryCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## glossary_delete + +> glossary_delete(account_id, id, opts) + +Delete a glossary + +Delete an existing glossary. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::GlossaryApi.new +account_id = 'account_id_example' # String | Account ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete a glossary + api_instance.glossary_delete(account_id, id, opts) +rescue Phrase::ApiError => e + puts "Exception when calling GlossaryApi->glossary_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## glossary_show + +> Glossary glossary_show(account_id, id, opts) + +Get a single glossary + +Get details on a single glossary. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::GlossaryApi.new +account_id = 'account_id_example' # String | Account ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single glossary + result = api_instance.glossary_show(account_id, id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling GlossaryApi->glossary_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**Glossary**](Glossary.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## glossary_update + +> Object glossary_update(account_id, id, glossary_update, opts) + +Update a glossary + +Update an existing glossary. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::GlossaryApi.new +account_id = 'account_id_example' # String | Account ID +id = 'id_example' # String | ID +glossary_update = Phrase::GlossaryUpdate.new # GlossaryUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update a glossary + result = api_instance.glossary_update(account_id, id, glossary_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling GlossaryApi->glossary_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **id** | **String**| ID | + **glossary_update** | [**GlossaryUpdate**](GlossaryUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/docs/GlossaryCreate.md b/docs/GlossaryCreate.md new file mode 100644 index 0000000..636b45c --- /dev/null +++ b/docs/GlossaryCreate.md @@ -0,0 +1,21 @@ +# Phrase::GlossaryCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Name of the glossary | [optional] +**project_ids** | **String** | List of project ids the glossary should be assigned to. | [optional] +**space_ids** | **String** | List of space ids the glossary should be assigned to. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::GlossaryCreate.new(name: My glossary, + project_ids: abcd1234abcd1234abcd1234,abcd1234abcd1234abcd1235, + space_ids: ["abcd1234abcd1234abcd1234","abcd1234abcd1234abcd1235"]) +``` + + diff --git a/docs/GlossaryTerm.md b/docs/GlossaryTerm.md new file mode 100644 index 0000000..1803a51 --- /dev/null +++ b/docs/GlossaryTerm.md @@ -0,0 +1,31 @@ +# Phrase::GlossaryTerm + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**term** | **String** | | [optional] +**description** | **String** | | [optional] +**translatable** | **Boolean** | | [optional] +**case_sensitive** | **Boolean** | | [optional] +**translations** | **Array<Object>** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::GlossaryTerm.new(id: null, + term: null, + description: null, + translatable: null, + case_sensitive: null, + translations: null, + created_at: null, + updated_at: null) +``` + + diff --git a/docs/GlossaryTermCreate.md b/docs/GlossaryTermCreate.md new file mode 100644 index 0000000..f4f9710 --- /dev/null +++ b/docs/GlossaryTermCreate.md @@ -0,0 +1,23 @@ +# Phrase::GlossaryTermCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**term** | **String** | Glossary term | [optional] +**description** | **String** | Description of term | [optional] +**translatable** | **String** | Indicates whether the term should be used for all languages or can be translated | [optional] +**case_sensitive** | **String** | Indicates whether the term is case sensitive | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::GlossaryTermCreate.new(term: MyCompany, + description: Use this when refering to our company, + translatable: true, + case_sensitive: true) +``` + + diff --git a/docs/GlossaryTermTranslation.md b/docs/GlossaryTermTranslation.md new file mode 100644 index 0000000..f2d49ea --- /dev/null +++ b/docs/GlossaryTermTranslation.md @@ -0,0 +1,25 @@ +# Phrase::GlossaryTermTranslation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**locale_code** | **String** | | [optional] +**content** | **String** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::GlossaryTermTranslation.new(id: null, + locale_code: null, + content: null, + created_at: null, + updated_at: null) +``` + + diff --git a/docs/GlossaryTermTranslationCreate.md b/docs/GlossaryTermTranslationCreate.md new file mode 100644 index 0000000..f9f0882 --- /dev/null +++ b/docs/GlossaryTermTranslationCreate.md @@ -0,0 +1,19 @@ +# Phrase::GlossaryTermTranslationCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**locale_code** | **String** | Identifies the language for this translation | [optional] +**content** | **String** | The content of the translation | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::GlossaryTermTranslationCreate.new(locale_code: en-US, + content: My translated term) +``` + + diff --git a/docs/GlossaryTermTranslationUpdate.md b/docs/GlossaryTermTranslationUpdate.md new file mode 100644 index 0000000..10bbf98 --- /dev/null +++ b/docs/GlossaryTermTranslationUpdate.md @@ -0,0 +1,19 @@ +# Phrase::GlossaryTermTranslationUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**locale_code** | **String** | Identifies the language for this translation | [optional] +**content** | **String** | The content of the translation | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::GlossaryTermTranslationUpdate.new(locale_code: en-US, + content: My translated term) +``` + + diff --git a/docs/GlossaryTermTranslationsApi.md b/docs/GlossaryTermTranslationsApi.md new file mode 100644 index 0000000..34533f5 --- /dev/null +++ b/docs/GlossaryTermTranslationsApi.md @@ -0,0 +1,215 @@ +# Phrase::GlossaryTermTranslationsApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**glossary_term_translation_create**](GlossaryTermTranslationsApi.md#glossary_term_translation_create) | **POST** /accounts/{account_id}/glossaries/{glossary_id}/terms/{term_id}/translations | Create a glossary term translation +[**glossary_term_translation_delete**](GlossaryTermTranslationsApi.md#glossary_term_translation_delete) | **DELETE** /accounts/{account_id}/glossaries/{glossary_id}/terms/{term_id}/translations/{id} | Delete a glossary term translation +[**glossary_term_translation_update**](GlossaryTermTranslationsApi.md#glossary_term_translation_update) | **PATCH** /accounts/{account_id}/glossaries/{glossary_id}/terms/{term_id}/translations/{id} | Update a glossary term translation + + + +## glossary_term_translation_create + +> glossary_term_translation_create(account_id, glossary_id, term_id, glossary_term_translation_create, opts) + +Create a glossary term translation + +Create a new glossary term translation. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::GlossaryTermTranslationsApi.new +account_id = 'account_id_example' # String | Account ID +glossary_id = 'glossary_id_example' # String | Glossary ID +term_id = 'term_id_example' # String | Term ID +glossary_term_translation_create = Phrase::GlossaryTermTranslationCreate.new # GlossaryTermTranslationCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a glossary term translation + api_instance.glossary_term_translation_create(account_id, glossary_id, term_id, glossary_term_translation_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling GlossaryTermTranslationsApi->glossary_term_translation_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **glossary_id** | **String**| Glossary ID | + **term_id** | **String**| Term ID | + **glossary_term_translation_create** | [**GlossaryTermTranslationCreate**](GlossaryTermTranslationCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## glossary_term_translation_delete + +> glossary_term_translation_delete(account_id, glossary_id, term_id, id, opts) + +Delete a glossary term translation + +Delete an existing glossary term translation. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::GlossaryTermTranslationsApi.new +account_id = 'account_id_example' # String | Account ID +glossary_id = 'glossary_id_example' # String | Glossary ID +term_id = 'term_id_example' # String | Term ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete a glossary term translation + api_instance.glossary_term_translation_delete(account_id, glossary_id, term_id, id, opts) +rescue Phrase::ApiError => e + puts "Exception when calling GlossaryTermTranslationsApi->glossary_term_translation_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **glossary_id** | **String**| Glossary ID | + **term_id** | **String**| Term ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## glossary_term_translation_update + +> GlossaryTermTranslation glossary_term_translation_update(account_id, glossary_id, term_id, id, glossary_term_translation_update, opts) + +Update a glossary term translation + +Update an existing glossary term translation. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::GlossaryTermTranslationsApi.new +account_id = 'account_id_example' # String | Account ID +glossary_id = 'glossary_id_example' # String | Glossary ID +term_id = 'term_id_example' # String | Term ID +id = 'id_example' # String | ID +glossary_term_translation_update = Phrase::GlossaryTermTranslationUpdate.new # GlossaryTermTranslationUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update a glossary term translation + result = api_instance.glossary_term_translation_update(account_id, glossary_id, term_id, id, glossary_term_translation_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling GlossaryTermTranslationsApi->glossary_term_translation_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **glossary_id** | **String**| Glossary ID | + **term_id** | **String**| Term ID | + **id** | **String**| ID | + **glossary_term_translation_update** | [**GlossaryTermTranslationUpdate**](GlossaryTermTranslationUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**GlossaryTermTranslation**](GlossaryTermTranslation.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/docs/GlossaryTermUpdate.md b/docs/GlossaryTermUpdate.md new file mode 100644 index 0000000..ace0533 --- /dev/null +++ b/docs/GlossaryTermUpdate.md @@ -0,0 +1,23 @@ +# Phrase::GlossaryTermUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**term** | **String** | Glossary term | [optional] +**description** | **String** | Description of term | [optional] +**translatable** | **String** | Indicates whether the term should be used for all languages or can be translated | [optional] +**case_sensitive** | **String** | Indicates whether the term is case sensitive | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::GlossaryTermUpdate.new(term: MyCompany, + description: Use this when refering to our company, + translatable: true, + case_sensitive: true) +``` + + diff --git a/docs/GlossaryTermsApi.md b/docs/GlossaryTermsApi.md new file mode 100644 index 0000000..2fbdf58 --- /dev/null +++ b/docs/GlossaryTermsApi.md @@ -0,0 +1,345 @@ +# Phrase::GlossaryTermsApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**glossary_term_create**](GlossaryTermsApi.md#glossary_term_create) | **POST** /accounts/{account_id}/glossaries/{glossary_id}/terms | Create a glossary term +[**glossary_term_delete**](GlossaryTermsApi.md#glossary_term_delete) | **DELETE** /accounts/{account_id}/glossaries/{glossary_id}/terms/{id} | Delete a glossary term +[**glossary_term_show**](GlossaryTermsApi.md#glossary_term_show) | **GET** /accounts/{account_id}/glossaries/{glossary_id}/terms/{id} | Get a single glossary term +[**glossary_term_update**](GlossaryTermsApi.md#glossary_term_update) | **PATCH** /accounts/{account_id}/glossaries/{glossary_id}/terms/{id} | Update a glossary term +[**glossary_terms_list**](GlossaryTermsApi.md#glossary_terms_list) | **GET** /accounts/{account_id}/glossaries/{glossary_id}/terms | List glossary terms + + + +## glossary_term_create + +> glossary_term_create(account_id, glossary_id, glossary_term_create, opts) + +Create a glossary term + +Create a new glossary term. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::GlossaryTermsApi.new +account_id = 'account_id_example' # String | Account ID +glossary_id = 'glossary_id_example' # String | Glossary ID +glossary_term_create = Phrase::GlossaryTermCreate.new # GlossaryTermCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a glossary term + api_instance.glossary_term_create(account_id, glossary_id, glossary_term_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling GlossaryTermsApi->glossary_term_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **glossary_id** | **String**| Glossary ID | + **glossary_term_create** | [**GlossaryTermCreate**](GlossaryTermCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## glossary_term_delete + +> glossary_term_delete(account_id, glossary_id, id, opts) + +Delete a glossary term + +Delete an existing glossary term. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::GlossaryTermsApi.new +account_id = 'account_id_example' # String | Account ID +glossary_id = 'glossary_id_example' # String | Glossary ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete a glossary term + api_instance.glossary_term_delete(account_id, glossary_id, id, opts) +rescue Phrase::ApiError => e + puts "Exception when calling GlossaryTermsApi->glossary_term_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **glossary_id** | **String**| Glossary ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## glossary_term_show + +> GlossaryTerm glossary_term_show(account_id, glossary_id, id, opts) + +Get a single glossary term + +Get details on a single glossary term. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::GlossaryTermsApi.new +account_id = 'account_id_example' # String | Account ID +glossary_id = 'glossary_id_example' # String | Glossary ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single glossary term + result = api_instance.glossary_term_show(account_id, glossary_id, id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling GlossaryTermsApi->glossary_term_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **glossary_id** | **String**| Glossary ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**GlossaryTerm**](GlossaryTerm.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## glossary_term_update + +> Object glossary_term_update(account_id, glossary_id, id, glossary_term_update, opts) + +Update a glossary term + +Update an existing glossary term. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::GlossaryTermsApi.new +account_id = 'account_id_example' # String | Account ID +glossary_id = 'glossary_id_example' # String | Glossary ID +id = 'id_example' # String | ID +glossary_term_update = Phrase::GlossaryTermUpdate.new # GlossaryTermUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update a glossary term + result = api_instance.glossary_term_update(account_id, glossary_id, id, glossary_term_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling GlossaryTermsApi->glossary_term_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **glossary_id** | **String**| Glossary ID | + **id** | **String**| ID | + **glossary_term_update** | [**GlossaryTermUpdate**](GlossaryTermUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## glossary_terms_list + +> Array<Object> glossary_terms_list(account_id, glossary_id, opts) + +List glossary terms + +List all glossary terms the current user has access to. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::GlossaryTermsApi.new +account_id = 'account_id_example' # String | Account ID +glossary_id = 'glossary_id_example' # String | Glossary ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List glossary terms + result = api_instance.glossary_terms_list(account_id, glossary_id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling GlossaryTermsApi->glossary_terms_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **glossary_id** | **String**| Glossary ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<(**Array<Object>**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/docs/GlossaryUpdate.md b/docs/GlossaryUpdate.md new file mode 100644 index 0000000..a11d763 --- /dev/null +++ b/docs/GlossaryUpdate.md @@ -0,0 +1,21 @@ +# Phrase::GlossaryUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Name of the glossary | [optional] +**project_ids** | **String** | List of project ids the glossary should be assigned to. | [optional] +**space_ids** | **String** | List of space ids the glossary should be assigned to. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::GlossaryUpdate.new(name: My glossary, + project_ids: abcd1234abcd1234abcd1234,abcd1234abcd1234abcd1235, + space_ids: ["abcd1234abcd1234abcd1234","abcd1234abcd1234abcd1235"]) +``` + + diff --git a/docs/Invitation.md b/docs/Invitation.md new file mode 100644 index 0000000..f41662a --- /dev/null +++ b/docs/Invitation.md @@ -0,0 +1,35 @@ +# Phrase::Invitation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**email** | **String** | | [optional] +**role** | **String** | | [optional] +**state** | **String** | | [optional] +**projects** | **Array<Object>** | | [optional] +**locales** | **Array<Object>** | | [optional] +**permissions** | [**Object**](.md) | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] +**accepted_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Invitation.new(id: null, + email: null, + role: null, + state: null, + projects: null, + locales: null, + permissions: null, + created_at: null, + updated_at: null, + accepted_at: null) +``` + + diff --git a/docs/InvitationCreate.md b/docs/InvitationCreate.md new file mode 100644 index 0000000..8b2436b --- /dev/null +++ b/docs/InvitationCreate.md @@ -0,0 +1,25 @@ +# Phrase::InvitationCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email** | **String** | The email of the invited user. The <code>email</code> can not be updated once created. Create a new invitation for each unique email. | [optional] +**role** | **String** | Invitiation role, can be any of Manager, Developer, Translator. | [optional] +**project_ids** | **String** | List of project ids the invited user has access to. | [optional] +**locale_ids** | **String** | List of locale ids the invited user has access to. | [optional] +**permissions** | **String** | Additional permissions depending on invitation role. Available permissions are <code>create_upload</code> and <code>review_translations</code> | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::InvitationCreate.new(email: example@mail.com, + role: Developer, + project_ids: abcd1234abcd1234abcd1234,abcd1234abcd1234abcd1235, + locale_ids: abcd1234abcd1234abcd1234,abcd1234abcd1234abcd1235, + permissions: {"create_upload":true,"review_translations":true}) +``` + + diff --git a/docs/InvitationUpdate.md b/docs/InvitationUpdate.md new file mode 100644 index 0000000..aec084a --- /dev/null +++ b/docs/InvitationUpdate.md @@ -0,0 +1,23 @@ +# Phrase::InvitationUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**role** | **String** | Invitiation role, can be any of Manager, Developer, Translator | [optional] +**project_ids** | **String** | List of project ids the invited user has access to | [optional] +**locale_ids** | **String** | List of locale ids the invited user has access to | [optional] +**permissions** | **String** | Additional permissions depending on invitation role. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::InvitationUpdate.new(role: Invitiation role, + project_ids: abcd1234abcd1234abcd1234,abcd1234abcd1234abcd1235, + locale_ids: abcd1234abcd1234abcd1234,abcd1234abcd1234abcd1235, + permissions: {"create_upload":true}) +``` + + diff --git a/docs/InvitationsApi.md b/docs/InvitationsApi.md new file mode 100644 index 0000000..0f9d551 --- /dev/null +++ b/docs/InvitationsApi.md @@ -0,0 +1,400 @@ +# Phrase::InvitationsApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**invitation_create**](InvitationsApi.md#invitation_create) | **POST** /accounts/{account_id}/invitations | Create a new invitation +[**invitation_delete**](InvitationsApi.md#invitation_delete) | **DELETE** /accounts/{account_id}/invitations/{id} | Delete an invitation +[**invitation_resend**](InvitationsApi.md#invitation_resend) | **POST** /accounts/{account_id}/invitations/{id}/resend | Resend an invitation +[**invitation_show**](InvitationsApi.md#invitation_show) | **GET** /accounts/{account_id}/invitations/{id} | Get a single invitation +[**invitation_update**](InvitationsApi.md#invitation_update) | **PATCH** /accounts/{account_id}/invitations/{id} | Update an invitation +[**invitations_list**](InvitationsApi.md#invitations_list) | **GET** /accounts/{account_id}/invitations | List invitations + + + +## invitation_create + +> invitation_create(account_id, invitation_create, opts) + +Create a new invitation + +Invite a person to an account. Developers and translators need project_ids and locale_ids assigned to access them. Access token scope must include team.manage. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::InvitationsApi.new +account_id = 'account_id_example' # String | Account ID +invitation_create = Phrase::InvitationCreate.new # InvitationCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a new invitation + api_instance.invitation_create(account_id, invitation_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling InvitationsApi->invitation_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **invitation_create** | [**InvitationCreate**](InvitationCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## invitation_delete + +> invitation_delete(account_id, id, opts) + +Delete an invitation + +Delete an existing invitation (must not be accepted yet). Access token scope must include team.manage. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::InvitationsApi.new +account_id = 'account_id_example' # String | Account ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete an invitation + api_instance.invitation_delete(account_id, id, opts) +rescue Phrase::ApiError => e + puts "Exception when calling InvitationsApi->invitation_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## invitation_resend + +> Object invitation_resend(account_id, id, opts) + +Resend an invitation + +Resend the invitation email (must not be accepted yet). Access token scope must include team.manage. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::InvitationsApi.new +account_id = 'account_id_example' # String | Account ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Resend an invitation + result = api_instance.invitation_resend(account_id, id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling InvitationsApi->invitation_resend: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## invitation_show + +> Invitation invitation_show(account_id, id, opts) + +Get a single invitation + +Get details on a single invitation. Access token scope must include team.manage. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::InvitationsApi.new +account_id = 'account_id_example' # String | Account ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single invitation + result = api_instance.invitation_show(account_id, id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling InvitationsApi->invitation_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**Invitation**](Invitation.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## invitation_update + +> Object invitation_update(account_id, id, invitation_update, opts) + +Update an invitation + +Update an existing invitation (must not be accepted yet). The email cannot be updated. Developers and translators need project_ids and locale_ids assigned to access them. Access token scope must include team.manage. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::InvitationsApi.new +account_id = 'account_id_example' # String | Account ID +id = 'id_example' # String | ID +invitation_update = Phrase::InvitationUpdate.new # InvitationUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update an invitation + result = api_instance.invitation_update(account_id, id, invitation_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling InvitationsApi->invitation_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **id** | **String**| ID | + **invitation_update** | [**InvitationUpdate**](InvitationUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## invitations_list + +> Array<Object> invitations_list(account_id, opts) + +List invitations + +List invitations for an account. It will also list the accessible resources like projects and locales the invited user has access to. In case nothing is shown the default access from the role is used. Access token scope must include team.manage. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::InvitationsApi.new +account_id = 'account_id_example' # String | Account ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List invitations + result = api_instance.invitations_list(account_id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling InvitationsApi->invitations_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<(**Array<Object>**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/docs/Job.md b/docs/Job.md new file mode 100644 index 0000000..52fa11f --- /dev/null +++ b/docs/Job.md @@ -0,0 +1,29 @@ +# Phrase::Job + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**name** | **String** | | [optional] +**briefing** | **String** | | [optional] +**due_date** | **DateTime** | | [optional] +**state** | **String** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Job.new(id: null, + name: null, + briefing: null, + due_date: null, + state: null, + created_at: null, + updated_at: null) +``` + + diff --git a/docs/JobComplete.md b/docs/JobComplete.md new file mode 100644 index 0000000..f23f597 --- /dev/null +++ b/docs/JobComplete.md @@ -0,0 +1,17 @@ +# Phrase::JobComplete + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::JobComplete.new(branch: my-feature-branch) +``` + + diff --git a/docs/JobCreate.md b/docs/JobCreate.md new file mode 100644 index 0000000..fbe10d2 --- /dev/null +++ b/docs/JobCreate.md @@ -0,0 +1,27 @@ +# Phrase::JobCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**name** | **String** | Job name | [optional] +**briefing** | **String** | Briefing for the translators | [optional] +**due_date** | **String** | Date the job should be finished | [optional] +**tags** | **String** | tags of keys that should be included within the job | [optional] +**translation_key_ids** | **String** | ids of keys that should be included within the job | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::JobCreate.new(branch: my-feature-branch, + name: de, + briefing: de-DE, + due_date: 2017-08-15, + tags: ["myUploadTag"], + translation_key_ids: ["abcd1234cdef1234abcd1234cdef1234"]) +``` + + diff --git a/docs/JobDelete.md b/docs/JobDelete.md new file mode 100644 index 0000000..5e49815 --- /dev/null +++ b/docs/JobDelete.md @@ -0,0 +1,17 @@ +# Phrase::JobDelete + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::JobDelete.new(branch: my-feature-branch) +``` + + diff --git a/docs/JobKeysCreate.md b/docs/JobKeysCreate.md new file mode 100644 index 0000000..119bf0e --- /dev/null +++ b/docs/JobKeysCreate.md @@ -0,0 +1,19 @@ +# Phrase::JobKeysCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**translation_key_ids** | **String** | ids of keys that should added to the job | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::JobKeysCreate.new(branch: my-feature-branch, + translation_key_ids: ["abcd1234cdef1234abcd1234cdef1234"]) +``` + + diff --git a/docs/JobKeysDelete.md b/docs/JobKeysDelete.md new file mode 100644 index 0000000..8022803 --- /dev/null +++ b/docs/JobKeysDelete.md @@ -0,0 +1,19 @@ +# Phrase::JobKeysDelete + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**translation_key_ids** | **String** | ids of keys that should added to the job | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::JobKeysDelete.new(branch: my-feature-branch, + translation_key_ids: ["abcd1234cdef1234abcd1234cdef1234"]) +``` + + diff --git a/docs/JobLocale.md b/docs/JobLocale.md new file mode 100644 index 0000000..920e6ae --- /dev/null +++ b/docs/JobLocale.md @@ -0,0 +1,23 @@ +# Phrase::JobLocale + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**job** | [**JobPreview**](JobPreview.md) | | [optional] +**locale** | **Object** | | [optional] +**users** | **Array<Object>** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::JobLocale.new(id: null, + job: null, + locale: null, + users: null) +``` + + diff --git a/docs/JobLocaleComplete.md b/docs/JobLocaleComplete.md new file mode 100644 index 0000000..d28a12c --- /dev/null +++ b/docs/JobLocaleComplete.md @@ -0,0 +1,17 @@ +# Phrase::JobLocaleComplete + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::JobLocaleComplete.new(branch: my-feature-branch) +``` + + diff --git a/docs/JobLocaleDelete.md b/docs/JobLocaleDelete.md new file mode 100644 index 0000000..0056d19 --- /dev/null +++ b/docs/JobLocaleDelete.md @@ -0,0 +1,17 @@ +# Phrase::JobLocaleDelete + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::JobLocaleDelete.new(branch: my-feature-branch) +``` + + diff --git a/docs/JobLocaleReopen.md b/docs/JobLocaleReopen.md new file mode 100644 index 0000000..7375b8c --- /dev/null +++ b/docs/JobLocaleReopen.md @@ -0,0 +1,17 @@ +# Phrase::JobLocaleReopen + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::JobLocaleReopen.new(branch: my-feature-branch) +``` + + diff --git a/docs/JobLocaleShow.md b/docs/JobLocaleShow.md new file mode 100644 index 0000000..ddd205d --- /dev/null +++ b/docs/JobLocaleShow.md @@ -0,0 +1,17 @@ +# Phrase::JobLocaleShow + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::JobLocaleShow.new(branch: my-feature-branch) +``` + + diff --git a/docs/JobLocaleUpdate.md b/docs/JobLocaleUpdate.md new file mode 100644 index 0000000..28a85d9 --- /dev/null +++ b/docs/JobLocaleUpdate.md @@ -0,0 +1,21 @@ +# Phrase::JobLocaleUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**locale_id** | **String** | locale id | [optional] +**user_ids** | **String** | Array of user ids to be assigned to the job locale | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::JobLocaleUpdate.new(branch: my-feature-branch, + locale_id: abcd1234cdef1234abcd1234cdef1234, + user_ids: ["abcd1234cdef1234abcd1234cdef1234"]) +``` + + diff --git a/docs/JobLocalesApi.md b/docs/JobLocalesApi.md new file mode 100644 index 0000000..0d180d9 --- /dev/null +++ b/docs/JobLocalesApi.md @@ -0,0 +1,489 @@ +# Phrase::JobLocalesApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**job_locale_complete**](JobLocalesApi.md#job_locale_complete) | **POST** /projects/{project_id}/jobs/{job_id}/locales/{id}/complete | Complete a job locale +[**job_locale_delete**](JobLocalesApi.md#job_locale_delete) | **DELETE** /projects/{project_id}/jobs/{job_id}/locales/{id} | Delete a job locale +[**job_locale_reopen**](JobLocalesApi.md#job_locale_reopen) | **POST** /projects/{project_id}/jobs/{job_id}/locales/{id}/reopen | Reopen a job locale +[**job_locale_show**](JobLocalesApi.md#job_locale_show) | **GET** /projects/{project_id}/jobs/{job_id}/locale/{id} | Get a single job locale +[**job_locale_update**](JobLocalesApi.md#job_locale_update) | **PATCH** /projects/{project_id}/jobs/{job_id}/locales/{id} | Update a job locale +[**job_locales_create**](JobLocalesApi.md#job_locales_create) | **POST** /projects/{project_id}/jobs/{job_id}/locales | Create a job locale +[**job_locales_list**](JobLocalesApi.md#job_locales_list) | **GET** /projects/{project_id}/jobs/{job_id}/locales | List job locales + + + +## job_locale_complete + +> Object job_locale_complete(project_id, job_id, id, job_locale_complete, opts) + +Complete a job locale + +Mark a job locale as completed. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::JobLocalesApi.new +project_id = 'project_id_example' # String | Project ID +job_id = 'job_id_example' # String | Job ID +id = 'id_example' # String | ID +job_locale_complete = Phrase::JobLocaleComplete.new # JobLocaleComplete | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Complete a job locale + result = api_instance.job_locale_complete(project_id, job_id, id, job_locale_complete, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling JobLocalesApi->job_locale_complete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **job_id** | **String**| Job ID | + **id** | **String**| ID | + **job_locale_complete** | [**JobLocaleComplete**](JobLocaleComplete.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## job_locale_delete + +> job_locale_delete(project_id, job_id, id, job_locale_delete, opts) + +Delete a job locale + +Delete an existing job locale. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::JobLocalesApi.new +project_id = 'project_id_example' # String | Project ID +job_id = 'job_id_example' # String | Job ID +id = 'id_example' # String | ID +job_locale_delete = Phrase::JobLocaleDelete.new # JobLocaleDelete | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete a job locale + api_instance.job_locale_delete(project_id, job_id, id, job_locale_delete, opts) +rescue Phrase::ApiError => e + puts "Exception when calling JobLocalesApi->job_locale_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **job_id** | **String**| Job ID | + **id** | **String**| ID | + **job_locale_delete** | [**JobLocaleDelete**](JobLocaleDelete.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## job_locale_reopen + +> Object job_locale_reopen(project_id, job_id, id, job_locale_reopen, opts) + +Reopen a job locale + +Mark a job locale as uncompleted. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::JobLocalesApi.new +project_id = 'project_id_example' # String | Project ID +job_id = 'job_id_example' # String | Job ID +id = 'id_example' # String | ID +job_locale_reopen = Phrase::JobLocaleReopen.new # JobLocaleReopen | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Reopen a job locale + result = api_instance.job_locale_reopen(project_id, job_id, id, job_locale_reopen, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling JobLocalesApi->job_locale_reopen: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **job_id** | **String**| Job ID | + **id** | **String**| ID | + **job_locale_reopen** | [**JobLocaleReopen**](JobLocaleReopen.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## job_locale_show + +> JobLocale job_locale_show(project_id, job_id, id, job_locale_show, opts) + +Get a single job locale + +Get a single job locale for a given job. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::JobLocalesApi.new +project_id = 'project_id_example' # String | Project ID +job_id = 'job_id_example' # String | Job ID +id = 'id_example' # String | ID +job_locale_show = Phrase::JobLocaleShow.new # JobLocaleShow | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single job locale + result = api_instance.job_locale_show(project_id, job_id, id, job_locale_show, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling JobLocalesApi->job_locale_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **job_id** | **String**| Job ID | + **id** | **String**| ID | + **job_locale_show** | [**JobLocaleShow**](JobLocaleShow.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**JobLocale**](JobLocale.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## job_locale_update + +> Object job_locale_update(project_id, job_id, id, job_locale_update, opts) + +Update a job locale + +Update an existing job locale. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::JobLocalesApi.new +project_id = 'project_id_example' # String | Project ID +job_id = 'job_id_example' # String | Job ID +id = 'id_example' # String | ID +job_locale_update = Phrase::JobLocaleUpdate.new # JobLocaleUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update a job locale + result = api_instance.job_locale_update(project_id, job_id, id, job_locale_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling JobLocalesApi->job_locale_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **job_id** | **String**| Job ID | + **id** | **String**| ID | + **job_locale_update** | [**JobLocaleUpdate**](JobLocaleUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## job_locales_create + +> job_locales_create(project_id, job_id, job_locales_create, opts) + +Create a job locale + +Create a new job locale. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::JobLocalesApi.new +project_id = 'project_id_example' # String | Project ID +job_id = 'job_id_example' # String | Job ID +job_locales_create = Phrase::JobLocalesCreate.new # JobLocalesCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a job locale + api_instance.job_locales_create(project_id, job_id, job_locales_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling JobLocalesApi->job_locales_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **job_id** | **String**| Job ID | + **job_locales_create** | [**JobLocalesCreate**](JobLocalesCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## job_locales_list + +> Array<Object> job_locales_list(project_id, job_id, job_locales_list, opts) + +List job locales + +List all job locales for a given job. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::JobLocalesApi.new +project_id = 'project_id_example' # String | Project ID +job_id = 'job_id_example' # String | Job ID +job_locales_list = Phrase::JobLocalesList.new # JobLocalesList | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List job locales + result = api_instance.job_locales_list(project_id, job_id, job_locales_list, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling JobLocalesApi->job_locales_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **job_id** | **String**| Job ID | + **job_locales_list** | [**JobLocalesList**](JobLocalesList.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<(**Array<Object>**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/docs/JobLocalesCreate.md b/docs/JobLocalesCreate.md new file mode 100644 index 0000000..6bf8a20 --- /dev/null +++ b/docs/JobLocalesCreate.md @@ -0,0 +1,21 @@ +# Phrase::JobLocalesCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**locale_id** | **String** | locale id | [optional] +**user_ids** | **String** | Array of user ids to be assigned to the job locale | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::JobLocalesCreate.new(branch: my-feature-branch, + locale_id: abcd1234cdef1234abcd1234cdef1234, + user_ids: ["abcd1234cdef1234abcd1234cdef1234"]) +``` + + diff --git a/docs/JobLocalesList.md b/docs/JobLocalesList.md new file mode 100644 index 0000000..132a2de --- /dev/null +++ b/docs/JobLocalesList.md @@ -0,0 +1,17 @@ +# Phrase::JobLocalesList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::JobLocalesList.new(branch: my-feature-branch) +``` + + diff --git a/docs/JobPreview.md b/docs/JobPreview.md new file mode 100644 index 0000000..82b8cf7 --- /dev/null +++ b/docs/JobPreview.md @@ -0,0 +1,21 @@ +# Phrase::JobPreview + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**name** | **String** | | [optional] +**state** | **String** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::JobPreview.new(id: null, + name: null, + state: null) +``` + + diff --git a/docs/JobReopen.md b/docs/JobReopen.md new file mode 100644 index 0000000..d30605e --- /dev/null +++ b/docs/JobReopen.md @@ -0,0 +1,17 @@ +# Phrase::JobReopen + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::JobReopen.new(branch: my-feature-branch) +``` + + diff --git a/docs/JobShow.md b/docs/JobShow.md new file mode 100644 index 0000000..ac78864 --- /dev/null +++ b/docs/JobShow.md @@ -0,0 +1,17 @@ +# Phrase::JobShow + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::JobShow.new(branch: my-feature-branch) +``` + + diff --git a/docs/JobStart.md b/docs/JobStart.md new file mode 100644 index 0000000..76562ea --- /dev/null +++ b/docs/JobStart.md @@ -0,0 +1,17 @@ +# Phrase::JobStart + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::JobStart.new(branch: my-feature-branch) +``` + + diff --git a/docs/JobUpdate.md b/docs/JobUpdate.md new file mode 100644 index 0000000..3d72931 --- /dev/null +++ b/docs/JobUpdate.md @@ -0,0 +1,23 @@ +# Phrase::JobUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**name** | **String** | Job name | [optional] +**briefing** | **String** | Briefing for the translators | [optional] +**due_date** | **String** | Date the job should be finished | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::JobUpdate.new(branch: my-feature-branch, + name: de, + briefing: de-DE, + due_date: 2017-08-15) +``` + + diff --git a/docs/JobsApi.md b/docs/JobsApi.md new file mode 100644 index 0000000..8a6cd4a --- /dev/null +++ b/docs/JobsApi.md @@ -0,0 +1,675 @@ +# Phrase::JobsApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**job_complete**](JobsApi.md#job_complete) | **POST** /projects/{project_id}/jobs/{id}/complete | Complete a job +[**job_create**](JobsApi.md#job_create) | **POST** /projects/{project_id}/jobs | Create a job +[**job_delete**](JobsApi.md#job_delete) | **DELETE** /projects/{project_id}/jobs/{id} | Delete a job +[**job_keys_create**](JobsApi.md#job_keys_create) | **POST** /projects/{project_id}/jobs/{id}/keys | Add keys to job +[**job_keys_delete**](JobsApi.md#job_keys_delete) | **DELETE** /projects/{project_id}/jobs/{id}/keys | Remove keys from job +[**job_reopen**](JobsApi.md#job_reopen) | **POST** /projects/{project_id}/jobs/{id}/reopen | Reopen a job +[**job_show**](JobsApi.md#job_show) | **GET** /projects/{project_id}/jobs/{id} | Get a single job +[**job_start**](JobsApi.md#job_start) | **POST** /projects/{project_id}/jobs/{id}/start | Start a job +[**job_update**](JobsApi.md#job_update) | **PATCH** /projects/{project_id}/jobs/{id} | Update a job +[**jobs_list**](JobsApi.md#jobs_list) | **GET** /projects/{project_id}/jobs | List jobs + + + +## job_complete + +> Object job_complete(project_id, id, job_complete, opts) + +Complete a job + +Mark a job as completed. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::JobsApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +job_complete = Phrase::JobComplete.new # JobComplete | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Complete a job + result = api_instance.job_complete(project_id, id, job_complete, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling JobsApi->job_complete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **job_complete** | [**JobComplete**](JobComplete.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## job_create + +> job_create(project_id, job_create, opts) + +Create a job + +Create a new job. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::JobsApi.new +project_id = 'project_id_example' # String | Project ID +job_create = Phrase::JobCreate.new # JobCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a job + api_instance.job_create(project_id, job_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling JobsApi->job_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **job_create** | [**JobCreate**](JobCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## job_delete + +> job_delete(project_id, id, job_delete, opts) + +Delete a job + +Delete an existing job. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::JobsApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +job_delete = Phrase::JobDelete.new # JobDelete | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete a job + api_instance.job_delete(project_id, id, job_delete, opts) +rescue Phrase::ApiError => e + puts "Exception when calling JobsApi->job_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **job_delete** | [**JobDelete**](JobDelete.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## job_keys_create + +> Object job_keys_create(project_id, id, job_keys_create, opts) + +Add keys to job + +Add multiple keys to a existing job. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::JobsApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +job_keys_create = Phrase::JobKeysCreate.new # JobKeysCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Add keys to job + result = api_instance.job_keys_create(project_id, id, job_keys_create, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling JobsApi->job_keys_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **job_keys_create** | [**JobKeysCreate**](JobKeysCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## job_keys_delete + +> job_keys_delete(project_id, id, job_keys_delete, opts) + +Remove keys from job + +Remove multiple keys from existing job. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::JobsApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +job_keys_delete = Phrase::JobKeysDelete.new # JobKeysDelete | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Remove keys from job + api_instance.job_keys_delete(project_id, id, job_keys_delete, opts) +rescue Phrase::ApiError => e + puts "Exception when calling JobsApi->job_keys_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **job_keys_delete** | [**JobKeysDelete**](JobKeysDelete.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## job_reopen + +> Object job_reopen(project_id, id, job_reopen, opts) + +Reopen a job + +Mark a job as uncompleted. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::JobsApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +job_reopen = Phrase::JobReopen.new # JobReopen | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Reopen a job + result = api_instance.job_reopen(project_id, id, job_reopen, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling JobsApi->job_reopen: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **job_reopen** | [**JobReopen**](JobReopen.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## job_show + +> Object job_show(project_id, id, job_show, opts) + +Get a single job + +Get details on a single job for a given project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::JobsApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +job_show = Phrase::JobShow.new # JobShow | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single job + result = api_instance.job_show(project_id, id, job_show, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling JobsApi->job_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **job_show** | [**JobShow**](JobShow.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## job_start + +> Object job_start(project_id, id, job_start, opts) + +Start a job + +Starts an existing job in state draft. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::JobsApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +job_start = Phrase::JobStart.new # JobStart | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Start a job + result = api_instance.job_start(project_id, id, job_start, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling JobsApi->job_start: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **job_start** | [**JobStart**](JobStart.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## job_update + +> Object job_update(project_id, id, job_update, opts) + +Update a job + +Update an existing job. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::JobsApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +job_update = Phrase::JobUpdate.new # JobUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update a job + result = api_instance.job_update(project_id, id, job_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling JobsApi->job_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **job_update** | [**JobUpdate**](JobUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## jobs_list + +> Array<Job> jobs_list(project_id, jobs_list, opts) + +List jobs + +List all jobs for the given project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::JobsApi.new +project_id = 'project_id_example' # String | Project ID +jobs_list = Phrase::JobsList.new # JobsList | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List jobs + result = api_instance.jobs_list(project_id, jobs_list, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling JobsApi->jobs_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **jobs_list** | [**JobsList**](JobsList.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<([**Array<Job>**](Job.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/docs/JobsList.md b/docs/JobsList.md new file mode 100644 index 0000000..f3f11ee --- /dev/null +++ b/docs/JobsList.md @@ -0,0 +1,23 @@ +# Phrase::JobsList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**owned_by** | **String** | filter by user owning job | [optional] +**assigned_to** | **String** | filter by user assigned to job | [optional] +**state** | **String** | filter by state of job Valid states are <code>draft</code>, <code>in_progress</code>, <code>completed</code> | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::JobsList.new(branch: my-feature-branch, + owned_by: abcd1234cdef1234abcd1234cdef1234, + assigned_to: abcd1234cdef1234abcd1234cdef1234, + state: completed) +``` + + diff --git a/docs/KeyCreate.md b/docs/KeyCreate.md new file mode 100644 index 0000000..1333087 --- /dev/null +++ b/docs/KeyCreate.md @@ -0,0 +1,45 @@ +# Phrase::KeyCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**name** | **String** | Key name | [optional] +**description** | **String** | Key description (usually includes contextual information for translators) | [optional] +**plural** | **String** | Indicates whether key supports pluralization | [optional] +**name_plural** | **String** | Plural name for the key (used in some file formats, e.g. Gettext) | [optional] +**data_type** | **String** | Type of the key. Can be one of the following: string, number, boolean, array, markdown. | [optional] +**tags** | **String** | List of tags separated by comma to be associated with the key. | [optional] +**max_characters_allowed** | **String** | Max. number of characters translations for this key can have. | [optional] +**screenshot** | **String** | Screenshot/image for the key. This parameter is deprecated. Please use the Screenshots endpoint instead. | [optional] +**remove_screenshot** | **String** | Indicates whether the screenshot will be deleted. This parameter is deprecated. Please use the Screenshots endpoint instead. | [optional] +**unformatted** | **String** | Indicates whether the key should be exported as \"unformatted\". Supported by Android XML and other formats. | [optional] +**xml_space_preserve** | **String** | Indicates whether the key should be exported with \"xml:space=preserve\". Supported by several XML-based formats. | [optional] +**original_file** | **String** | Original file attribute. Used in some formats, e.g. XLIFF. | [optional] +**localized_format_string** | **String** | NSStringLocalizedFormatKey attribute. Used in .stringsdict format. | [optional] +**localized_format_key** | **String** | NSStringLocalizedFormatKey attribute. Used in .stringsdict format. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::KeyCreate.new(branch: my-feature-branch, + name: home.index.headline, + description: Some description worth knowing..., + plural: null, + name_plural: home.index.headlines, + data_type: number, + tags: awesome-feature,needs-proofreading, + max_characters_allowed: 140, + screenshot: /path/to/my/screenshot.png, + remove_screenshot: null, + unformatted: null, + xml_space_preserve: null, + original_file: null, + localized_format_string: null, + localized_format_key: null) +``` + + diff --git a/docs/KeyDelete.md b/docs/KeyDelete.md new file mode 100644 index 0000000..525f41f --- /dev/null +++ b/docs/KeyDelete.md @@ -0,0 +1,17 @@ +# Phrase::KeyDelete + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::KeyDelete.new(branch: my-feature-branch) +``` + + diff --git a/docs/KeyPreview.md b/docs/KeyPreview.md new file mode 100644 index 0000000..dd67d9f --- /dev/null +++ b/docs/KeyPreview.md @@ -0,0 +1,21 @@ +# Phrase::KeyPreview + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**name** | **String** | | [optional] +**plural** | **Boolean** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::KeyPreview.new(id: null, + name: null, + plural: null) +``` + + diff --git a/docs/KeyShow.md b/docs/KeyShow.md new file mode 100644 index 0000000..d3ffbef --- /dev/null +++ b/docs/KeyShow.md @@ -0,0 +1,17 @@ +# Phrase::KeyShow + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::KeyShow.new(branch: my-feature-branch) +``` + + diff --git a/docs/KeyUpdate.md b/docs/KeyUpdate.md new file mode 100644 index 0000000..0d78d12 --- /dev/null +++ b/docs/KeyUpdate.md @@ -0,0 +1,45 @@ +# Phrase::KeyUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**name** | **String** | Key name | [optional] +**description** | **String** | Key description (usually includes contextual information for translators) | [optional] +**plural** | **String** | Indicates whether key supports pluralization | [optional] +**name_plural** | **String** | Plural name for the key (used in some file formats, e.g. Gettext) | [optional] +**data_type** | **String** | Type of the key. Can be one of the following: string, number, boolean, array, markdown. | [optional] +**tags** | **String** | List of tags separated by comma to be associated with the key. | [optional] +**max_characters_allowed** | **String** | Max. number of characters translations for this key can have. | [optional] +**screenshot** | **String** | Screenshot/image for the key. This parameter is deprecated. Please use the Screenshots endpoint instead. | [optional] +**remove_screenshot** | **String** | Indicates whether the screenshot will be deleted. This parameter is deprecated. Please use the Screenshots endpoint instead. | [optional] +**unformatted** | **String** | Indicates whether the key should be exported as \"unformatted\". Supported by Android XML and other formats. | [optional] +**xml_space_preserve** | **String** | Indicates whether the key should be exported with \"xml:space=preserve\". Supported by several XML-based formats. | [optional] +**original_file** | **String** | Original file attribute. Used in some formats, e.g. XLIFF. | [optional] +**localized_format_string** | **String** | NSStringLocalizedFormatKey attribute. Used in .stringsdict format. | [optional] +**localized_format_key** | **String** | NSStringLocalizedFormatKey attribute. Used in .stringsdict format. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::KeyUpdate.new(branch: my-feature-branch, + name: home.index.headline, + description: Some description worth knowing..., + plural: null, + name_plural: home.index.headlines, + data_type: number, + tags: awesome-feature,needs-proofreading, + max_characters_allowed: 140, + screenshot: /path/to/my/screenshot.png, + remove_screenshot: null, + unformatted: null, + xml_space_preserve: null, + original_file: null, + localized_format_string: null, + localized_format_key: null) +``` + + diff --git a/docs/KeysApi.md b/docs/KeysApi.md new file mode 100644 index 0000000..84759ae --- /dev/null +++ b/docs/KeysApi.md @@ -0,0 +1,605 @@ +# Phrase::KeysApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**key_create**](KeysApi.md#key_create) | **POST** /projects/{project_id}/keys | Create a key +[**key_delete**](KeysApi.md#key_delete) | **DELETE** /projects/{project_id}/keys/{id} | Delete a key +[**key_show**](KeysApi.md#key_show) | **GET** /projects/{project_id}/keys/{id} | Get a single key +[**key_update**](KeysApi.md#key_update) | **PATCH** /projects/{project_id}/keys/{id} | Update a key +[**keys_delete**](KeysApi.md#keys_delete) | **DELETE** /projects/{project_id}/keys | Delete collection of keys +[**keys_list**](KeysApi.md#keys_list) | **GET** /projects/{project_id}/keys | List keys +[**keys_search**](KeysApi.md#keys_search) | **POST** /projects/{project_id}/keys/search | Search keys +[**keys_tag**](KeysApi.md#keys_tag) | **PATCH** /projects/{project_id}/keys/tag | Add tags to collection of keys +[**keys_untag**](KeysApi.md#keys_untag) | **PATCH** /projects/{project_id}/keys/untag | Remove tags from collection of keys + + + +## key_create + +> key_create(project_id, key_create, opts) + +Create a key + +Create a new key. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::KeysApi.new +project_id = 'project_id_example' # String | Project ID +key_create = Phrase::KeyCreate.new # KeyCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a key + api_instance.key_create(project_id, key_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling KeysApi->key_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **key_create** | [**KeyCreate**](KeyCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## key_delete + +> key_delete(project_id, id, key_delete, opts) + +Delete a key + +Delete an existing key. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::KeysApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +key_delete = Phrase::KeyDelete.new # KeyDelete | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete a key + api_instance.key_delete(project_id, id, key_delete, opts) +rescue Phrase::ApiError => e + puts "Exception when calling KeysApi->key_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **key_delete** | [**KeyDelete**](KeyDelete.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## key_show + +> Object key_show(project_id, id, key_show, opts) + +Get a single key + +Get details on a single key for a given project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::KeysApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +key_show = Phrase::KeyShow.new # KeyShow | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single key + result = api_instance.key_show(project_id, id, key_show, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling KeysApi->key_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **key_show** | [**KeyShow**](KeyShow.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## key_update + +> Object key_update(project_id, id, key_update, opts) + +Update a key + +Update an existing key. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::KeysApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +key_update = Phrase::KeyUpdate.new # KeyUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update a key + result = api_instance.key_update(project_id, id, key_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling KeysApi->key_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **key_update** | [**KeyUpdate**](KeyUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## keys_delete + +> AffectedResources keys_delete(project_id, keys_delete, opts) + +Delete collection of keys + +Delete all keys matching query. Same constraints as list. Please limit the number of affected keys to about 1,000 as you might experience timeouts otherwise. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::KeysApi.new +project_id = 'project_id_example' # String | Project ID +keys_delete = Phrase::KeysDelete.new # KeysDelete | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete collection of keys + result = api_instance.keys_delete(project_id, keys_delete, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling KeysApi->keys_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **keys_delete** | [**KeysDelete**](KeysDelete.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**AffectedResources**](AffectedResources.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## keys_list + +> Array<TranslationKey> keys_list(project_id, keys_list, opts) + +List keys + +List all keys for the given project. Alternatively you can POST requests to /search. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::KeysApi.new +project_id = 'project_id_example' # String | Project ID +keys_list = Phrase::KeysList.new # KeysList | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List keys + result = api_instance.keys_list(project_id, keys_list, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling KeysApi->keys_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **keys_list** | [**KeysList**](KeysList.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<([**Array<TranslationKey>**](TranslationKey.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## keys_search + +> Array<Object> keys_search(project_id, keys_search, opts) + +Search keys + +Search keys for the given project matching query. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::KeysApi.new +project_id = 'project_id_example' # String | Project ID +keys_search = Phrase::KeysSearch.new # KeysSearch | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #Search keys + result = api_instance.keys_search(project_id, keys_search, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling KeysApi->keys_search: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **keys_search** | [**KeysSearch**](KeysSearch.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<(**Array<Object>**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## keys_tag + +> Object keys_tag(project_id, keys_tag, opts) + +Add tags to collection of keys + +Tags all keys matching query. Same constraints as list. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::KeysApi.new +project_id = 'project_id_example' # String | Project ID +keys_tag = Phrase::KeysTag.new # KeysTag | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Add tags to collection of keys + result = api_instance.keys_tag(project_id, keys_tag, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling KeysApi->keys_tag: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **keys_tag** | [**KeysTag**](KeysTag.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## keys_untag + +> Object keys_untag(project_id, keys_untag, opts) + +Remove tags from collection of keys + +Removes specified tags from keys matching query. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::KeysApi.new +project_id = 'project_id_example' # String | Project ID +keys_untag = Phrase::KeysUntag.new # KeysUntag | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Remove tags from collection of keys + result = api_instance.keys_untag(project_id, keys_untag, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling KeysApi->keys_untag: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **keys_untag** | [**KeysUntag**](KeysUntag.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/docs/KeysDelete.md b/docs/KeysDelete.md new file mode 100644 index 0000000..2ada9fe --- /dev/null +++ b/docs/KeysDelete.md @@ -0,0 +1,21 @@ +# Phrase::KeysDelete + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**q** | **String** | q_description_placeholder | [optional] +**locale_id** | **String** | Locale used to determine the translation state of a key when filtering for untranslated or translated keys. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::KeysDelete.new(branch: my-feature-branch, + q: mykey* translated:true, + locale_id: abcd1234abcd1234abcd1234abcd1234) +``` + + diff --git a/docs/KeysList.md b/docs/KeysList.md new file mode 100644 index 0000000..5d76e5e --- /dev/null +++ b/docs/KeysList.md @@ -0,0 +1,25 @@ +# Phrase::KeysList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**sort** | **String** | Sort by field. Can be one of: name, created_at, updated_at. | [optional] +**order** | **String** | Order direction. Can be one of: asc, desc. | [optional] +**q** | **String** | q_description_placeholder | [optional] +**locale_id** | **String** | Locale used to determine the translation state of a key when filtering for untranslated or translated keys. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::KeysList.new(branch: my-feature-branch, + sort: updated_at, + order: desc, + q: mykey* translated:true, + locale_id: abcd1234abcd1234abcd1234abcd1234) +``` + + diff --git a/docs/KeysSearch.md b/docs/KeysSearch.md new file mode 100644 index 0000000..2638d30 --- /dev/null +++ b/docs/KeysSearch.md @@ -0,0 +1,25 @@ +# Phrase::KeysSearch + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**sort** | **String** | Sort by field. Can be one of: name, created_at, updated_at. | [optional] +**order** | **String** | Order direction. Can be one of: asc, desc. | [optional] +**q** | **String** | q_description_placeholder | [optional] +**locale_id** | **String** | Locale used to determine the translation state of a key when filtering for untranslated or translated keys. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::KeysSearch.new(branch: my-feature-branch, + sort: updated_at, + order: desc, + q: mykey* translated:true, + locale_id: abcd1234abcd1234abcd1234abcd1234) +``` + + diff --git a/docs/KeysTag.md b/docs/KeysTag.md new file mode 100644 index 0000000..4149e7b --- /dev/null +++ b/docs/KeysTag.md @@ -0,0 +1,23 @@ +# Phrase::KeysTag + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**q** | **String** | q_description_placeholder | [optional] +**locale_id** | **String** | Locale used to determine the translation state of a key when filtering for untranslated or translated keys. | [optional] +**tags** | **String** | Tag or comma-separated list of tags to add to the matching collection of keys | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::KeysTag.new(branch: my-feature-branch, + q: mykey* translated:true, + locale_id: abcd1234abcd1234abcd1234abcd1234, + tags: landing-page,release-1.2) +``` + + diff --git a/docs/KeysUntag.md b/docs/KeysUntag.md new file mode 100644 index 0000000..25b6fb1 --- /dev/null +++ b/docs/KeysUntag.md @@ -0,0 +1,23 @@ +# Phrase::KeysUntag + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**q** | **String** | q_description_placeholder | [optional] +**locale_id** | **String** | Locale used to determine the translation state of a key when filtering for untranslated or translated keys. | [optional] +**tags** | **String** | Tag or comma-separated list of tags to remove from the matching collection of keys | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::KeysUntag.new(branch: my-feature-branch, + q: mykey* translated:true, + locale_id: abcd1234abcd1234abcd1234abcd1234, + tags: landing-page,release-1.2) +``` + + diff --git a/docs/Locale.md b/docs/Locale.md new file mode 100644 index 0000000..728d5b6 --- /dev/null +++ b/docs/Locale.md @@ -0,0 +1,35 @@ +# Phrase::Locale + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**name** | **String** | | [optional] +**code** | **String** | | [optional] +**default** | **Boolean** | | [optional] +**main** | **Boolean** | | [optional] +**rtl** | **Boolean** | | [optional] +**plural_forms** | **Array<String>** | | [optional] +**source_locale** | **Object** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Locale.new(id: null, + name: null, + code: null, + default: null, + main: null, + rtl: null, + plural_forms: null, + source_locale: null, + created_at: null, + updated_at: null) +``` + + diff --git a/docs/LocaleCreate.md b/docs/LocaleCreate.md new file mode 100644 index 0000000..54182df --- /dev/null +++ b/docs/LocaleCreate.md @@ -0,0 +1,35 @@ +# Phrase::LocaleCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**name** | **String** | Locale name | [optional] +**code** | **String** | Locale ISO code | [optional] +**default** | **String** | Indicates whether locale is the default locale. If set to true, the previous default locale the project is no longer the default locale. | [optional] +**main** | **String** | Indicates whether locale is a main locale. Main locales are part of the <a href=\"https://help.phrase.com/help/verification-and-proofreading\" target=\"_blank\">Verification System</a> feature. | [optional] +**rtl** | **String** | Indicates whether locale is a RTL (Right-to-Left) locale. | [optional] +**source_locale_id** | **String** | Source locale. Can be the name or public id of the locale. Preferred is the public id. | [optional] +**unverify_new_translations** | **String** | Indicates that new translations for this locale should be marked as unverified. Part of the <a href=\"https://help.phrase.com/help/verification-and-proofreading\" target=\"_blank\">Advanced Workflows</a> feature. | [optional] +**unverify_updated_translations** | **String** | Indicates that updated translations for this locale should be marked as unverified. Part of the <a href=\"https://help.phrase.com/help/verification-and-proofreading\" target=\"_blank\">Advanced Workflows</a> feature. | [optional] +**autotranslate** | **String** | If set, translations for this locale will be fetched automatically, right after creation. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::LocaleCreate.new(branch: my-feature-branch, + name: de, + code: de-DE, + default: null, + main: null, + rtl: null, + source_locale_id: abcd1234abcd1234abcd1234abcd1234, + unverify_new_translations: null, + unverify_updated_translations: null, + autotranslate: null) +``` + + diff --git a/docs/LocaleDelete.md b/docs/LocaleDelete.md new file mode 100644 index 0000000..6bafcbd --- /dev/null +++ b/docs/LocaleDelete.md @@ -0,0 +1,17 @@ +# Phrase::LocaleDelete + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::LocaleDelete.new(branch: my-feature-branch) +``` + + diff --git a/docs/LocaleDownload.md b/docs/LocaleDownload.md new file mode 100644 index 0000000..a7b0e8e --- /dev/null +++ b/docs/LocaleDownload.md @@ -0,0 +1,43 @@ +# Phrase::LocaleDownload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**file_format** | **String** | File format name. See the format guide for all supported file formats. | [optional] +**tags** | **String** | Limit results to keys tagged with a list of comma separated tag names. | [optional] +**tag** | **String** | Limit download to tagged keys. This parameter is deprecated. Please use the \"tags\" parameter instead | [optional] +**include_empty_translations** | **String** | Indicates whether keys without translations should be included in the output as well. | [optional] +**include_translated_keys** | **String** | Include translated keys in the locale file. Use in combination with include_empty_translations to obtain only untranslated keys. | [optional] +**keep_notranslate_tags** | **String** | Indicates whether [NOTRANSLATE] tags should be kept. | [optional] +**convert_emoji** | **String** | This option is obsolete. Projects that were created on or after Nov 29th 2019 or that did not contain emoji by then will not require this flag any longer since emoji are now supported natively. | [optional] +**format_options** | **String** | Additional formatting and render options. See the <a href=\"https://help.phrase.com/help/supported-platforms-and-formats\">format guide</a> for a list of options available for each format. Specify format options like this: <code>...&format_options[foo]=bar</code> | [optional] +**encoding** | **String** | Enforces a specific encoding on the file contents. Valid options are \"UTF-8\", \"UTF-16\" and \"ISO-8859-1\". | [optional] +**skip_unverified_translations** | **String** | Indicates whether the locale file should skip all unverified translations. This parameter is deprecated and should be replaced with <code>include_unverified_translations</code>. | [optional] +**include_unverified_translations** | **String** | if set to false unverified translations are excluded | [optional] +**use_last_reviewed_version** | **String** | If set to true the last reviewed version of a translation is used. This is only available if the review workflow (currently in beta) is enabled for the project. | [optional] +**fallback_locale_id** | **String** | If a key has no translation in the locale being downloaded the translation in the fallback locale will be used. Provide the public ID of the locale that should be used as the fallback. Requires include_empty_translations to be set to <code>true</code>. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::LocaleDownload.new(branch: my-feature-branch, + file_format: yml, + tags: feature1,feature2, + tag: feature, + include_empty_translations: null, + include_translated_keys: null, + keep_notranslate_tags: null, + convert_emoji: null, + format_options: null, + encoding: null, + skip_unverified_translations: null, + include_unverified_translations: null, + use_last_reviewed_version: null, + fallback_locale_id: null) +``` + + diff --git a/docs/LocalePreview.md b/docs/LocalePreview.md new file mode 100644 index 0000000..6edf232 --- /dev/null +++ b/docs/LocalePreview.md @@ -0,0 +1,21 @@ +# Phrase::LocalePreview + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**name** | **String** | | [optional] +**code** | **String** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::LocalePreview.new(id: null, + name: null, + code: null) +``` + + diff --git a/docs/LocaleShow.md b/docs/LocaleShow.md new file mode 100644 index 0000000..ad77968 --- /dev/null +++ b/docs/LocaleShow.md @@ -0,0 +1,17 @@ +# Phrase::LocaleShow + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::LocaleShow.new(branch: my-feature-branch) +``` + + diff --git a/docs/LocaleUpdate.md b/docs/LocaleUpdate.md new file mode 100644 index 0000000..f69e7fb --- /dev/null +++ b/docs/LocaleUpdate.md @@ -0,0 +1,35 @@ +# Phrase::LocaleUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**name** | **String** | Locale name | [optional] +**code** | **String** | Locale ISO code | [optional] +**default** | **String** | Indicates whether locale is the default locale. If set to true, the previous default locale the project is no longer the default locale. | [optional] +**main** | **String** | Indicates whether locale is a main locale. Main locales are part of the <a href=\"https://help.phrase.com/help/verification-and-proofreading\" target=\"_blank\">Verification System</a> feature. | [optional] +**rtl** | **String** | Indicates whether locale is a RTL (Right-to-Left) locale. | [optional] +**source_locale_id** | **String** | Source locale. Can be the name or public id of the locale. Preferred is the public id. | [optional] +**unverify_new_translations** | **String** | Indicates that new translations for this locale should be marked as unverified. Part of the <a href=\"https://help.phrase.com/help/verification-and-proofreading\" target=\"_blank\">Advanced Workflows</a> feature. | [optional] +**unverify_updated_translations** | **String** | Indicates that updated translations for this locale should be marked as unverified. Part of the <a href=\"https://help.phrase.com/help/verification-and-proofreading\" target=\"_blank\">Advanced Workflows</a> feature. | [optional] +**autotranslate** | **String** | If set, translations for this locale will be fetched automatically, right after creation. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::LocaleUpdate.new(branch: my-feature-branch, + name: de, + code: de-DE, + default: null, + main: null, + rtl: null, + source_locale_id: abcd1234abcd1234abcd1234abcd1234, + unverify_new_translations: null, + unverify_updated_translations: null, + autotranslate: null) +``` + + diff --git a/docs/LocalesApi.md b/docs/LocalesApi.md new file mode 100644 index 0000000..fb68fd3 --- /dev/null +++ b/docs/LocalesApi.md @@ -0,0 +1,407 @@ +# Phrase::LocalesApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**locale_create**](LocalesApi.md#locale_create) | **POST** /projects/{project_id}/locales | Create a locale +[**locale_delete**](LocalesApi.md#locale_delete) | **DELETE** /projects/{project_id}/locales/{id} | Delete a locale +[**locale_download**](LocalesApi.md#locale_download) | **GET** /projects/{project_id}/locales/{id}/download | Download a locale +[**locale_show**](LocalesApi.md#locale_show) | **GET** /projects/{project_id}/locales/{id} | Get a single locale +[**locale_update**](LocalesApi.md#locale_update) | **PATCH** /projects/{project_id}/locales/{id} | Update a locale +[**locales_list**](LocalesApi.md#locales_list) | **GET** /projects/{project_id}/locales | List locales + + + +## locale_create + +> locale_create(project_id, locale_create, opts) + +Create a locale + +Create a new locale. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::LocalesApi.new +project_id = 'project_id_example' # String | Project ID +locale_create = Phrase::LocaleCreate.new # LocaleCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a locale + api_instance.locale_create(project_id, locale_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling LocalesApi->locale_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **locale_create** | [**LocaleCreate**](LocaleCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## locale_delete + +> locale_delete(project_id, id, locale_delete, opts) + +Delete a locale + +Delete an existing locale. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::LocalesApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +locale_delete = Phrase::LocaleDelete.new # LocaleDelete | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete a locale + api_instance.locale_delete(project_id, id, locale_delete, opts) +rescue Phrase::ApiError => e + puts "Exception when calling LocalesApi->locale_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **locale_delete** | [**LocaleDelete**](LocaleDelete.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## locale_download + +> locale_download(project_id, id, locale_download, opts) + +Download a locale + +Download a locale in a specific file format. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::LocalesApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +locale_download = Phrase::LocaleDownload.new # LocaleDownload | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Download a locale + api_instance.locale_download(project_id, id, locale_download, opts) +rescue Phrase::ApiError => e + puts "Exception when calling LocalesApi->locale_download: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **locale_download** | [**LocaleDownload**](LocaleDownload.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## locale_show + +> Object locale_show(project_id, id, locale_show, opts) + +Get a single locale + +Get details on a single locale for a given project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::LocalesApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +locale_show = Phrase::LocaleShow.new # LocaleShow | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single locale + result = api_instance.locale_show(project_id, id, locale_show, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling LocalesApi->locale_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **locale_show** | [**LocaleShow**](LocaleShow.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## locale_update + +> Object locale_update(project_id, id, locale_update, opts) + +Update a locale + +Update an existing locale. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::LocalesApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +locale_update = Phrase::LocaleUpdate.new # LocaleUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update a locale + result = api_instance.locale_update(project_id, id, locale_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling LocalesApi->locale_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **locale_update** | [**LocaleUpdate**](LocaleUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## locales_list + +> Array<Locale> locales_list(project_id, locales_list, opts) + +List locales + +List all locales for the given project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::LocalesApi.new +project_id = 'project_id_example' # String | Project ID +locales_list = Phrase::LocalesList.new # LocalesList | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List locales + result = api_instance.locales_list(project_id, locales_list, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling LocalesApi->locales_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **locales_list** | [**LocalesList**](LocalesList.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<([**Array<Locale>**](Locale.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/docs/LocalesList.md b/docs/LocalesList.md new file mode 100644 index 0000000..9592d12 --- /dev/null +++ b/docs/LocalesList.md @@ -0,0 +1,17 @@ +# Phrase::LocalesList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::LocalesList.new(branch: my-feature-branch) +``` + + diff --git a/docs/Member.md b/docs/Member.md new file mode 100644 index 0000000..a7c686f --- /dev/null +++ b/docs/Member.md @@ -0,0 +1,25 @@ +# Phrase::Member + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**email** | **String** | | [optional] +**username** | **String** | | [optional] +**role** | **String** | | [optional] +**projects** | **Array<Object>** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Member.new(id: null, + email: null, + username: null, + role: null, + projects: null) +``` + + diff --git a/docs/MemberUpdate.md b/docs/MemberUpdate.md new file mode 100644 index 0000000..f9e9535 --- /dev/null +++ b/docs/MemberUpdate.md @@ -0,0 +1,23 @@ +# Phrase::MemberUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**role** | **String** | Member role, can be any of of Manager, Developer, Translator | [optional] +**project_ids** | **String** | List of project ids the user has access to. | [optional] +**locale_ids** | **String** | List of locale ids the user has access to. | [optional] +**permissions** | **String** | Additional permissions depending on member role. Available permissions are <code>create_upload</code> and <code>review_translations</code> | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::MemberUpdate.new(role: Developer, + project_ids: abcd1234abcd1234abcd1234,abcd1234abcd1234abcd1235, + locale_ids: abcd1234abcd1234abcd1234,abcd1234abcd1234abcd1235, + permissions: {"create_upload":true,"review_translations":true}) +``` + + diff --git a/docs/MembersApi.md b/docs/MembersApi.md new file mode 100644 index 0000000..d1f032c --- /dev/null +++ b/docs/MembersApi.md @@ -0,0 +1,271 @@ +# Phrase::MembersApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**member_delete**](MembersApi.md#member_delete) | **DELETE** /accounts/{account_id}/members/{id} | Remove a user from the account +[**member_show**](MembersApi.md#member_show) | **GET** /accounts/{account_id}/members/{id} | Get single member +[**member_update**](MembersApi.md#member_update) | **PATCH** /accounts/{account_id}/members/{id} | Update a member +[**members_list**](MembersApi.md#members_list) | **GET** /accounts/{account_id}/members | List members + + + +## member_delete + +> member_delete(account_id, id, opts) + +Remove a user from the account + +Remove a user from the account. The user will be removed from the account but not deleted from Phrase. Access token scope must include team.manage. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::MembersApi.new +account_id = 'account_id_example' # String | Account ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Remove a user from the account + api_instance.member_delete(account_id, id, opts) +rescue Phrase::ApiError => e + puts "Exception when calling MembersApi->member_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## member_show + +> Member member_show(account_id, id, opts) + +Get single member + +Get details on a single user in the account. Access token scope must include team.manage. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::MembersApi.new +account_id = 'account_id_example' # String | Account ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get single member + result = api_instance.member_show(account_id, id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling MembersApi->member_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**Member**](Member.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## member_update + +> Object member_update(account_id, id, member_update, opts) + +Update a member + +Update user permissions in the account. Developers and translators need project_ids and locale_ids assigned to access them. Access token scope must include team.manage. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::MembersApi.new +account_id = 'account_id_example' # String | Account ID +id = 'id_example' # String | ID +member_update = Phrase::MemberUpdate.new # MemberUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update a member + result = api_instance.member_update(account_id, id, member_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling MembersApi->member_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **id** | **String**| ID | + **member_update** | [**MemberUpdate**](MemberUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## members_list + +> Array<Object> members_list(account_id, opts) + +List members + +Get all users active in the account. It also lists resources like projects and locales the member has access to. In case nothing is shown the default access from the role is used. Access token scope must include team.manage. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::MembersApi.new +account_id = 'account_id_example' # String | Account ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List members + result = api_instance.members_list(account_id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling MembersApi->members_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<(**Array<Object>**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/docs/OrderConfirm.md b/docs/OrderConfirm.md new file mode 100644 index 0000000..f621e2b --- /dev/null +++ b/docs/OrderConfirm.md @@ -0,0 +1,17 @@ +# Phrase::OrderConfirm + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::OrderConfirm.new(branch: my-feature-branch) +``` + + diff --git a/docs/OrderCreate.md b/docs/OrderCreate.md new file mode 100644 index 0000000..d4aa529 --- /dev/null +++ b/docs/OrderCreate.md @@ -0,0 +1,43 @@ +# Phrase::OrderCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**lsp** | **String** | Name of the LSP that should process this order. Can be one of gengo, textmaster. | [optional] +**source_locale_id** | **String** | Source locale for the order. Can be the name or public id of the source locale. Preferred is the public id. | [optional] +**target_locale_ids** | **String** | List of target locales you want the source content translate to. Can be the name or public id of the target locales. Preferred is the public id. | [optional] +**translation_type** | **String** | Name of the quality level, availability depends on the LSP. Can be one of: standard, pro (for orders processed by Gengo) and one of regular, premium, enterprise (for orders processed by TextMaster) | [optional] +**tag** | **String** | Tag you want to order translations for. | [optional] +**message** | **String** | Message that is displayed to the translators for description. | [optional] +**styleguide_id** | **String** | Style guide for translators to be sent with the order. | [optional] +**unverify_translations_upon_delivery** | **String** | Unverify translations upon delivery. | [optional] +**include_untranslated_keys** | **String** | Order translations for keys with untranslated content in the selected target locales. | [optional] +**include_unverified_translations** | **String** | Order translations for keys with unverified content in the selected target locales. | [optional] +**category** | **String** | Category to use (required for orders processed by TextMaster). | [optional] +**quality** | **String** | Extra proofreading option to ensure consistency in vocabulary and style. Only available for orders processed by TextMaster. | [optional] +**priority** | **String** | Indicates whether the priority option should be ordered which decreases turnaround time by 30%. Available only for orders processed by TextMaster. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::OrderCreate.new(branch: my-feature-branch, + lsp: textmaster, + source_locale_id: abcd1234abcd1234abcd1234abcd1234, + target_locale_ids: ["1234abcd1234abcd1234abcd1234abcd","abcd1234abcd1234abcd1234abcd1234"], + translation_type: premium, + tag: my-awesome-feature, + message: Please make everything sound really nice :), + styleguide_id: 1234abcd1234abcd1234abcd1234abcd, + unverify_translations_upon_delivery: null, + include_untranslated_keys: null, + include_unverified_translations: null, + category: C021, + quality: null, + priority: null) +``` + + diff --git a/docs/OrderDelete.md b/docs/OrderDelete.md new file mode 100644 index 0000000..8e3a43e --- /dev/null +++ b/docs/OrderDelete.md @@ -0,0 +1,17 @@ +# Phrase::OrderDelete + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::OrderDelete.new(branch: my-feature-branch) +``` + + diff --git a/docs/OrderShow.md b/docs/OrderShow.md new file mode 100644 index 0000000..b0268b9 --- /dev/null +++ b/docs/OrderShow.md @@ -0,0 +1,17 @@ +# Phrase::OrderShow + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::OrderShow.new(branch: my-feature-branch) +``` + + diff --git a/docs/OrdersApi.md b/docs/OrdersApi.md new file mode 100644 index 0000000..eff91c0 --- /dev/null +++ b/docs/OrdersApi.md @@ -0,0 +1,341 @@ +# Phrase::OrdersApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**order_confirm**](OrdersApi.md#order_confirm) | **PATCH** /projects/{project_id}/orders/{id}/confirm | Confirm an order +[**order_create**](OrdersApi.md#order_create) | **POST** /projects/{project_id}/orders | Create a new order +[**order_delete**](OrdersApi.md#order_delete) | **DELETE** /projects/{project_id}/orders/{id} | Cancel an order +[**order_show**](OrdersApi.md#order_show) | **GET** /projects/{project_id}/orders/{id} | Get a single order +[**orders_list**](OrdersApi.md#orders_list) | **GET** /projects/{project_id}/orders | List orders + + + +## order_confirm + +> Object order_confirm(project_id, id, order_confirm, opts) + +Confirm an order + +Confirm an existing order and send it to the provider for translation. Same constraints as for create. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::OrdersApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +order_confirm = Phrase::OrderConfirm.new # OrderConfirm | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Confirm an order + result = api_instance.order_confirm(project_id, id, order_confirm, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling OrdersApi->order_confirm: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **order_confirm** | [**OrderConfirm**](OrderConfirm.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## order_create + +> order_create(project_id, order_create, opts) + +Create a new order + +Create a new order. Access token scope must include orders.create. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::OrdersApi.new +project_id = 'project_id_example' # String | Project ID +order_create = Phrase::OrderCreate.new # OrderCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a new order + api_instance.order_create(project_id, order_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling OrdersApi->order_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **order_create** | [**OrderCreate**](OrderCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## order_delete + +> order_delete(project_id, id, order_delete, opts) + +Cancel an order + +Cancel an existing order. Must not yet be confirmed. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::OrdersApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +order_delete = Phrase::OrderDelete.new # OrderDelete | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Cancel an order + api_instance.order_delete(project_id, id, order_delete, opts) +rescue Phrase::ApiError => e + puts "Exception when calling OrdersApi->order_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **order_delete** | [**OrderDelete**](OrderDelete.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## order_show + +> TranslationOrder order_show(project_id, id, order_show, opts) + +Get a single order + +Get details on a single order. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::OrdersApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +order_show = Phrase::OrderShow.new # OrderShow | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single order + result = api_instance.order_show(project_id, id, order_show, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling OrdersApi->order_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **order_show** | [**OrderShow**](OrderShow.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**TranslationOrder**](TranslationOrder.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## orders_list + +> Array<Object> orders_list(project_id, orders_list, opts) + +List orders + +List all orders for the given project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::OrdersApi.new +project_id = 'project_id_example' # String | Project ID +orders_list = Phrase::OrdersList.new # OrdersList | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List orders + result = api_instance.orders_list(project_id, orders_list, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling OrdersApi->orders_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **orders_list** | [**OrdersList**](OrdersList.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<(**Array<Object>**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/docs/OrdersList.md b/docs/OrdersList.md new file mode 100644 index 0000000..9a18b0d --- /dev/null +++ b/docs/OrdersList.md @@ -0,0 +1,17 @@ +# Phrase::OrdersList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::OrdersList.new(branch: my-feature-branch) +``` + + diff --git a/docs/Project.md b/docs/Project.md new file mode 100644 index 0000000..675b421 --- /dev/null +++ b/docs/Project.md @@ -0,0 +1,29 @@ +# Phrase::Project + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**name** | **String** | | [optional] +**main_format** | **String** | | [optional] +**project_image_url** | **String** | | [optional] +**account** | [**Account**](Account.md) | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Project.new(id: null, + name: null, + main_format: null, + project_image_url: null, + account: null, + created_at: null, + updated_at: null) +``` + + diff --git a/docs/ProjectCreate.md b/docs/ProjectCreate.md new file mode 100644 index 0000000..4958b99 --- /dev/null +++ b/docs/ProjectCreate.md @@ -0,0 +1,27 @@ +# Phrase::ProjectCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Name of the project | [optional] +**main_format** | **String** | Main file format specified by its API Extension name. Used for locale downloads if no format is specified. For API Extension names of available file formats see <a href=\"https://help.phrase.com/help/supported-platforms-and-formats\">Format Guide</a> or our <a href=\"#formats\">Formats API Endpoint</a>. | [optional] +**shares_translation_memory** | **String** | Indicates whether the project should share the account's translation memory | [optional] +**project_image** | **String** | Image to identify the project | [optional] +**remove_project_image** | **String** | Indicates whether the project image should be deleted. | [optional] +**account_id** | **String** | Account ID to specify the actual account the project should be created in. Required if the requesting user is a member of multiple accounts. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::ProjectCreate.new(name: My Android Project, + main_format: yml, + shares_translation_memory: true, + project_image: /path/to/my/project-screenshot.png, + remove_project_image: null, + account_id: abcd1234) +``` + + diff --git a/docs/ProjectShort.md b/docs/ProjectShort.md new file mode 100644 index 0000000..b916156 --- /dev/null +++ b/docs/ProjectShort.md @@ -0,0 +1,25 @@ +# Phrase::ProjectShort + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**name** | **String** | | [optional] +**main_format** | **String** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::ProjectShort.new(id: null, + name: null, + main_format: null, + created_at: null, + updated_at: null) +``` + + diff --git a/docs/ProjectUpdate.md b/docs/ProjectUpdate.md new file mode 100644 index 0000000..809c11c --- /dev/null +++ b/docs/ProjectUpdate.md @@ -0,0 +1,27 @@ +# Phrase::ProjectUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Name of the project | [optional] +**main_format** | **String** | Main file format specified by its API Extension name. Used for locale downloads if no format is specified. For API Extension names of available file formats see <a href=\"https://help.phrase.com/help/supported-platforms-and-formats\">Format Guide</a> or our <a href=\"#formats\">Formats API Endpoint</a>. | [optional] +**shares_translation_memory** | **String** | Indicates whether the project should share the account's translation memory | [optional] +**project_image** | **String** | Image to identify the project | [optional] +**remove_project_image** | **String** | Indicates whether the project image should be deleted. | [optional] +**account_id** | **String** | Account ID to specify the actual account the project should be created in. Required if the requesting user is a member of multiple accounts. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::ProjectUpdate.new(name: My Android Project, + main_format: yml, + shares_translation_memory: true, + project_image: /path/to/my/project-screenshot.png, + remove_project_image: null, + account_id: abcd1234) +``` + + diff --git a/docs/ProjectsApi.md b/docs/ProjectsApi.md new file mode 100644 index 0000000..ffeae17 --- /dev/null +++ b/docs/ProjectsApi.md @@ -0,0 +1,325 @@ +# Phrase::ProjectsApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**project_create**](ProjectsApi.md#project_create) | **POST** /projects | Create a project +[**project_delete**](ProjectsApi.md#project_delete) | **DELETE** /projects/{id} | Delete a project +[**project_show**](ProjectsApi.md#project_show) | **GET** /projects/{id} | Get a single project +[**project_update**](ProjectsApi.md#project_update) | **PATCH** /projects/{id} | Update a project +[**projects_list**](ProjectsApi.md#projects_list) | **GET** /projects | List projects + + + +## project_create + +> project_create(project_create, opts) + +Create a project + +Create a new project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::ProjectsApi.new +project_create = Phrase::ProjectCreate.new # ProjectCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a project + api_instance.project_create(project_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling ProjectsApi->project_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_create** | [**ProjectCreate**](ProjectCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## project_delete + +> project_delete(id, opts) + +Delete a project + +Delete an existing project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::ProjectsApi.new +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete a project + api_instance.project_delete(id, opts) +rescue Phrase::ApiError => e + puts "Exception when calling ProjectsApi->project_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## project_show + +> Project project_show(id, opts) + +Get a single project + +Get details on a single project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::ProjectsApi.new +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single project + result = api_instance.project_show(id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling ProjectsApi->project_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**Project**](Project.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## project_update + +> Object project_update(id, project_update, opts) + +Update a project + +Update an existing project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::ProjectsApi.new +id = 'id_example' # String | ID +project_update = Phrase::ProjectUpdate.new # ProjectUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update a project + result = api_instance.project_update(id, project_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling ProjectsApi->project_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| ID | + **project_update** | [**ProjectUpdate**](ProjectUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## projects_list + +> Array<Project> projects_list(opts) + +List projects + +List all projects the current user has access to. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::ProjectsApi.new +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List projects + result = api_instance.projects_list(opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling ProjectsApi->projects_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<([**Array<Project>**](Project.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/docs/Release.md b/docs/Release.md new file mode 100644 index 0000000..aa97da1 --- /dev/null +++ b/docs/Release.md @@ -0,0 +1,37 @@ +# Phrase::Release + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**version** | **Integer** | | [optional] +**app_min_version** | **String** | | [optional] +**app_max_version** | **String** | | [optional] +**description** | **String** | | [optional] +**platforms** | **Array<String>** | | [optional] +**environments** | **Array<String>** | | [optional] +**locales** | **Array<Object>** | | [optional] +**project** | **Object** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Release.new(id: null, + version: null, + app_min_version: null, + app_max_version: null, + description: null, + platforms: null, + environments: null, + locales: null, + project: null, + created_at: null, + updated_at: null) +``` + + diff --git a/docs/ReleaseCreate.md b/docs/ReleaseCreate.md new file mode 100644 index 0000000..7c4cdc0 --- /dev/null +++ b/docs/ReleaseCreate.md @@ -0,0 +1,21 @@ +# Phrase::ReleaseCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**description** | **String** | Description of the release | [optional] +**platforms** | **String** | List of platforms the release should support. | [optional] +**branch** | **String** | Branch used for release | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::ReleaseCreate.new(description: My first Release, + platforms: ["android","ios"], + branch: my-feature-branch) +``` + + diff --git a/docs/ReleasePreview.md b/docs/ReleasePreview.md new file mode 100644 index 0000000..750a3a0 --- /dev/null +++ b/docs/ReleasePreview.md @@ -0,0 +1,37 @@ +# Phrase::ReleasePreview + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**version** | **Integer** | | [optional] +**app_min_version** | **String** | | [optional] +**app_max_version** | **String** | | [optional] +**description** | **String** | | [optional] +**platforms** | **Array<String>** | | [optional] +**environments** | **Array<String>** | | [optional] +**locale_codes** | **Array<String>** | | [optional] +**project** | **Object** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::ReleasePreview.new(id: null, + version: null, + app_min_version: null, + app_max_version: null, + description: null, + platforms: null, + environments: null, + locale_codes: null, + project: null, + created_at: null, + updated_at: null) +``` + + diff --git a/docs/ReleaseUpdate.md b/docs/ReleaseUpdate.md new file mode 100644 index 0000000..3774973 --- /dev/null +++ b/docs/ReleaseUpdate.md @@ -0,0 +1,21 @@ +# Phrase::ReleaseUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**description** | **String** | Description of the release | [optional] +**platforms** | **String** | List of platforms the release should support. | [optional] +**branch** | **String** | Branch used for release | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::ReleaseUpdate.new(description: My first Release, + platforms: ["android","ios"], + branch: my-feature-branch) +``` + + diff --git a/docs/ReleasesApi.md b/docs/ReleasesApi.md new file mode 100644 index 0000000..abbf631 --- /dev/null +++ b/docs/ReleasesApi.md @@ -0,0 +1,412 @@ +# Phrase::ReleasesApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**release_create**](ReleasesApi.md#release_create) | **POST** /accounts/{account_id}/distributions/{distribution_id}/releases | Create a release +[**release_delete**](ReleasesApi.md#release_delete) | **DELETE** /accounts/{account_id}/distributions/{distribution_id}/releases/{id} | Delete a release +[**release_publish**](ReleasesApi.md#release_publish) | **POST** /accounts/{account_id}/distributions/{distribution_id}/releases/{id}/publish | Publish a release +[**release_show**](ReleasesApi.md#release_show) | **GET** /accounts/{account_id}/distributions/{distribution_id}/releases/{id} | Get a single release +[**release_update**](ReleasesApi.md#release_update) | **PATCH** /accounts/{account_id}/distributions/{distribution_id}/releases/{id} | Update a release +[**releases_list**](ReleasesApi.md#releases_list) | **GET** /accounts/{account_id}/distributions/{distribution_id}/releases | List releases + + + +## release_create + +> release_create(account_id, distribution_id, release_create, opts) + +Create a release + +Create a new release. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::ReleasesApi.new +account_id = 'account_id_example' # String | Account ID +distribution_id = 'distribution_id_example' # String | Distribution ID +release_create = Phrase::ReleaseCreate.new # ReleaseCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a release + api_instance.release_create(account_id, distribution_id, release_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling ReleasesApi->release_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **distribution_id** | **String**| Distribution ID | + **release_create** | [**ReleaseCreate**](ReleaseCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## release_delete + +> release_delete(account_id, distribution_id, id, opts) + +Delete a release + +Delete an existing release. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::ReleasesApi.new +account_id = 'account_id_example' # String | Account ID +distribution_id = 'distribution_id_example' # String | Distribution ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete a release + api_instance.release_delete(account_id, distribution_id, id, opts) +rescue Phrase::ApiError => e + puts "Exception when calling ReleasesApi->release_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **distribution_id** | **String**| Distribution ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## release_publish + +> Object release_publish(account_id, distribution_id, id, opts) + +Publish a release + +Publish a release for production. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::ReleasesApi.new +account_id = 'account_id_example' # String | Account ID +distribution_id = 'distribution_id_example' # String | Distribution ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Publish a release + result = api_instance.release_publish(account_id, distribution_id, id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling ReleasesApi->release_publish: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **distribution_id** | **String**| Distribution ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## release_show + +> Release release_show(account_id, distribution_id, id, opts) + +Get a single release + +Get details on a single release. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::ReleasesApi.new +account_id = 'account_id_example' # String | Account ID +distribution_id = 'distribution_id_example' # String | Distribution ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single release + result = api_instance.release_show(account_id, distribution_id, id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling ReleasesApi->release_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **distribution_id** | **String**| Distribution ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**Release**](Release.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## release_update + +> Object release_update(account_id, distribution_id, id, release_update, opts) + +Update a release + +Update an existing release. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::ReleasesApi.new +account_id = 'account_id_example' # String | Account ID +distribution_id = 'distribution_id_example' # String | Distribution ID +id = 'id_example' # String | ID +release_update = Phrase::ReleaseUpdate.new # ReleaseUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update a release + result = api_instance.release_update(account_id, distribution_id, id, release_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling ReleasesApi->release_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **distribution_id** | **String**| Distribution ID | + **id** | **String**| ID | + **release_update** | [**ReleaseUpdate**](ReleaseUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## releases_list + +> Array<ReleasePreview> releases_list(account_id, distribution_id, opts) + +List releases + +List all releases for the given distribution. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::ReleasesApi.new +account_id = 'account_id_example' # String | Account ID +distribution_id = 'distribution_id_example' # String | Distribution ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List releases + result = api_instance.releases_list(account_id, distribution_id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling ReleasesApi->releases_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **distribution_id** | **String**| Distribution ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<([**Array<ReleasePreview>**](ReleasePreview.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/docs/Screenshot.md b/docs/Screenshot.md new file mode 100644 index 0000000..9a317d1 --- /dev/null +++ b/docs/Screenshot.md @@ -0,0 +1,29 @@ +# Phrase::Screenshot + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**name** | **String** | | [optional] +**description** | **String** | | [optional] +**screenshot_url** | **String** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] +**markers_count** | **Integer** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Screenshot.new(id: null, + name: null, + description: null, + screenshot_url: null, + created_at: null, + updated_at: null, + markers_count: null) +``` + + diff --git a/docs/ScreenshotCreate.md b/docs/ScreenshotCreate.md new file mode 100644 index 0000000..b733b21 --- /dev/null +++ b/docs/ScreenshotCreate.md @@ -0,0 +1,21 @@ +# Phrase::ScreenshotCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Name of the screenshot | [optional] +**description** | **String** | Description of the screenshot | [optional] +**filename** | **String** | Screenshot file | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::ScreenshotCreate.new(name: A screenshot name, + description: A screenshot description, + filename: /path/to/my/screenshot.png) +``` + + diff --git a/docs/ScreenshotMarker.md b/docs/ScreenshotMarker.md new file mode 100644 index 0000000..4c0d9ca --- /dev/null +++ b/docs/ScreenshotMarker.md @@ -0,0 +1,27 @@ +# Phrase::ScreenshotMarker + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**presentation** | **String** | | [optional] +**presentation_type** | **String** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] +**translation_key** | **Object** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::ScreenshotMarker.new(id: null, + presentation: null, + presentation_type: null, + created_at: null, + updated_at: null, + translation_key: null) +``` + + diff --git a/docs/ScreenshotMarkerCreate.md b/docs/ScreenshotMarkerCreate.md new file mode 100644 index 0000000..834d63e --- /dev/null +++ b/docs/ScreenshotMarkerCreate.md @@ -0,0 +1,19 @@ +# Phrase::ScreenshotMarkerCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key_id** | **String** | Specify the Key ID which should be highlighted on the specified screenshot. The Key must belong to the project. | [optional] +**presentation** | **String** | Presentation details of the screenshot marker in JSON format.<br/><br/>Each Screenshot Marker is represented as a rectangular shaped highlight box with the name of the specified Key attached. You can specify the marker position on the screenshot (<code>x</code>-axis and <code>y</code>-axis in pixels) from the top left corner of the screenshot and the dimensions of the marker itself (<code>w</code> and <code>h</code> in pixels). | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::ScreenshotMarkerCreate.new(key_id: abcd1234abcd1234abcd1234abcd1234, + presentation: { "x": 100, "y": 100, "w": 100, "h": 100 }) +``` + + diff --git a/docs/ScreenshotMarkerUpdate.md b/docs/ScreenshotMarkerUpdate.md new file mode 100644 index 0000000..a2eee8b --- /dev/null +++ b/docs/ScreenshotMarkerUpdate.md @@ -0,0 +1,19 @@ +# Phrase::ScreenshotMarkerUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key_id** | **String** | Specify the Key ID which should be highlighted on the specified screenshot. The Key must belong to the project. | [optional] +**presentation** | **String** | Presentation details of the screenshot marker in JSON format.<br/><br/>Each Screenshot Marker is represented as a rectangular shaped highlight box with the name of the specified Key attached. You can specify the marker position on the screenshot (<code>x</code>-axis and <code>y</code>-axis in pixels) from the top left corner of the screenshot and the dimensions of the marker itself (<code>w</code> and <code>h</code> in pixels). | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::ScreenshotMarkerUpdate.new(key_id: abcd1234abcd1234abcd1234abcd1234, + presentation: { "x": 100, "y": 100, "w": 100, "h": 100 }) +``` + + diff --git a/docs/ScreenshotMarkersApi.md b/docs/ScreenshotMarkersApi.md new file mode 100644 index 0000000..8cd4929 --- /dev/null +++ b/docs/ScreenshotMarkersApi.md @@ -0,0 +1,341 @@ +# Phrase::ScreenshotMarkersApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**screenshot_marker_create**](ScreenshotMarkersApi.md#screenshot_marker_create) | **POST** /projects/{project_id}/screenshots/{screenshot_id}/markers | Create a screenshot marker +[**screenshot_marker_delete**](ScreenshotMarkersApi.md#screenshot_marker_delete) | **DELETE** /projects/{project_id}/screenshots/{screenshot_id}/markers | Delete a screenshot marker +[**screenshot_marker_show**](ScreenshotMarkersApi.md#screenshot_marker_show) | **GET** /projects/{project_id}/screenshots/{screenshot_id}/markers/{id} | Get a single screenshot marker +[**screenshot_marker_update**](ScreenshotMarkersApi.md#screenshot_marker_update) | **PATCH** /projects/{project_id}/screenshots/{screenshot_id}/markers | Update a screenshot marker +[**screenshot_markers_list**](ScreenshotMarkersApi.md#screenshot_markers_list) | **GET** /projects/{project_id}/screenshots/{id}/markers | List screenshot markers + + + +## screenshot_marker_create + +> screenshot_marker_create(project_id, screenshot_id, screenshot_marker_create, opts) + +Create a screenshot marker + +Create a new screenshot marker. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::ScreenshotMarkersApi.new +project_id = 'project_id_example' # String | Project ID +screenshot_id = 'screenshot_id_example' # String | Screenshot ID +screenshot_marker_create = Phrase::ScreenshotMarkerCreate.new # ScreenshotMarkerCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a screenshot marker + api_instance.screenshot_marker_create(project_id, screenshot_id, screenshot_marker_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling ScreenshotMarkersApi->screenshot_marker_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **screenshot_id** | **String**| Screenshot ID | + **screenshot_marker_create** | [**ScreenshotMarkerCreate**](ScreenshotMarkerCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## screenshot_marker_delete + +> screenshot_marker_delete(project_id, screenshot_id, opts) + +Delete a screenshot marker + +Delete an existing screenshot marker. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::ScreenshotMarkersApi.new +project_id = 'project_id_example' # String | Project ID +screenshot_id = 'screenshot_id_example' # String | Screenshot ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete a screenshot marker + api_instance.screenshot_marker_delete(project_id, screenshot_id, opts) +rescue Phrase::ApiError => e + puts "Exception when calling ScreenshotMarkersApi->screenshot_marker_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **screenshot_id** | **String**| Screenshot ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## screenshot_marker_show + +> Object screenshot_marker_show(project_id, screenshot_id, id, opts) + +Get a single screenshot marker + +Get details on a single screenshot marker for a given project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::ScreenshotMarkersApi.new +project_id = 'project_id_example' # String | Project ID +screenshot_id = 'screenshot_id_example' # String | Screenshot ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single screenshot marker + result = api_instance.screenshot_marker_show(project_id, screenshot_id, id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling ScreenshotMarkersApi->screenshot_marker_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **screenshot_id** | **String**| Screenshot ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## screenshot_marker_update + +> ScreenshotMarker screenshot_marker_update(project_id, screenshot_id, screenshot_marker_update, opts) + +Update a screenshot marker + +Update an existing screenshot marker. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::ScreenshotMarkersApi.new +project_id = 'project_id_example' # String | Project ID +screenshot_id = 'screenshot_id_example' # String | Screenshot ID +screenshot_marker_update = Phrase::ScreenshotMarkerUpdate.new # ScreenshotMarkerUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update a screenshot marker + result = api_instance.screenshot_marker_update(project_id, screenshot_id, screenshot_marker_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling ScreenshotMarkersApi->screenshot_marker_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **screenshot_id** | **String**| Screenshot ID | + **screenshot_marker_update** | [**ScreenshotMarkerUpdate**](ScreenshotMarkerUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**ScreenshotMarker**](ScreenshotMarker.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## screenshot_markers_list + +> Array<Object> screenshot_markers_list(project_id, id, opts) + +List screenshot markers + +List all screenshot markers for the given project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::ScreenshotMarkersApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List screenshot markers + result = api_instance.screenshot_markers_list(project_id, id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling ScreenshotMarkersApi->screenshot_markers_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<(**Array<Object>**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/docs/ScreenshotUpdate.md b/docs/ScreenshotUpdate.md new file mode 100644 index 0000000..2f4f29d --- /dev/null +++ b/docs/ScreenshotUpdate.md @@ -0,0 +1,21 @@ +# Phrase::ScreenshotUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Name of the screenshot | [optional] +**description** | **String** | Description of the screenshot | [optional] +**filename** | **String** | Screenshot file | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::ScreenshotUpdate.new(name: A screenshot name, + description: A screenshot description, + filename: /path/to/my/screenshot.png) +``` + + diff --git a/docs/ScreenshotsApi.md b/docs/ScreenshotsApi.md new file mode 100644 index 0000000..11d7412 --- /dev/null +++ b/docs/ScreenshotsApi.md @@ -0,0 +1,335 @@ +# Phrase::ScreenshotsApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**screenshot_create**](ScreenshotsApi.md#screenshot_create) | **POST** /projects/{project_id}/screenshots | Create a screenshot +[**screenshot_delete**](ScreenshotsApi.md#screenshot_delete) | **DELETE** /projects/{project_id}/screenshots/{id} | Delete a screenshot +[**screenshot_show**](ScreenshotsApi.md#screenshot_show) | **GET** /projects/{project_id}/screenshots/{id} | Get a single screenshot +[**screenshot_update**](ScreenshotsApi.md#screenshot_update) | **PATCH** /projects/{project_id}/screenshots/{id} | Update a screenshot +[**screenshots_list**](ScreenshotsApi.md#screenshots_list) | **GET** /projects/{project_id}/screenshots | List screenshots + + + +## screenshot_create + +> screenshot_create(project_id, screenshot_create, opts) + +Create a screenshot + +Create a new screenshot. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::ScreenshotsApi.new +project_id = 'project_id_example' # String | Project ID +screenshot_create = Phrase::ScreenshotCreate.new # ScreenshotCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a screenshot + api_instance.screenshot_create(project_id, screenshot_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling ScreenshotsApi->screenshot_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **screenshot_create** | [**ScreenshotCreate**](ScreenshotCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## screenshot_delete + +> screenshot_delete(project_id, id, opts) + +Delete a screenshot + +Delete an existing screenshot. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::ScreenshotsApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete a screenshot + api_instance.screenshot_delete(project_id, id, opts) +rescue Phrase::ApiError => e + puts "Exception when calling ScreenshotsApi->screenshot_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## screenshot_show + +> Screenshot screenshot_show(project_id, id, opts) + +Get a single screenshot + +Get details on a single screenshot for a given project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::ScreenshotsApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single screenshot + result = api_instance.screenshot_show(project_id, id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling ScreenshotsApi->screenshot_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**Screenshot**](Screenshot.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## screenshot_update + +> Object screenshot_update(project_id, id, screenshot_update, opts) + +Update a screenshot + +Update an existing screenshot. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::ScreenshotsApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +screenshot_update = Phrase::ScreenshotUpdate.new # ScreenshotUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update a screenshot + result = api_instance.screenshot_update(project_id, id, screenshot_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling ScreenshotsApi->screenshot_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **screenshot_update** | [**ScreenshotUpdate**](ScreenshotUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## screenshots_list + +> Array<Object> screenshots_list(project_id, opts) + +List screenshots + +List all screenshots for the given project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::ScreenshotsApi.new +project_id = 'project_id_example' # String | Project ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List screenshots + result = api_instance.screenshots_list(project_id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling ScreenshotsApi->screenshots_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<(**Array<Object>**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/docs/Space.md b/docs/Space.md new file mode 100644 index 0000000..cd7f247 --- /dev/null +++ b/docs/Space.md @@ -0,0 +1,27 @@ +# Phrase::Space + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**name** | **String** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] +**projects_count** | **Integer** | | [optional] +**projects** | [**Array<Project>**](Project.md) | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Space.new(id: null, + name: null, + created_at: null, + updated_at: null, + projects_count: null, + projects: null) +``` + + diff --git a/docs/SpaceCreate.md b/docs/SpaceCreate.md new file mode 100644 index 0000000..05beccf --- /dev/null +++ b/docs/SpaceCreate.md @@ -0,0 +1,17 @@ +# Phrase::SpaceCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Name of the space | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::SpaceCreate.new(name: My Android Projects) +``` + + diff --git a/docs/SpaceUpdate.md b/docs/SpaceUpdate.md new file mode 100644 index 0000000..9b1e626 --- /dev/null +++ b/docs/SpaceUpdate.md @@ -0,0 +1,17 @@ +# Phrase::SpaceUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | New name of the space | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::SpaceUpdate.new(name: My Android Projects) +``` + + diff --git a/docs/SpacesApi.md b/docs/SpacesApi.md new file mode 100644 index 0000000..94df187 --- /dev/null +++ b/docs/SpacesApi.md @@ -0,0 +1,536 @@ +# Phrase::SpacesApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**space_create**](SpacesApi.md#space_create) | **POST** /accounts/{account_id}/spaces | Create a Space +[**space_delete**](SpacesApi.md#space_delete) | **DELETE** /accounts/{account_id}/spaces/{id} | Delete Space +[**space_show**](SpacesApi.md#space_show) | **GET** /accounts/{account_id}/spaces/{id} | Get Space +[**space_update**](SpacesApi.md#space_update) | **PATCH** /accounts/{account_id}/spaces/{id} | Update Space +[**spaces_list**](SpacesApi.md#spaces_list) | **GET** /accounts/{account_id}/spaces | List Spaces +[**spaces_projects_create**](SpacesApi.md#spaces_projects_create) | **POST** /accounts/{account_id}/spaces/{space_id}/projects | Add Project +[**spaces_projects_delete**](SpacesApi.md#spaces_projects_delete) | **DELETE** /accounts/{account_id}/spaces/{space_id}/projects/{id} | Remove Project +[**spaces_projects_list**](SpacesApi.md#spaces_projects_list) | **GET** /accounts/{account_id}/spaces/{space_id}/projects | List Projects + + + +## space_create + +> space_create(account_id, space_create, opts) + +Create a Space + +Create a new Space. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::SpacesApi.new +account_id = 'account_id_example' # String | Account ID +space_create = Phrase::SpaceCreate.new # SpaceCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a Space + api_instance.space_create(account_id, space_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling SpacesApi->space_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **space_create** | [**SpaceCreate**](SpaceCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## space_delete + +> space_delete(account_id, id, opts) + +Delete Space + +Delete the specified Space. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::SpacesApi.new +account_id = 'account_id_example' # String | Account ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete Space + api_instance.space_delete(account_id, id, opts) +rescue Phrase::ApiError => e + puts "Exception when calling SpacesApi->space_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## space_show + +> Space space_show(account_id, id, opts) + +Get Space + +Show the specified Space. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::SpacesApi.new +account_id = 'account_id_example' # String | Account ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get Space + result = api_instance.space_show(account_id, id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling SpacesApi->space_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**Space**](Space.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## space_update + +> Space space_update(account_id, id, space_update, opts) + +Update Space + +Update the specified Space. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::SpacesApi.new +account_id = 'account_id_example' # String | Account ID +id = 'id_example' # String | ID +space_update = Phrase::SpaceUpdate.new # SpaceUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update Space + result = api_instance.space_update(account_id, id, space_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling SpacesApi->space_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **id** | **String**| ID | + **space_update** | [**SpaceUpdate**](SpaceUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**Space**](Space.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## spaces_list + +> Array<Space> spaces_list(account_id, opts) + +List Spaces + +List all Spaces for the given account. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::SpacesApi.new +account_id = 'account_id_example' # String | Account ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List Spaces + result = api_instance.spaces_list(account_id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling SpacesApi->spaces_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<([**Array<Space>**](Space.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## spaces_projects_create + +> spaces_projects_create(account_id, space_id, spaces_projects_create, opts) + +Add Project + +Adds an existing project to the space. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::SpacesApi.new +account_id = 'account_id_example' # String | Account ID +space_id = 'space_id_example' # String | Space ID +spaces_projects_create = Phrase::SpacesProjectsCreate.new # SpacesProjectsCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Add Project + api_instance.spaces_projects_create(account_id, space_id, spaces_projects_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling SpacesApi->spaces_projects_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **space_id** | **String**| Space ID | + **spaces_projects_create** | [**SpacesProjectsCreate**](SpacesProjectsCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## spaces_projects_delete + +> spaces_projects_delete(account_id, space_id, id, opts) + +Remove Project + +Removes a specified project from the specified space. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::SpacesApi.new +account_id = 'account_id_example' # String | Account ID +space_id = 'space_id_example' # String | Space ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Remove Project + api_instance.spaces_projects_delete(account_id, space_id, id, opts) +rescue Phrase::ApiError => e + puts "Exception when calling SpacesApi->spaces_projects_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **space_id** | **String**| Space ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## spaces_projects_list + +> Array<Project> spaces_projects_list(account_id, space_id, opts) + +List Projects + +List all projects for the specified Space. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::SpacesApi.new +account_id = 'account_id_example' # String | Account ID +space_id = 'space_id_example' # String | Space ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List Projects + result = api_instance.spaces_projects_list(account_id, space_id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling SpacesApi->spaces_projects_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **space_id** | **String**| Space ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<([**Array<Project>**](Project.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/docs/SpacesProjectsCreate.md b/docs/SpacesProjectsCreate.md new file mode 100644 index 0000000..36a54f8 --- /dev/null +++ b/docs/SpacesProjectsCreate.md @@ -0,0 +1,17 @@ +# Phrase::SpacesProjectsCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | Project ID to add or to the Space | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::SpacesProjectsCreate.new(id: a4b3c2d1) +``` + + diff --git a/docs/StyleGuidesApi.md b/docs/StyleGuidesApi.md new file mode 100644 index 0000000..36db2ba --- /dev/null +++ b/docs/StyleGuidesApi.md @@ -0,0 +1,335 @@ +# Phrase::StyleGuidesApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**styleguide_create**](StyleGuidesApi.md#styleguide_create) | **POST** /projects/{project_id}/styleguides | Create a style guide +[**styleguide_delete**](StyleGuidesApi.md#styleguide_delete) | **DELETE** /projects/{project_id}/styleguides/{id} | Delete a style guide +[**styleguide_show**](StyleGuidesApi.md#styleguide_show) | **GET** /projects/{project_id}/styleguides/{id} | Get a single style guide +[**styleguide_update**](StyleGuidesApi.md#styleguide_update) | **PATCH** /projects/{project_id}/styleguides/{id} | Update a style guide +[**styleguides_list**](StyleGuidesApi.md#styleguides_list) | **GET** /projects/{project_id}/styleguides | List style guides + + + +## styleguide_create + +> styleguide_create(project_id, styleguide_create, opts) + +Create a style guide + +Create a new style guide. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::StyleGuidesApi.new +project_id = 'project_id_example' # String | Project ID +styleguide_create = Phrase::StyleguideCreate.new # StyleguideCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a style guide + api_instance.styleguide_create(project_id, styleguide_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling StyleGuidesApi->styleguide_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **styleguide_create** | [**StyleguideCreate**](StyleguideCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## styleguide_delete + +> styleguide_delete(project_id, id, opts) + +Delete a style guide + +Delete an existing style guide. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::StyleGuidesApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete a style guide + api_instance.styleguide_delete(project_id, id, opts) +rescue Phrase::ApiError => e + puts "Exception when calling StyleGuidesApi->styleguide_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## styleguide_show + +> Object styleguide_show(project_id, id, opts) + +Get a single style guide + +Get details on a single style guide. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::StyleGuidesApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single style guide + result = api_instance.styleguide_show(project_id, id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling StyleGuidesApi->styleguide_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## styleguide_update + +> Object styleguide_update(project_id, id, styleguide_update, opts) + +Update a style guide + +Update an existing style guide. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::StyleGuidesApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +styleguide_update = Phrase::StyleguideUpdate.new # StyleguideUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update a style guide + result = api_instance.styleguide_update(project_id, id, styleguide_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling StyleGuidesApi->styleguide_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **styleguide_update** | [**StyleguideUpdate**](StyleguideUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## styleguides_list + +> Array<Styleguide> styleguides_list(project_id, opts) + +List style guides + +List all styleguides for the given project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::StyleGuidesApi.new +project_id = 'project_id_example' # String | Project ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List style guides + result = api_instance.styleguides_list(project_id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling StyleGuidesApi->styleguides_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<([**Array<Styleguide>**](Styleguide.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/docs/Styleguide.md b/docs/Styleguide.md new file mode 100644 index 0000000..78a3f72 --- /dev/null +++ b/docs/Styleguide.md @@ -0,0 +1,23 @@ +# Phrase::Styleguide + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**title** | **String** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Styleguide.new(id: null, + title: null, + created_at: null, + updated_at: null) +``` + + diff --git a/docs/StyleguideCreate.md b/docs/StyleguideCreate.md new file mode 100644 index 0000000..6461a76 --- /dev/null +++ b/docs/StyleguideCreate.md @@ -0,0 +1,41 @@ +# Phrase::StyleguideCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **String** | Style guide title | [optional] +**audience** | **String** | Audience description | [optional] +**target_audience** | **String** | Can be one of: not_specified, children, teenager, young_adults, adults, old_adults. | [optional] +**grammatical_person** | **String** | Can be one of: not_specified, first_person_singular, second_person_singular, third_person_singular_masculine, third_person_singular_feminine, third_person_singular_neuter, first_person_plural, second_person_plural, third_person_plural. | [optional] +**vocabulary_type** | **String** | Can be one of: not_specified, popular, technical, fictional. | [optional] +**business** | **String** | Description of the business | [optional] +**company_branding** | **String** | Company branding to remain consistent. | [optional] +**formatting** | **String** | Formatting requirements and character limitations. | [optional] +**glossary_terms** | **String** | List of terms and/or phrases that need to be translated consistently. | [optional] +**grammar_consistency** | **String** | Formal or informal pronouns, consistent conjugation, grammatical gender | [optional] +**literal_translation** | **String** | Can be one of: Cultural/Conversational, Literal, Neutral. | [optional] +**overall_tone** | **String** | Tone requirement descriptions | [optional] +**samples** | **String** | Provide links to sample product pages, FAQ pages, etc. to give the translator a point of reference. You can also provide past translations. Even snippets or short paragraphs are helpful for maintaining consistency. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::StyleguideCreate.new(title: Web application style guide, + audience: customer-facing, + target_audience: teenager, + grammatical_person: first_person_singular, + vocabulary_type: technical, + business: We are a travel site that helps customers find the best hotels and flights., + company_branding: ACME Inc. should never be translated., + formatting: Never use capital letters, + glossary_terms: Appartement, cabin, loft, + grammar_consistency: null, + literal_translation: Neutral, + overall_tone: Tone should be fun and light, + samples: http://www.myexample.com/my/document/path/to/samples.pdf) +``` + + diff --git a/docs/StyleguidePreview.md b/docs/StyleguidePreview.md new file mode 100644 index 0000000..2c5e08d --- /dev/null +++ b/docs/StyleguidePreview.md @@ -0,0 +1,19 @@ +# Phrase::StyleguidePreview + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**title** | **String** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::StyleguidePreview.new(id: null, + title: null) +``` + + diff --git a/docs/StyleguideUpdate.md b/docs/StyleguideUpdate.md new file mode 100644 index 0000000..99d6595 --- /dev/null +++ b/docs/StyleguideUpdate.md @@ -0,0 +1,41 @@ +# Phrase::StyleguideUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **String** | Style guide title | [optional] +**audience** | **String** | Audience description | [optional] +**target_audience** | **String** | Can be one of: not_specified, children, teenager, young_adults, adults, old_adults. | [optional] +**grammatical_person** | **String** | Can be one of: not_specified, first_person_singular, second_person_singular, third_person_singular_masculine, third_person_singular_feminine, third_person_singular_neuter, first_person_plural, second_person_plural, third_person_plural. | [optional] +**vocabulary_type** | **String** | Can be one of: not_specified, popular, technical, fictional. | [optional] +**business** | **String** | Description of the business | [optional] +**company_branding** | **String** | Company branding to remain consistent. | [optional] +**formatting** | **String** | Formatting requirements and character limitations. | [optional] +**glossary_terms** | **String** | List of terms and/or phrases that need to be translated consistently. | [optional] +**grammar_consistency** | **String** | Formal or informal pronouns, consistent conjugation, grammatical gender | [optional] +**literal_translation** | **String** | Can be one of: Cultural/Conversational, Literal, Neutral. | [optional] +**overall_tone** | **String** | Tone requirement descriptions | [optional] +**samples** | **String** | Provide links to sample product pages, FAQ pages, etc. to give the translator a point of reference. You can also provide past translations. Even snippets or short paragraphs are helpful for maintaining consistency. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::StyleguideUpdate.new(title: Web application style guide, + audience: customer-facing, + target_audience: teenager, + grammatical_person: first_person_singular, + vocabulary_type: technical, + business: We are a travel site that helps customers find the best hotels and flights., + company_branding: ACME Inc. should never be translated., + formatting: Never use capital letters, + glossary_terms: Appartement, cabin, loft, + grammar_consistency: null, + literal_translation: Neutral, + overall_tone: Tone should be fun and light, + samples: http://www.myexample.com/my/document/path/to/samples.pdf) +``` + + diff --git a/docs/Tag.md b/docs/Tag.md new file mode 100644 index 0000000..9806bdd --- /dev/null +++ b/docs/Tag.md @@ -0,0 +1,23 @@ +# Phrase::Tag + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | [optional] +**keys_count** | **Integer** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Tag.new(name: null, + keys_count: null, + created_at: null, + updated_at: null) +``` + + diff --git a/docs/TagCreate.md b/docs/TagCreate.md new file mode 100644 index 0000000..cf1a20d --- /dev/null +++ b/docs/TagCreate.md @@ -0,0 +1,19 @@ +# Phrase::TagCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**name** | **String** | Name of the tag | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TagCreate.new(branch: my-feature-branch, + name: my-feature) +``` + + diff --git a/docs/TagDelete.md b/docs/TagDelete.md new file mode 100644 index 0000000..8b5bdef --- /dev/null +++ b/docs/TagDelete.md @@ -0,0 +1,17 @@ +# Phrase::TagDelete + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TagDelete.new(branch: my-feature-branch) +``` + + diff --git a/docs/TagShow.md b/docs/TagShow.md new file mode 100644 index 0000000..3355644 --- /dev/null +++ b/docs/TagShow.md @@ -0,0 +1,17 @@ +# Phrase::TagShow + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TagShow.new(branch: my-feature-branch) +``` + + diff --git a/docs/TagsApi.md b/docs/TagsApi.md new file mode 100644 index 0000000..403970f --- /dev/null +++ b/docs/TagsApi.md @@ -0,0 +1,274 @@ +# Phrase::TagsApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**tag_create**](TagsApi.md#tag_create) | **POST** /projects/{project_id}/tags | Create a tag +[**tag_delete**](TagsApi.md#tag_delete) | **DELETE** /projects/{project_id}/tags/{name} | Delete a tag +[**tag_show**](TagsApi.md#tag_show) | **GET** /projects/{project_id}/tags/{name} | Get a single tag +[**tags_list**](TagsApi.md#tags_list) | **GET** /projects/{project_id}/tags | List tags + + + +## tag_create + +> tag_create(project_id, tag_create, opts) + +Create a tag + +Create a new tag. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::TagsApi.new +project_id = 'project_id_example' # String | Project ID +tag_create = Phrase::TagCreate.new # TagCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a tag + api_instance.tag_create(project_id, tag_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling TagsApi->tag_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **tag_create** | [**TagCreate**](TagCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## tag_delete + +> tag_delete(project_id, name, tag_delete, opts) + +Delete a tag + +Delete an existing tag. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::TagsApi.new +project_id = 'project_id_example' # String | Project ID +name = 'name_example' # String | name +tag_delete = Phrase::TagDelete.new # TagDelete | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete a tag + api_instance.tag_delete(project_id, name, tag_delete, opts) +rescue Phrase::ApiError => e + puts "Exception when calling TagsApi->tag_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **name** | **String**| name | + **tag_delete** | [**TagDelete**](TagDelete.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## tag_show + +> Object tag_show(project_id, name, tag_show, opts) + +Get a single tag + +Get details and progress information on a single tag for a given project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::TagsApi.new +project_id = 'project_id_example' # String | Project ID +name = 'name_example' # String | name +tag_show = Phrase::TagShow.new # TagShow | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single tag + result = api_instance.tag_show(project_id, name, tag_show, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling TagsApi->tag_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **name** | **String**| name | + **tag_show** | [**TagShow**](TagShow.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## tags_list + +> Array<Tag> tags_list(project_id, tags_list, opts) + +List tags + +List all tags for the given project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::TagsApi.new +project_id = 'project_id_example' # String | Project ID +tags_list = Phrase::TagsList.new # TagsList | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List tags + result = api_instance.tags_list(project_id, tags_list, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling TagsApi->tags_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **tags_list** | [**TagsList**](TagsList.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<([**Array<Tag>**](Tag.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/docs/TagsList.md b/docs/TagsList.md new file mode 100644 index 0000000..7e46b3e --- /dev/null +++ b/docs/TagsList.md @@ -0,0 +1,17 @@ +# Phrase::TagsList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TagsList.new(branch: my-feature-branch) +``` + + diff --git a/docs/Translation.md b/docs/Translation.md new file mode 100644 index 0000000..d3bf0c5 --- /dev/null +++ b/docs/Translation.md @@ -0,0 +1,37 @@ +# Phrase::Translation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**content** | **String** | | [optional] +**unverified** | **Boolean** | | [optional] +**excluded** | **Boolean** | | [optional] +**plural_suffix** | **String** | | [optional] +**key** | [**KeyPreview**](KeyPreview.md) | | [optional] +**locale** | **Object** | | [optional] +**placeholders** | **Array<String>** | | [optional] +**state** | **String** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Translation.new(id: null, + content: null, + unverified: null, + excluded: null, + plural_suffix: null, + key: null, + locale: null, + placeholders: null, + state: null, + created_at: null, + updated_at: null) +``` + + diff --git a/docs/TranslationCreate.md b/docs/TranslationCreate.md new file mode 100644 index 0000000..842c50c --- /dev/null +++ b/docs/TranslationCreate.md @@ -0,0 +1,31 @@ +# Phrase::TranslationCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**locale_id** | **String** | Locale. Can be the name or public id of the locale. Preferred is the public id. | [optional] +**key_id** | **String** | Key | [optional] +**content** | **String** | Translation content | [optional] +**plural_suffix** | **String** | Plural suffix. Can be one of: zero, one, two, few, many, other. Must be specified if the key associated to the translation is pluralized. | [optional] +**unverified** | **String** | Indicates whether translation is unverified. Part of the <a href=\"https://help.phrase.com/help/verification-and-proofreading\" target=\"_blank\">Advanced Workflows</a> feature. | [optional] +**excluded** | **String** | Indicates whether translation is excluded. | [optional] +**autotranslate** | **String** | Indicates whether the translation should be auto-translated. Responses with status 422 if provided for translation within a non-default locale or the project does not have the Autopilot feature enabled. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TranslationCreate.new(branch: my-feature-branch, + locale_id: abcd1234cdef1234abcd1234cdef1234, + key_id: abcd1234cdef1234abcd1234cdef1234, + content: My translation, + plural_suffix: null, + unverified: null, + excluded: null, + autotranslate: null) +``` + + diff --git a/docs/TranslationExclude.md b/docs/TranslationExclude.md new file mode 100644 index 0000000..8a41854 --- /dev/null +++ b/docs/TranslationExclude.md @@ -0,0 +1,17 @@ +# Phrase::TranslationExclude + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TranslationExclude.new(branch: my-feature-branch) +``` + + diff --git a/docs/TranslationInclude.md b/docs/TranslationInclude.md new file mode 100644 index 0000000..48b7422 --- /dev/null +++ b/docs/TranslationInclude.md @@ -0,0 +1,17 @@ +# Phrase::TranslationInclude + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TranslationInclude.new(branch: my-feature-branch) +``` + + diff --git a/docs/TranslationKey.md b/docs/TranslationKey.md new file mode 100644 index 0000000..fe00795 --- /dev/null +++ b/docs/TranslationKey.md @@ -0,0 +1,33 @@ +# Phrase::TranslationKey + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**name** | **String** | | [optional] +**description** | **String** | | [optional] +**name_hash** | **String** | | [optional] +**plural** | **Boolean** | | [optional] +**tags** | **Array<String>** | | [optional] +**data_type** | **String** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TranslationKey.new(id: null, + name: null, + description: null, + name_hash: null, + plural: null, + tags: null, + data_type: null, + created_at: null, + updated_at: null) +``` + + diff --git a/docs/TranslationOrder.md b/docs/TranslationOrder.md new file mode 100644 index 0000000..30dd7d8 --- /dev/null +++ b/docs/TranslationOrder.md @@ -0,0 +1,49 @@ +# Phrase::TranslationOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**lsp** | **String** | | [optional] +**amount_in_cents** | **Integer** | | [optional] +**currency** | **String** | | [optional] +**message** | **String** | | [optional] +**state** | **String** | | [optional] +**translation_type** | **String** | | [optional] +**progress_percent** | **Integer** | | [optional] +**source_locale** | [**LocalePreview**](LocalePreview.md) | | [optional] +**target_locales** | **Array<Object>** | | [optional] +**tag** | **String** | | [optional] +**styleguide** | [**StyleguidePreview**](StyleguidePreview.md) | | [optional] +**unverify_translations_upon_delivery** | **Boolean** | | [optional] +**quality** | **Boolean** | | [optional] +**priority** | **Boolean** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TranslationOrder.new(id: null, + lsp: null, + amount_in_cents: null, + currency: null, + message: null, + state: null, + translation_type: null, + progress_percent: null, + source_locale: null, + target_locales: null, + tag: null, + styleguide: null, + unverify_translations_upon_delivery: null, + quality: null, + priority: null, + created_at: null, + updated_at: null) +``` + + diff --git a/docs/TranslationReview.md b/docs/TranslationReview.md new file mode 100644 index 0000000..2dbc1cf --- /dev/null +++ b/docs/TranslationReview.md @@ -0,0 +1,17 @@ +# Phrase::TranslationReview + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TranslationReview.new(branch: my-feature-branch) +``` + + diff --git a/docs/TranslationShow.md b/docs/TranslationShow.md new file mode 100644 index 0000000..4002936 --- /dev/null +++ b/docs/TranslationShow.md @@ -0,0 +1,17 @@ +# Phrase::TranslationShow + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TranslationShow.new(branch: my-feature-branch) +``` + + diff --git a/docs/TranslationUnverify.md b/docs/TranslationUnverify.md new file mode 100644 index 0000000..53efba3 --- /dev/null +++ b/docs/TranslationUnverify.md @@ -0,0 +1,17 @@ +# Phrase::TranslationUnverify + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TranslationUnverify.new(branch: my-feature-branch) +``` + + diff --git a/docs/TranslationUpdate.md b/docs/TranslationUpdate.md new file mode 100644 index 0000000..2db7fcb --- /dev/null +++ b/docs/TranslationUpdate.md @@ -0,0 +1,27 @@ +# Phrase::TranslationUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**content** | **String** | Translation content | [optional] +**plural_suffix** | **String** | Plural suffix. Can be one of: zero, one, two, few, many, other. Must be specified if the key associated to the translation is pluralized. | [optional] +**unverified** | **String** | Indicates whether translation is unverified. Part of the <a href=\"https://help.phrase.com/help/verification-and-proofreading\" target=\"_blank\">Advanced Workflows</a> feature. | [optional] +**excluded** | **String** | Indicates whether translation is excluded. | [optional] +**autotranslate** | **String** | Indicates whether the translation should be auto-translated. Responses with status 422 if provided for translation within a non-default locale or the project does not have the Autopilot feature enabled. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TranslationUpdate.new(branch: my-feature-branch, + content: My translation, + plural_suffix: null, + unverified: null, + excluded: null, + autotranslate: null) +``` + + diff --git a/docs/TranslationVerify.md b/docs/TranslationVerify.md new file mode 100644 index 0000000..c47e7aa --- /dev/null +++ b/docs/TranslationVerify.md @@ -0,0 +1,17 @@ +# Phrase::TranslationVerify + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TranslationVerify.new(branch: my-feature-branch) +``` + + diff --git a/docs/TranslationVersion.md b/docs/TranslationVersion.md new file mode 100644 index 0000000..7f4c4e0 --- /dev/null +++ b/docs/TranslationVersion.md @@ -0,0 +1,31 @@ +# Phrase::TranslationVersion + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**content** | **String** | | [optional] +**plural_suffix** | **String** | | [optional] +**key** | **Object** | | [optional] +**locale** | **Object** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] +**changed_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TranslationVersion.new(id: null, + content: null, + plural_suffix: null, + key: null, + locale: null, + created_at: null, + updated_at: null, + changed_at: null) +``` + + diff --git a/docs/TranslationsApi.md b/docs/TranslationsApi.md new file mode 100644 index 0000000..a3479de --- /dev/null +++ b/docs/TranslationsApi.md @@ -0,0 +1,1146 @@ +# Phrase::TranslationsApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**translation_create**](TranslationsApi.md#translation_create) | **POST** /projects/{project_id}/translations | Create a translation +[**translation_exclude**](TranslationsApi.md#translation_exclude) | **PATCH** /projects/{project_id}/translations/{id}/exclude | Exclude a translation from export +[**translation_include**](TranslationsApi.md#translation_include) | **PATCH** /projects/{project_id}/translations/{id}/include | Revoke exclusion of a translation in export +[**translation_review**](TranslationsApi.md#translation_review) | **PATCH** /projects/{project_id}/translations/{id}/review | Review a translation +[**translation_show**](TranslationsApi.md#translation_show) | **GET** /projects/{project_id}/translations/{id} | Get a single translation +[**translation_unverify**](TranslationsApi.md#translation_unverify) | **PATCH** /projects/{project_id}/translations/{id}/unverify | Mark a translation as unverified +[**translation_update**](TranslationsApi.md#translation_update) | **PATCH** /projects/{project_id}/translations/{id} | Update a translation +[**translation_verify**](TranslationsApi.md#translation_verify) | **PATCH** /projects/{project_id}/translations/{id}/verify | Verify a translation +[**translations_by_key**](TranslationsApi.md#translations_by_key) | **GET** /projects/{project_id}/keys/{key_id}/translations | List translations by key +[**translations_by_locale**](TranslationsApi.md#translations_by_locale) | **GET** /projects/{project_id}/locales/{locale_id}/translations | List translations by locale +[**translations_exclude**](TranslationsApi.md#translations_exclude) | **PATCH** /projects/{project_id}/translations/exclude | Set exclude from export flag on translations selected by query +[**translations_include**](TranslationsApi.md#translations_include) | **PATCH** /projects/{project_id}/translations/include | Remove exlude from import flag from translations selected by query +[**translations_list**](TranslationsApi.md#translations_list) | **GET** /projects/{project_id}/translations | List all translations +[**translations_review**](TranslationsApi.md#translations_review) | **PATCH** /projects/{project_id}/translations/review | Review translations selected by query +[**translations_search**](TranslationsApi.md#translations_search) | **POST** /projects/{project_id}/translations/search | Search translations +[**translations_unverify**](TranslationsApi.md#translations_unverify) | **PATCH** /projects/{project_id}/translations/unverify | Mark translations selected by query as unverified +[**translations_verify**](TranslationsApi.md#translations_verify) | **PATCH** /projects/{project_id}/translations/verify | Verify translations selected by query + + + +## translation_create + +> translation_create(project_id, translation_create, opts) + +Create a translation + +Create a translation. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::TranslationsApi.new +project_id = 'project_id_example' # String | Project ID +translation_create = Phrase::TranslationCreate.new # TranslationCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a translation + api_instance.translation_create(project_id, translation_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling TranslationsApi->translation_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **translation_create** | [**TranslationCreate**](TranslationCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## translation_exclude + +> Object translation_exclude(project_id, id, translation_exclude, opts) + +Exclude a translation from export + +Set exclude from export flag on an existing translation. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::TranslationsApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +translation_exclude = Phrase::TranslationExclude.new # TranslationExclude | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Exclude a translation from export + result = api_instance.translation_exclude(project_id, id, translation_exclude, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling TranslationsApi->translation_exclude: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **translation_exclude** | [**TranslationExclude**](TranslationExclude.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## translation_include + +> Object translation_include(project_id, id, translation_include, opts) + +Revoke exclusion of a translation in export + +Remove exclude from export flag from an existing translation. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::TranslationsApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +translation_include = Phrase::TranslationInclude.new # TranslationInclude | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Revoke exclusion of a translation in export + result = api_instance.translation_include(project_id, id, translation_include, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling TranslationsApi->translation_include: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **translation_include** | [**TranslationInclude**](TranslationInclude.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## translation_review + +> Object translation_review(project_id, id, translation_review, opts) + +Review a translation + +Mark an existing translation as reviewed. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::TranslationsApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +translation_review = Phrase::TranslationReview.new # TranslationReview | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Review a translation + result = api_instance.translation_review(project_id, id, translation_review, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling TranslationsApi->translation_review: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **translation_review** | [**TranslationReview**](TranslationReview.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## translation_show + +> Object translation_show(project_id, id, translation_show, opts) + +Get a single translation + +Get details on a single translation. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::TranslationsApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +translation_show = Phrase::TranslationShow.new # TranslationShow | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single translation + result = api_instance.translation_show(project_id, id, translation_show, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling TranslationsApi->translation_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **translation_show** | [**TranslationShow**](TranslationShow.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## translation_unverify + +> Object translation_unverify(project_id, id, translation_unverify, opts) + +Mark a translation as unverified + +Mark an existing translation as unverified. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::TranslationsApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +translation_unverify = Phrase::TranslationUnverify.new # TranslationUnverify | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Mark a translation as unverified + result = api_instance.translation_unverify(project_id, id, translation_unverify, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling TranslationsApi->translation_unverify: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **translation_unverify** | [**TranslationUnverify**](TranslationUnverify.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## translation_update + +> Object translation_update(project_id, id, translation_update, opts) + +Update a translation + +Update an existing translation. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::TranslationsApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +translation_update = Phrase::TranslationUpdate.new # TranslationUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update a translation + result = api_instance.translation_update(project_id, id, translation_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling TranslationsApi->translation_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **translation_update** | [**TranslationUpdate**](TranslationUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## translation_verify + +> Object translation_verify(project_id, id, translation_verify, opts) + +Verify a translation + +Verify an existing translation. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::TranslationsApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +translation_verify = Phrase::TranslationVerify.new # TranslationVerify | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Verify a translation + result = api_instance.translation_verify(project_id, id, translation_verify, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling TranslationsApi->translation_verify: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **translation_verify** | [**TranslationVerify**](TranslationVerify.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## translations_by_key + +> Array<Object> translations_by_key(project_id, key_id, translations_by_key, opts) + +List translations by key + +List translations for a specific key. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::TranslationsApi.new +project_id = 'project_id_example' # String | Project ID +key_id = 'key_id_example' # String | Translation Key ID +translations_by_key = Phrase::TranslationsByKey.new # TranslationsByKey | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List translations by key + result = api_instance.translations_by_key(project_id, key_id, translations_by_key, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling TranslationsApi->translations_by_key: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **key_id** | **String**| Translation Key ID | + **translations_by_key** | [**TranslationsByKey**](TranslationsByKey.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<(**Array<Object>**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## translations_by_locale + +> Array<Object> translations_by_locale(project_id, locale_id, translations_by_locale, opts) + +List translations by locale + +List translations for a specific locale. If you want to download all translations for one locale we recommend to use the locales#download endpoint. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::TranslationsApi.new +project_id = 'project_id_example' # String | Project ID +locale_id = 'locale_id_example' # String | Locale ID +translations_by_locale = Phrase::TranslationsByLocale.new # TranslationsByLocale | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List translations by locale + result = api_instance.translations_by_locale(project_id, locale_id, translations_by_locale, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling TranslationsApi->translations_by_locale: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **locale_id** | **String**| Locale ID | + **translations_by_locale** | [**TranslationsByLocale**](TranslationsByLocale.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<(**Array<Object>**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## translations_exclude + +> Object translations_exclude(project_id, translations_exclude, opts) + +Set exclude from export flag on translations selected by query + +Exclude translations matching query from locale export. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::TranslationsApi.new +project_id = 'project_id_example' # String | Project ID +translations_exclude = Phrase::TranslationsExclude.new # TranslationsExclude | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Set exclude from export flag on translations selected by query + result = api_instance.translations_exclude(project_id, translations_exclude, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling TranslationsApi->translations_exclude: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **translations_exclude** | [**TranslationsExclude**](TranslationsExclude.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## translations_include + +> Object translations_include(project_id, translations_include, opts) + +Remove exlude from import flag from translations selected by query + +Include translations matching query in locale export. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::TranslationsApi.new +project_id = 'project_id_example' # String | Project ID +translations_include = Phrase::TranslationsInclude.new # TranslationsInclude | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Remove exlude from import flag from translations selected by query + result = api_instance.translations_include(project_id, translations_include, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling TranslationsApi->translations_include: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **translations_include** | [**TranslationsInclude**](TranslationsInclude.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## translations_list + +> Array<Translation> translations_list(project_id, translations_list, opts) + +List all translations + +List translations for the given project. If you want to download all translations for one locale we recommend to use the locales#download endpoint. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::TranslationsApi.new +project_id = 'project_id_example' # String | Project ID +translations_list = Phrase::TranslationsList.new # TranslationsList | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List all translations + result = api_instance.translations_list(project_id, translations_list, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling TranslationsApi->translations_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **translations_list** | [**TranslationsList**](TranslationsList.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<([**Array<Translation>**](Translation.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## translations_review + +> Object translations_review(project_id, translations_review, opts) + +Review translations selected by query + +Review translations matching query. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::TranslationsApi.new +project_id = 'project_id_example' # String | Project ID +translations_review = Phrase::TranslationsReview.new # TranslationsReview | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Review translations selected by query + result = api_instance.translations_review(project_id, translations_review, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling TranslationsApi->translations_review: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **translations_review** | [**TranslationsReview**](TranslationsReview.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## translations_search + +> Array<Object> translations_search(project_id, translations_search, opts) + +Search translations + +Search translations for the given project. Provides the same search interface as translations#index but allows POST requests to avoid limitations imposed by GET requests. If you want to download all translations for one locale we recommend to use the locales#download endpoint. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::TranslationsApi.new +project_id = 'project_id_example' # String | Project ID +translations_search = Phrase::TranslationsSearch.new # TranslationsSearch | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #Search translations + result = api_instance.translations_search(project_id, translations_search, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling TranslationsApi->translations_search: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **translations_search** | [**TranslationsSearch**](TranslationsSearch.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<(**Array<Object>**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## translations_unverify + +> Object translations_unverify(project_id, translations_unverify, opts) + +Mark translations selected by query as unverified + +Mark translations matching query as unverified. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::TranslationsApi.new +project_id = 'project_id_example' # String | Project ID +translations_unverify = Phrase::TranslationsUnverify.new # TranslationsUnverify | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Mark translations selected by query as unverified + result = api_instance.translations_unverify(project_id, translations_unverify, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling TranslationsApi->translations_unverify: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **translations_unverify** | [**TranslationsUnverify**](TranslationsUnverify.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## translations_verify + +> AffectedCount translations_verify(project_id, translations_verify, opts) + +Verify translations selected by query + +Verify translations matching query. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::TranslationsApi.new +project_id = 'project_id_example' # String | Project ID +translations_verify = Phrase::TranslationsVerify.new # TranslationsVerify | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Verify translations selected by query + result = api_instance.translations_verify(project_id, translations_verify, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling TranslationsApi->translations_verify: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **translations_verify** | [**TranslationsVerify**](TranslationsVerify.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**AffectedCount**](AffectedCount.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/docs/TranslationsByKey.md b/docs/TranslationsByKey.md new file mode 100644 index 0000000..fd6e38c --- /dev/null +++ b/docs/TranslationsByKey.md @@ -0,0 +1,23 @@ +# Phrase::TranslationsByKey + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**sort** | **String** | Sort criteria. Can be one of: key_name, created_at, updated_at. | [optional] +**order** | **String** | Order direction. Can be one of: asc, desc. | [optional] +**q** | **String** | q_description_placeholder | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TranslationsByKey.new(branch: my-feature-branch, + sort: updated_at, + order: desc, + q: PhraseApp*%20unverified:true%20excluded:true%20tags:feature,center) +``` + + diff --git a/docs/TranslationsByLocale.md b/docs/TranslationsByLocale.md new file mode 100644 index 0000000..b5ab37a --- /dev/null +++ b/docs/TranslationsByLocale.md @@ -0,0 +1,23 @@ +# Phrase::TranslationsByLocale + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**sort** | **String** | Sort criteria. Can be one of: key_name, created_at, updated_at. | [optional] +**order** | **String** | Order direction. Can be one of: asc, desc. | [optional] +**q** | **String** | q_description_placeholder | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TranslationsByLocale.new(branch: my-feature-branch, + sort: updated_at, + order: desc, + q: PhraseApp*%20unverified:true%20excluded:true%20tags:feature,center) +``` + + diff --git a/docs/TranslationsExclude.md b/docs/TranslationsExclude.md new file mode 100644 index 0000000..e07fa39 --- /dev/null +++ b/docs/TranslationsExclude.md @@ -0,0 +1,23 @@ +# Phrase::TranslationsExclude + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**q** | **String** | q_description_placeholder | [optional] +**sort** | **String** | Sort criteria. Can be one of: key_name, created_at, updated_at. | [optional] +**order** | **String** | Order direction. Can be one of: asc, desc. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TranslationsExclude.new(branch: my-feature-branch, + q: PhraseApp*%20verified:true%20tags:feature,center, + sort: updated_at, + order: desc) +``` + + diff --git a/docs/TranslationsInclude.md b/docs/TranslationsInclude.md new file mode 100644 index 0000000..8008cd6 --- /dev/null +++ b/docs/TranslationsInclude.md @@ -0,0 +1,23 @@ +# Phrase::TranslationsInclude + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**q** | **String** | q_description_placeholder | [optional] +**sort** | **String** | Sort criteria. Can be one of: key_name, created_at, updated_at. | [optional] +**order** | **String** | Order direction. Can be one of: asc, desc. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TranslationsInclude.new(branch: my-feature-branch, + q: PhraseApp*%20verified:true%20tags:feature,center, + sort: updated_at, + order: desc) +``` + + diff --git a/docs/TranslationsList.md b/docs/TranslationsList.md new file mode 100644 index 0000000..9510fd5 --- /dev/null +++ b/docs/TranslationsList.md @@ -0,0 +1,23 @@ +# Phrase::TranslationsList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**sort** | **String** | Sort criteria. Can be one of: key_name, created_at, updated_at. | [optional] +**order** | **String** | Order direction. Can be one of: asc, desc. | [optional] +**q** | **String** | q_description_placeholder | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TranslationsList.new(branch: my-feature-branch, + sort: updated_at, + order: desc, + q: PhraseApp*%20unverified:true%20excluded:true%20tags:feature,center) +``` + + diff --git a/docs/TranslationsReview.md b/docs/TranslationsReview.md new file mode 100644 index 0000000..9f35835 --- /dev/null +++ b/docs/TranslationsReview.md @@ -0,0 +1,19 @@ +# Phrase::TranslationsReview + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**q** | **String** | q_description_placeholder | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TranslationsReview.new(branch: my-feature-branch, + q: PhraseApp*%reviewed:false%20tags:feature,center) +``` + + diff --git a/docs/TranslationsSearch.md b/docs/TranslationsSearch.md new file mode 100644 index 0000000..b8a2add --- /dev/null +++ b/docs/TranslationsSearch.md @@ -0,0 +1,23 @@ +# Phrase::TranslationsSearch + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**sort** | **String** | Sort criteria. Can be one of: key_name, created_at, updated_at. | [optional] +**order** | **String** | Order direction. Can be one of: asc, desc. | [optional] +**q** | **String** | q_description_placeholder | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TranslationsSearch.new(branch: my-feature-branch, + sort: updated_at, + order: desc, + q: PhraseApp*%20unverified:true%20excluded:true%20tags:feature,center) +``` + + diff --git a/docs/TranslationsUnverify.md b/docs/TranslationsUnverify.md new file mode 100644 index 0000000..c7078ba --- /dev/null +++ b/docs/TranslationsUnverify.md @@ -0,0 +1,23 @@ +# Phrase::TranslationsUnverify + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**q** | **String** | q_description_placeholder | [optional] +**sort** | **String** | Sort criteria. Can be one of: key_name, created_at, updated_at. | [optional] +**order** | **String** | Order direction. Can be one of: asc, desc. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TranslationsUnverify.new(branch: my-feature-branch, + q: PhraseApp*%20verified:true%20tags:feature,center, + sort: updated_at, + order: desc) +``` + + diff --git a/docs/TranslationsVerify.md b/docs/TranslationsVerify.md new file mode 100644 index 0000000..77927b6 --- /dev/null +++ b/docs/TranslationsVerify.md @@ -0,0 +1,23 @@ +# Phrase::TranslationsVerify + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**q** | **String** | q_description_placeholder | [optional] +**sort** | **String** | Sort criteria. Can be one of: key_name, created_at, updated_at. | [optional] +**order** | **String** | Order direction. Can be one of: asc, desc. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::TranslationsVerify.new(branch: my-feature-branch, + q: PhraseApp*%20unverified:true%20tags:feature,center, + sort: updated_at, + order: desc) +``` + + diff --git a/docs/Upload.md b/docs/Upload.md new file mode 100644 index 0000000..2ec6c43 --- /dev/null +++ b/docs/Upload.md @@ -0,0 +1,31 @@ +# Phrase::Upload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**filename** | **String** | | [optional] +**format** | **String** | | [optional] +**state** | **String** | | [optional] +**tag** | **String** | | [optional] +**summary** | [**UploadSummary**](UploadSummary.md) | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Upload.new(id: null, + filename: null, + format: null, + state: null, + tag: null, + summary: null, + created_at: null, + updated_at: null) +``` + + diff --git a/docs/UploadCreate.md b/docs/UploadCreate.md new file mode 100644 index 0000000..a719378 --- /dev/null +++ b/docs/UploadCreate.md @@ -0,0 +1,45 @@ +# Phrase::UploadCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] +**file** | **String** | File to be imported | [optional] +**file_format** | **String** | File format. Auto-detected when possible and not specified. | [optional] +**locale_id** | **String** | Locale of the file's content. Can be the name or public id of the locale. Preferred is the public id. | [optional] +**tags** | **String** | List of tags separated by comma to be associated with the new keys contained in the upload. | [optional] +**update_translations** | **String** | Indicates whether existing translations should be updated with the file content. | [optional] +**update_descriptions** | **String** | Existing key descriptions will be updated with the file content. Empty descriptions overwrite existing descriptions. | [optional] +**convert_emoji** | **String** | This option is obsolete. Providing the option will cause a bad request error. | [optional] +**skip_upload_tags** | **String** | Indicates whether the upload should not create upload tags. | [optional] +**skip_unverification** | **String** | Indicates whether the upload should unverify updated translations. | [optional] +**file_encoding** | **String** | Enforces a specific encoding on the file contents. Valid options are \"UTF-8\", \"UTF-16\" and \"ISO-8859-1\". | [optional] +**locale_mapping** | **String** | Optional, format specific mapping between locale names and the columns the translations to those locales are contained in. | [optional] +**format_options** | **String** | Additional options available for specific formats. See our format guide for complete list. | [optional] +**autotranslate** | **String** | If set, translations for the uploaded language will be fetched automatically. | [optional] +**mark_reviewed** | **String** | Indicated whether the imported translations should be marked as reviewed. This setting is available if the review workflow (currently beta) is enabled for the project. | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::UploadCreate.new(branch: my-feature-branch, + file: /path/to/my/file.json, + file_format: json, + locale_id: abcd1234cdef1234abcd1234cdef1234, + tags: awesome-feature,needs-proofreading, + update_translations: null, + update_descriptions: null, + convert_emoji: null, + skip_upload_tags: null, + skip_unverification: null, + file_encoding: null, + locale_mapping: {"en": "2"}, + format_options: {"foo": "bar"}, + autotranslate: null, + mark_reviewed: null) +``` + + diff --git a/docs/UploadShow.md b/docs/UploadShow.md new file mode 100644 index 0000000..b9715a8 --- /dev/null +++ b/docs/UploadShow.md @@ -0,0 +1,17 @@ +# Phrase::UploadShow + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::UploadShow.new(branch: my-feature-branch) +``` + + diff --git a/docs/UploadSummary.md b/docs/UploadSummary.md new file mode 100644 index 0000000..30cf51c --- /dev/null +++ b/docs/UploadSummary.md @@ -0,0 +1,31 @@ +# Phrase::UploadSummary + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**locales_created** | **Integer** | | [optional] +**translation_keys_created** | **Integer** | | [optional] +**translation_keys_updated** | **Integer** | | [optional] +**translation_keys_unmentioned** | **Integer** | | [optional] +**translations_created** | **Integer** | | [optional] +**translations_updated** | **Integer** | | [optional] +**tags_created** | **Integer** | | [optional] +**translation_keys_ignored** | **Integer** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::UploadSummary.new(locales_created: null, + translation_keys_created: null, + translation_keys_updated: null, + translation_keys_unmentioned: null, + translations_created: null, + translations_updated: null, + tags_created: null, + translation_keys_ignored: null) +``` + + diff --git a/docs/UploadsApi.md b/docs/UploadsApi.md new file mode 100644 index 0000000..dc53e1d --- /dev/null +++ b/docs/UploadsApi.md @@ -0,0 +1,208 @@ +# Phrase::UploadsApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**upload_create**](UploadsApi.md#upload_create) | **POST** /projects/{project_id}/uploads | Upload a new file +[**upload_show**](UploadsApi.md#upload_show) | **GET** /projects/{project_id}/uploads/{id} | View upload details +[**uploads_list**](UploadsApi.md#uploads_list) | **GET** /projects/{project_id}/uploads | List uploads + + + +## upload_create + +> upload_create(project_id, upload_create, opts) + +Upload a new file + +Upload a new language file. Creates necessary resources in your project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::UploadsApi.new +project_id = 'project_id_example' # String | Project ID +upload_create = Phrase::UploadCreate.new # UploadCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Upload a new file + api_instance.upload_create(project_id, upload_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling UploadsApi->upload_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **upload_create** | [**UploadCreate**](UploadCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## upload_show + +> Upload upload_show(project_id, id, upload_show, opts) + +View upload details + +View details and summary for a single upload. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::UploadsApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +upload_show = Phrase::UploadShow.new # UploadShow | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #View upload details + result = api_instance.upload_show(project_id, id, upload_show, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling UploadsApi->upload_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **upload_show** | [**UploadShow**](UploadShow.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**Upload**](Upload.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## uploads_list + +> Array<Object> uploads_list(project_id, uploads_list, opts) + +List uploads + +List all uploads for the given project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::UploadsApi.new +project_id = 'project_id_example' # String | Project ID +uploads_list = Phrase::UploadsList.new # UploadsList | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List uploads + result = api_instance.uploads_list(project_id, uploads_list, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling UploadsApi->uploads_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **uploads_list** | [**UploadsList**](UploadsList.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<(**Array<Object>**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/docs/UploadsList.md b/docs/UploadsList.md new file mode 100644 index 0000000..eac72fc --- /dev/null +++ b/docs/UploadsList.md @@ -0,0 +1,17 @@ +# Phrase::UploadsList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::UploadsList.new(branch: my-feature-branch) +``` + + diff --git a/docs/User.md b/docs/User.md new file mode 100644 index 0000000..93b5e3d --- /dev/null +++ b/docs/User.md @@ -0,0 +1,29 @@ +# Phrase::User + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**username** | **String** | | [optional] +**name** | **String** | | [optional] +**email** | **String** | | [optional] +**position** | **String** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::User.new(id: null, + username: null, + name: null, + email: null, + position: null, + created_at: null, + updated_at: null) +``` + + diff --git a/docs/UserPreview.md b/docs/UserPreview.md new file mode 100644 index 0000000..379b64d --- /dev/null +++ b/docs/UserPreview.md @@ -0,0 +1,21 @@ +# Phrase::UserPreview + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**username** | **String** | | [optional] +**name** | **String** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::UserPreview.new(id: null, + username: null, + name: null) +``` + + diff --git a/docs/UsersApi.md b/docs/UsersApi.md new file mode 100644 index 0000000..fb912a6 --- /dev/null +++ b/docs/UsersApi.md @@ -0,0 +1,69 @@ +# Phrase::UsersApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**show_user**](UsersApi.md#show_user) | **GET** /user | Show current User + + + +## show_user + +> User show_user(opts) + +Show current User + +Show details for current User. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::UsersApi.new +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Show current User + result = api_instance.show_user(opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling UsersApi->show_user: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**User**](User.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/docs/VersionShow.md b/docs/VersionShow.md new file mode 100644 index 0000000..771a250 --- /dev/null +++ b/docs/VersionShow.md @@ -0,0 +1,17 @@ +# Phrase::VersionShow + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::VersionShow.new(branch: my-feature-branch) +``` + + diff --git a/docs/VersionsHistoryApi.md b/docs/VersionsHistoryApi.md new file mode 100644 index 0000000..195a5f1 --- /dev/null +++ b/docs/VersionsHistoryApi.md @@ -0,0 +1,148 @@ +# Phrase::VersionsHistoryApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**version_show**](VersionsHistoryApi.md#version_show) | **GET** /projects/{project_id}/translations/{translation_id}/versions/{id} | Get a single version +[**versions_list**](VersionsHistoryApi.md#versions_list) | **GET** /projects/{project_id}/translations/{translation_id}/versions | List all versions + + + +## version_show + +> Object version_show(project_id, translation_id, id, version_show, opts) + +Get a single version + +Get details on a single version. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::VersionsHistoryApi.new +project_id = 'project_id_example' # String | Project ID +translation_id = 'translation_id_example' # String | Translation ID +id = 'id_example' # String | ID +version_show = Phrase::VersionShow.new # VersionShow | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single version + result = api_instance.version_show(project_id, translation_id, id, version_show, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling VersionsHistoryApi->version_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **translation_id** | **String**| Translation ID | + **id** | **String**| ID | + **version_show** | [**VersionShow**](VersionShow.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## versions_list + +> Array<TranslationVersion> versions_list(project_id, translation_id, versions_list, opts) + +List all versions + +List all versions for the given translation. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::VersionsHistoryApi.new +project_id = 'project_id_example' # String | Project ID +translation_id = 'translation_id_example' # String | Translation ID +versions_list = Phrase::VersionsList.new # VersionsList | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List all versions + result = api_instance.versions_list(project_id, translation_id, versions_list, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling VersionsHistoryApi->versions_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **translation_id** | **String**| Translation ID | + **versions_list** | [**VersionsList**](VersionsList.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<([**Array<TranslationVersion>**](TranslationVersion.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/docs/VersionsList.md b/docs/VersionsList.md new file mode 100644 index 0000000..235ec76 --- /dev/null +++ b/docs/VersionsList.md @@ -0,0 +1,17 @@ +# Phrase::VersionsList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | **String** | specify the branch to use | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::VersionsList.new(branch: my-feature-branch) +``` + + diff --git a/docs/Webhook.md b/docs/Webhook.md new file mode 100644 index 0000000..f7ed8ff --- /dev/null +++ b/docs/Webhook.md @@ -0,0 +1,29 @@ +# Phrase::Webhook + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**callback_url** | **String** | | [optional] +**description** | **String** | | [optional] +**events** | **Array<String>** | | [optional] +**active** | **Boolean** | | [optional] +**created_at** | **DateTime** | | [optional] +**updated_at** | **DateTime** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::Webhook.new(id: null, + callback_url: null, + description: null, + events: null, + active: null, + created_at: null, + updated_at: null) +``` + + diff --git a/docs/WebhookCreate.md b/docs/WebhookCreate.md new file mode 100644 index 0000000..0b89f57 --- /dev/null +++ b/docs/WebhookCreate.md @@ -0,0 +1,23 @@ +# Phrase::WebhookCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**callback_url** | **String** | Callback URL to send requests to | [optional] +**description** | **String** | Webhook description | [optional] +**events** | **String** | List of event names to trigger the webhook (separated by comma) | [optional] +**active** | **String** | Whether webhook is active or inactive | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::WebhookCreate.new(callback_url: http://example.com/hooks/phraseapp-notifications, + description: My webhook for chat notifications, + events: locales:create,translations:update, + active: null) +``` + + diff --git a/docs/WebhookUpdate.md b/docs/WebhookUpdate.md new file mode 100644 index 0000000..1c8b0f2 --- /dev/null +++ b/docs/WebhookUpdate.md @@ -0,0 +1,23 @@ +# Phrase::WebhookUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**callback_url** | **String** | Callback URL to send requests to | [optional] +**description** | **String** | Webhook description | [optional] +**events** | **String** | List of event names to trigger the webhook (separated by comma) | [optional] +**active** | **String** | Whether webhook is active or inactive | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::WebhookUpdate.new(callback_url: http://example.com/hooks/phraseapp-notifications, + description: My webhook for chat notifications, + events: locales:create,translations:update, + active: null) +``` + + diff --git a/docs/WebhooksApi.md b/docs/WebhooksApi.md new file mode 100644 index 0000000..fa3fcdb --- /dev/null +++ b/docs/WebhooksApi.md @@ -0,0 +1,399 @@ +# Phrase::WebhooksApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**webhook_create**](WebhooksApi.md#webhook_create) | **POST** /projects/{project_id}/webhooks | Create a webhook +[**webhook_delete**](WebhooksApi.md#webhook_delete) | **DELETE** /projects/{project_id}/webhooks/{id} | Delete a webhook +[**webhook_show**](WebhooksApi.md#webhook_show) | **GET** /projects/{project_id}/webhooks/{id} | Get a single webhook +[**webhook_test**](WebhooksApi.md#webhook_test) | **POST** /projects/{project_id}/webhooks/{id}/test | Test a webhook +[**webhook_update**](WebhooksApi.md#webhook_update) | **PATCH** /projects/{project_id}/webhooks/{id} | Update a webhook +[**webhooks_list**](WebhooksApi.md#webhooks_list) | **GET** /projects/{project_id}/webhooks | List webhooks + + + +## webhook_create + +> webhook_create(project_id, webhook_create, opts) + +Create a webhook + +Create a new webhook. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::WebhooksApi.new +project_id = 'project_id_example' # String | Project ID +webhook_create = Phrase::WebhookCreate.new # WebhookCreate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Create a webhook + api_instance.webhook_create(project_id, webhook_create, opts) +rescue Phrase::ApiError => e + puts "Exception when calling WebhooksApi->webhook_create: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **webhook_create** | [**WebhookCreate**](WebhookCreate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## webhook_delete + +> webhook_delete(project_id, id, opts) + +Delete a webhook + +Delete an existing webhook. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::WebhooksApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Delete a webhook + api_instance.webhook_delete(project_id, id, opts) +rescue Phrase::ApiError => e + puts "Exception when calling WebhooksApi->webhook_delete: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## webhook_show + +> Webhook webhook_show(project_id, id, opts) + +Get a single webhook + +Get details on a single webhook. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::WebhooksApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single webhook + result = api_instance.webhook_show(project_id, id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling WebhooksApi->webhook_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**Webhook**](Webhook.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## webhook_test + +> webhook_test(project_id, id, opts) + +Test a webhook + +Perform a test request for a webhook. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::WebhooksApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Test a webhook + api_instance.webhook_test(project_id, id, opts) +rescue Phrase::ApiError => e + puts "Exception when calling WebhooksApi->webhook_test: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(nil (empty response body))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## webhook_update + +> Object webhook_update(project_id, id, webhook_update, opts) + +Update a webhook + +Update an existing webhook. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::WebhooksApi.new +project_id = 'project_id_example' # String | Project ID +id = 'id_example' # String | ID +webhook_update = Phrase::WebhookUpdate.new # WebhookUpdate | +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Update a webhook + result = api_instance.webhook_update(project_id, id, webhook_update, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling WebhooksApi->webhook_update: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **id** | **String**| ID | + **webhook_update** | [**WebhookUpdate**](WebhookUpdate.md)| | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<(**Object**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## webhooks_list + +> Array<Object> webhooks_list(project_id, opts) + +List webhooks + +List all webhooks for the given project. + +### 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' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = Phrase::WebhooksApi.new +project_id = 'project_id_example' # String | Project ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional) + page: 1, # Integer | Page number + per_page: 10 # Integer | allows you to specify a page size up to 100 items, 10 by default +} + +begin + #List webhooks + result = api_instance.webhooks_list(project_id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling WebhooksApi->webhooks_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **String**| Project ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + **page** | **Integer**| Page number | [optional] + **per_page** | **Integer**| allows you to specify a page size up to 100 items, 10 by default | [optional] + +### Return type + +Response<(**Array<Object>**)> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/git_push.sh b/git_push.sh new file mode 100644 index 0000000..ced3be2 --- /dev/null +++ b/git_push.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/lib/Phrase.rb b/lib/Phrase.rb new file mode 100644 index 0000000..c224e7a --- /dev/null +++ b/lib/Phrase.rb @@ -0,0 +1,263 @@ +require 'link-header-parser' + +# Common files +require 'Phrase/api_client' +require 'Phrase/api_error' +require 'Phrase/version' +require 'Phrase/configuration' + +# Models +require 'Phrase/models/account' +require 'Phrase/models/affected_count' +require 'Phrase/models/affected_resources' +require 'Phrase/models/authorization' +require 'Phrase/models/authorization_create' +require 'Phrase/models/authorization_update' +require 'Phrase/models/bitbucket_sync' +require 'Phrase/models/bitbucket_sync_export' +require 'Phrase/models/bitbucket_sync_export_response' +require 'Phrase/models/bitbucket_sync_import' +require 'Phrase/models/bitbucket_syncs_list' +require 'Phrase/models/blacklisted_key' +require 'Phrase/models/blacklisted_key_create' +require 'Phrase/models/blacklisted_key_update' +require 'Phrase/models/branch' +require 'Phrase/models/branch_compare' +require 'Phrase/models/branch_create' +require 'Phrase/models/branch_merge' +require 'Phrase/models/branch_update' +require 'Phrase/models/comment' +require 'Phrase/models/comment_create' +require 'Phrase/models/comment_delete' +require 'Phrase/models/comment_mark_check' +require 'Phrase/models/comment_mark_read' +require 'Phrase/models/comment_mark_unread' +require 'Phrase/models/comment_show' +require 'Phrase/models/comment_update' +require 'Phrase/models/comments_list' +require 'Phrase/models/distribution' +require 'Phrase/models/distribution_create' +require 'Phrase/models/distribution_preview' +require 'Phrase/models/distribution_update' +require 'Phrase/models/errors' +require 'Phrase/models/errors_errors' +require 'Phrase/models/format' +require 'Phrase/models/gitlab_sync' +require 'Phrase/models/gitlab_sync_delete' +require 'Phrase/models/gitlab_sync_export' +require 'Phrase/models/gitlab_sync_export1' +require 'Phrase/models/gitlab_sync_history' +require 'Phrase/models/gitlab_sync_history1' +require 'Phrase/models/gitlab_sync_import' +require 'Phrase/models/gitlab_sync_list' +require 'Phrase/models/gitlab_sync_show' +require 'Phrase/models/gitlab_sync_update' +require 'Phrase/models/glossary' +require 'Phrase/models/glossary_create' +require 'Phrase/models/glossary_term' +require 'Phrase/models/glossary_term_create' +require 'Phrase/models/glossary_term_translation' +require 'Phrase/models/glossary_term_translation_create' +require 'Phrase/models/glossary_term_translation_update' +require 'Phrase/models/glossary_term_update' +require 'Phrase/models/glossary_update' +require 'Phrase/models/invitation' +require 'Phrase/models/invitation_create' +require 'Phrase/models/invitation_update' +require 'Phrase/models/job' +require 'Phrase/models/job_complete' +require 'Phrase/models/job_create' +require 'Phrase/models/job_delete' +require 'Phrase/models/job_keys_create' +require 'Phrase/models/job_keys_delete' +require 'Phrase/models/job_locale' +require 'Phrase/models/job_locale_complete' +require 'Phrase/models/job_locale_delete' +require 'Phrase/models/job_locale_reopen' +require 'Phrase/models/job_locale_show' +require 'Phrase/models/job_locale_update' +require 'Phrase/models/job_locales_create' +require 'Phrase/models/job_locales_list' +require 'Phrase/models/job_preview' +require 'Phrase/models/job_reopen' +require 'Phrase/models/job_show' +require 'Phrase/models/job_start' +require 'Phrase/models/job_update' +require 'Phrase/models/jobs_list' +require 'Phrase/models/key_create' +require 'Phrase/models/key_delete' +require 'Phrase/models/key_preview' +require 'Phrase/models/key_show' +require 'Phrase/models/key_update' +require 'Phrase/models/keys_delete' +require 'Phrase/models/keys_list' +require 'Phrase/models/keys_search' +require 'Phrase/models/keys_tag' +require 'Phrase/models/keys_untag' +require 'Phrase/models/locale' +require 'Phrase/models/locale_create' +require 'Phrase/models/locale_delete' +require 'Phrase/models/locale_download' +require 'Phrase/models/locale_preview' +require 'Phrase/models/locale_show' +require 'Phrase/models/locale_update' +require 'Phrase/models/locales_list' +require 'Phrase/models/member' +require 'Phrase/models/member_update' +require 'Phrase/models/order_confirm' +require 'Phrase/models/order_create' +require 'Phrase/models/order_delete' +require 'Phrase/models/order_show' +require 'Phrase/models/orders_list' +require 'Phrase/models/project' +require 'Phrase/models/project_create' +require 'Phrase/models/project_short' +require 'Phrase/models/project_update' +require 'Phrase/models/release' +require 'Phrase/models/release_create' +require 'Phrase/models/release_preview' +require 'Phrase/models/release_update' +require 'Phrase/models/screenshot' +require 'Phrase/models/screenshot_create' +require 'Phrase/models/screenshot_marker' +require 'Phrase/models/screenshot_marker_create' +require 'Phrase/models/screenshot_marker_update' +require 'Phrase/models/screenshot_update' +require 'Phrase/models/space' +require 'Phrase/models/space_create' +require 'Phrase/models/space_update' +require 'Phrase/models/spaces_projects_create' +require 'Phrase/models/styleguide' +require 'Phrase/models/styleguide_create' +require 'Phrase/models/styleguide_preview' +require 'Phrase/models/styleguide_update' +require 'Phrase/models/tag' +require 'Phrase/models/tag_create' +require 'Phrase/models/tag_delete' +require 'Phrase/models/tag_show' +require 'Phrase/models/tags_list' +require 'Phrase/models/translation' +require 'Phrase/models/translation_create' +require 'Phrase/models/translation_exclude' +require 'Phrase/models/translation_include' +require 'Phrase/models/translation_key' +require 'Phrase/models/translation_order' +require 'Phrase/models/translation_review' +require 'Phrase/models/translation_show' +require 'Phrase/models/translation_unverify' +require 'Phrase/models/translation_update' +require 'Phrase/models/translation_verify' +require 'Phrase/models/translation_version' +require 'Phrase/models/translations_by_key' +require 'Phrase/models/translations_by_locale' +require 'Phrase/models/translations_exclude' +require 'Phrase/models/translations_include' +require 'Phrase/models/translations_list' +require 'Phrase/models/translations_review' +require 'Phrase/models/translations_search' +require 'Phrase/models/translations_unverify' +require 'Phrase/models/translations_verify' +require 'Phrase/models/upload' +require 'Phrase/models/upload_create' +require 'Phrase/models/upload_show' +require 'Phrase/models/upload_summary' +require 'Phrase/models/uploads_list' +require 'Phrase/models/user' +require 'Phrase/models/user_preview' +require 'Phrase/models/version_show' +require 'Phrase/models/versions_list' +require 'Phrase/models/webhook' +require 'Phrase/models/webhook_create' +require 'Phrase/models/webhook_update' + +# APIs +require 'Phrase/api/accounts_api' +require 'Phrase/api/authorizations_api' +require 'Phrase/api/bitbucket_sync_api' +require 'Phrase/api/blacklisted_keys_api' +require 'Phrase/api/branches_api' +require 'Phrase/api/comments_api' +require 'Phrase/api/distributions_api' +require 'Phrase/api/formats_api' +require 'Phrase/api/git_lab_sync_api' +require 'Phrase/api/glossary_api' +require 'Phrase/api/glossary_term_translations_api' +require 'Phrase/api/glossary_terms_api' +require 'Phrase/api/invitations_api' +require 'Phrase/api/job_locales_api' +require 'Phrase/api/jobs_api' +require 'Phrase/api/keys_api' +require 'Phrase/api/locales_api' +require 'Phrase/api/members_api' +require 'Phrase/api/orders_api' +require 'Phrase/api/projects_api' +require 'Phrase/api/releases_api' +require 'Phrase/api/screenshot_markers_api' +require 'Phrase/api/screenshots_api' +require 'Phrase/api/spaces_api' +require 'Phrase/api/style_guides_api' +require 'Phrase/api/tags_api' +require 'Phrase/api/translations_api' +require 'Phrase/api/uploads_api' +require 'Phrase/api/users_api' +require 'Phrase/api/versions_history_api' +require 'Phrase/api/webhooks_api' + +module Phrase + class Response + attr_reader :data + + def initialize(data, headers) + @data = data + @paginated = false + @next_page = nil + + link_headers = headers["link"] + if link_headers + @paginated = true + parsed_links = LinkHeaderParser.parse(link_headers, base: 'https://api.phrase.com').by_relation_type + next_page_link = parsed_links[:next]&.first + if next_page_link + @next_page = CGI.parse(URI.parse(next_page_link.target_uri).query)["page"]&.first&.to_i + end + end + end + + def method_missing(method, *args, &block) + if data.respond_to?(method) + data.send(method, *args, &block) + else + super + end + end + + def next_page + @next_page + end + + def next_page? + paginated? && !next_page.nil? + end + + def paginated? + @paginated + end + end + + + class << self + # Customize default settings for the SDK using block. + # Phrase.configure do |config| + # config.username = "xxx" + # config.password = "xxx" + # end + # If no block given, return the default Configuration object. + def configure + if block_given? + yield(Configuration.default) + else + Configuration.default + end + end + end +end diff --git a/lib/Phrase/api/accounts_api.rb b/lib/Phrase/api/accounts_api.rb new file mode 100644 index 0000000..969a114 --- /dev/null +++ b/lib/Phrase/api/accounts_api.rb @@ -0,0 +1,142 @@ +require 'cgi' + +module Phrase + class AccountsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Get a single account + # Get details on a single account. + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Account] + def account_show(id, opts = {}) + data, _status_code, _headers = account_show_with_http_info(id, opts) + data + end + + # Get a single account + # Get details on a single account. + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Account)>, Integer, Hash)>] Response<(Account)> data, response status code and response headers + def account_show_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AccountsApi.account_show ...' + 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 AccountsApi.account_show" + end + # resource path + local_var_path = '/accounts/{id}'.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']) + 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] + + # return_type + return_type = opts[:return_type] || 'Account' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AccountsApi#account_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List accounts + # List all accounts the current user has access to. + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def accounts_list(opts = {}) + data, _status_code, _headers = accounts_list_with_http_info(opts) + data + end + + # List accounts + # List all accounts the current user has access to. + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def accounts_list_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AccountsApi.accounts_list ...' + end + # resource path + local_var_path = '/accounts' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['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] + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AccountsApi#accounts_list\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/api/authorizations_api.rb b/lib/Phrase/api/authorizations_api.rb new file mode 100644 index 0000000..6436eab --- /dev/null +++ b/lib/Phrase/api/authorizations_api.rb @@ -0,0 +1,346 @@ +require 'cgi' + +module Phrase + class AuthorizationsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create an authorization + # Create a new authorization. + # @param authorization_create [AuthorizationCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def authorization_create(authorization_create, opts = {}) + authorization_create_with_http_info(authorization_create, opts) + nil + end + + # Create an authorization + # Create a new authorization. + # @param authorization_create [AuthorizationCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def authorization_create_with_http_info(authorization_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AuthorizationsApi.authorization_create ...' + end + # verify the required parameter 'authorization_create' is set + if @api_client.config.client_side_validation && authorization_create.nil? + fail ArgumentError, "Missing the required parameter 'authorization_create' when calling AuthorizationsApi.authorization_create" + end + # resource path + local_var_path = '/authorizations' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(authorization_create) + + # return_type + return_type = opts[:return_type] + + # 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: AuthorizationsApi#authorization_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete an authorization + # Delete an existing authorization. API calls using that token will stop working. + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def authorization_delete(id, opts = {}) + authorization_delete_with_http_info(id, opts) + nil + end + + # Delete an authorization + # Delete an existing authorization. API calls using that token will stop working. + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def authorization_delete_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AuthorizationsApi.authorization_delete ...' + 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 AuthorizationsApi.authorization_delete" + end + # resource path + local_var_path = '/authorizations/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + 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] + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AuthorizationsApi#authorization_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single authorization + # Get details on a single authorization. + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Authorization] + def authorization_show(id, opts = {}) + data, _status_code, _headers = authorization_show_with_http_info(id, opts) + data + end + + # Get a single authorization + # Get details on a single authorization. + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Authorization)>, Integer, Hash)>] Response<(Authorization)> data, response status code and response headers + def authorization_show_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AuthorizationsApi.authorization_show ...' + 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 AuthorizationsApi.authorization_show" + end + # resource path + local_var_path = '/authorizations/{id}'.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']) + 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] + + # return_type + return_type = opts[:return_type] || 'Authorization' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AuthorizationsApi#authorization_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update an authorization + # Update an existing authorization. + # @param id [String] ID + # @param authorization_update [AuthorizationUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def authorization_update(id, authorization_update, opts = {}) + data, _status_code, _headers = authorization_update_with_http_info(id, authorization_update, opts) + data + end + + # Update an authorization + # Update an existing authorization. + # @param id [String] ID + # @param authorization_update [AuthorizationUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def authorization_update_with_http_info(id, authorization_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AuthorizationsApi.authorization_update ...' + 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 AuthorizationsApi.authorization_update" + end + # verify the required parameter 'authorization_update' is set + if @api_client.config.client_side_validation && authorization_update.nil? + fail ArgumentError, "Missing the required parameter 'authorization_update' when calling AuthorizationsApi.authorization_update" + end + # resource path + local_var_path = '/authorizations/{id}'.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(authorization_update) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AuthorizationsApi#authorization_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List authorizations + # List all your authorizations. + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def authorizations_list(opts = {}) + data, _status_code, _headers = authorizations_list_with_http_info(opts) + data + end + + # List authorizations + # List all your authorizations. + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def authorizations_list_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AuthorizationsApi.authorizations_list ...' + end + # resource path + local_var_path = '/authorizations' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['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] + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AuthorizationsApi#authorizations_list\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/api/bitbucket_sync_api.rb b/lib/Phrase/api/bitbucket_sync_api.rb new file mode 100644 index 0000000..ba6709e --- /dev/null +++ b/lib/Phrase/api/bitbucket_sync_api.rb @@ -0,0 +1,224 @@ +require 'cgi' + +module Phrase + class BitbucketSyncApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Export from Phrase to Bitbucket + # Export translations from Phrase to Bitbucket according to the .phraseapp.yml file within the Bitbucket Repository. + # @param id [String] ID + # @param bitbucket_sync_export [BitbucketSyncExport] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [BitbucketSyncExportResponse] + def bitbucket_sync_export(id, bitbucket_sync_export, opts = {}) + data, _status_code, _headers = bitbucket_sync_export_with_http_info(id, bitbucket_sync_export, opts) + data + end + + # Export from Phrase to Bitbucket + # Export translations from Phrase to Bitbucket according to the .phraseapp.yml file within the Bitbucket Repository. + # @param id [String] ID + # @param bitbucket_sync_export [BitbucketSyncExport] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(BitbucketSyncExportResponse)>, Integer, Hash)>] Response<(BitbucketSyncExportResponse)> data, response status code and response headers + def bitbucket_sync_export_with_http_info(id, bitbucket_sync_export, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BitbucketSyncApi.bitbucket_sync_export ...' + 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 BitbucketSyncApi.bitbucket_sync_export" + end + # verify the required parameter 'bitbucket_sync_export' is set + if @api_client.config.client_side_validation && bitbucket_sync_export.nil? + fail ArgumentError, "Missing the required parameter 'bitbucket_sync_export' when calling BitbucketSyncApi.bitbucket_sync_export" + end + # resource path + local_var_path = '/bitbucket_syncs/{id}/export'.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(bitbucket_sync_export) + + # return_type + return_type = opts[:return_type] || 'BitbucketSyncExportResponse' + + # 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: BitbucketSyncApi#bitbucket_sync_export\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Import to Phrase from Bitbucket + # Import translations from Bitbucket to Phrase according to the .phraseapp.yml file within the Bitbucket repository. + # @param id [String] ID + # @param bitbucket_sync_import [BitbucketSyncImport] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def bitbucket_sync_import(id, bitbucket_sync_import, opts = {}) + bitbucket_sync_import_with_http_info(id, bitbucket_sync_import, opts) + nil + end + + # Import to Phrase from Bitbucket + # Import translations from Bitbucket to Phrase according to the .phraseapp.yml file within the Bitbucket repository. + # @param id [String] ID + # @param bitbucket_sync_import [BitbucketSyncImport] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def bitbucket_sync_import_with_http_info(id, bitbucket_sync_import, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BitbucketSyncApi.bitbucket_sync_import ...' + 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 BitbucketSyncApi.bitbucket_sync_import" + end + # verify the required parameter 'bitbucket_sync_import' is set + if @api_client.config.client_side_validation && bitbucket_sync_import.nil? + fail ArgumentError, "Missing the required parameter 'bitbucket_sync_import' when calling BitbucketSyncApi.bitbucket_sync_import" + end + # resource path + local_var_path = '/bitbucket_syncs/{id}/import'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(bitbucket_sync_import) + + # return_type + return_type = opts[:return_type] + + # 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: BitbucketSyncApi#bitbucket_sync_import\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List Bitbucket syncs + # List all Bitbucket repositories for which synchronisation with Phrase is activated. + # @param bitbucket_syncs_list [BitbucketSyncsList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array] + def bitbucket_syncs_list(bitbucket_syncs_list, opts = {}) + data, _status_code, _headers = bitbucket_syncs_list_with_http_info(bitbucket_syncs_list, opts) + data + end + + # List Bitbucket syncs + # List all Bitbucket repositories for which synchronisation with Phrase is activated. + # @param bitbucket_syncs_list [BitbucketSyncsList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def bitbucket_syncs_list_with_http_info(bitbucket_syncs_list, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BitbucketSyncApi.bitbucket_syncs_list ...' + end + # verify the required parameter 'bitbucket_syncs_list' is set + if @api_client.config.client_side_validation && bitbucket_syncs_list.nil? + fail ArgumentError, "Missing the required parameter 'bitbucket_syncs_list' when calling BitbucketSyncApi.bitbucket_syncs_list" + end + # resource path + local_var_path = '/bitbucket_syncs' + + # 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(bitbucket_syncs_list) + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BitbucketSyncApi#bitbucket_syncs_list\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/api/blacklisted_keys_api.rb b/lib/Phrase/api/blacklisted_keys_api.rb new file mode 100644 index 0000000..1c76486 --- /dev/null +++ b/lib/Phrase/api/blacklisted_keys_api.rb @@ -0,0 +1,376 @@ +require 'cgi' + +module Phrase + class BlacklistedKeysApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a blacklisted key + # Create a new rule for blacklisting keys. + # @param project_id [String] Project ID + # @param blacklisted_key_create [BlacklistedKeyCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def blacklisted_key_create(project_id, blacklisted_key_create, opts = {}) + blacklisted_key_create_with_http_info(project_id, blacklisted_key_create, opts) + nil + end + + # Create a blacklisted key + # Create a new rule for blacklisting keys. + # @param project_id [String] Project ID + # @param blacklisted_key_create [BlacklistedKeyCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def blacklisted_key_create_with_http_info(project_id, blacklisted_key_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BlacklistedKeysApi.blacklisted_key_create ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling BlacklistedKeysApi.blacklisted_key_create" + end + # verify the required parameter 'blacklisted_key_create' is set + if @api_client.config.client_side_validation && blacklisted_key_create.nil? + fail ArgumentError, "Missing the required parameter 'blacklisted_key_create' when calling BlacklistedKeysApi.blacklisted_key_create" + end + # resource path + local_var_path = '/projects/{project_id}/blacklisted_keys'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(blacklisted_key_create) + + # return_type + return_type = opts[:return_type] + + # 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: BlacklistedKeysApi#blacklisted_key_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete a blacklisted key + # Delete an existing rule for blacklisting keys. + # @param project_id [String] Project ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def blacklisted_key_delete(project_id, id, opts = {}) + blacklisted_key_delete_with_http_info(project_id, id, opts) + nil + end + + # Delete a blacklisted key + # Delete an existing rule for blacklisting keys. + # @param project_id [String] Project ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def blacklisted_key_delete_with_http_info(project_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BlacklistedKeysApi.blacklisted_key_delete ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling BlacklistedKeysApi.blacklisted_key_delete" + 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 BlacklistedKeysApi.blacklisted_key_delete" + end + # resource path + local_var_path = '/projects/{project_id}/blacklisted_keys/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + 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] + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BlacklistedKeysApi#blacklisted_key_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single blacklisted key + # Get details on a single rule for blacklisting keys for a given project. + # @param project_id [String] Project ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [BlacklistedKey] + def blacklisted_key_show(project_id, id, opts = {}) + data, _status_code, _headers = blacklisted_key_show_with_http_info(project_id, id, opts) + data + end + + # Get a single blacklisted key + # Get details on a single rule for blacklisting keys for a given project. + # @param project_id [String] Project ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(BlacklistedKey)>, Integer, Hash)>] Response<(BlacklistedKey)> data, response status code and response headers + def blacklisted_key_show_with_http_info(project_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BlacklistedKeysApi.blacklisted_key_show ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling BlacklistedKeysApi.blacklisted_key_show" + 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 BlacklistedKeysApi.blacklisted_key_show" + end + # resource path + local_var_path = '/projects/{project_id}/blacklisted_keys/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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']) + 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] + + # return_type + return_type = opts[:return_type] || 'BlacklistedKey' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BlacklistedKeysApi#blacklisted_key_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update a blacklisted key + # Update an existing rule for blacklisting keys. + # @param project_id [String] Project ID + # @param id [String] ID + # @param blacklisted_key_update [BlacklistedKeyUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def blacklisted_key_update(project_id, id, blacklisted_key_update, opts = {}) + data, _status_code, _headers = blacklisted_key_update_with_http_info(project_id, id, blacklisted_key_update, opts) + data + end + + # Update a blacklisted key + # Update an existing rule for blacklisting keys. + # @param project_id [String] Project ID + # @param id [String] ID + # @param blacklisted_key_update [BlacklistedKeyUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def blacklisted_key_update_with_http_info(project_id, id, blacklisted_key_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BlacklistedKeysApi.blacklisted_key_update ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling BlacklistedKeysApi.blacklisted_key_update" + 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 BlacklistedKeysApi.blacklisted_key_update" + end + # verify the required parameter 'blacklisted_key_update' is set + if @api_client.config.client_side_validation && blacklisted_key_update.nil? + fail ArgumentError, "Missing the required parameter 'blacklisted_key_update' when calling BlacklistedKeysApi.blacklisted_key_update" + end + # resource path + local_var_path = '/projects/{project_id}/blacklisted_keys/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(blacklisted_key_update) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BlacklistedKeysApi#blacklisted_key_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List blacklisted keys + # List all rules for blacklisting keys for the given project. + # @param project_id [String] Project ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def blacklisted_keys_list(project_id, opts = {}) + data, _status_code, _headers = blacklisted_keys_list_with_http_info(project_id, opts) + data + end + + # List blacklisted keys + # List all rules for blacklisting keys for the given project. + # @param project_id [String] Project ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def blacklisted_keys_list_with_http_info(project_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BlacklistedKeysApi.blacklisted_keys_list ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling BlacklistedKeysApi.blacklisted_keys_list" + end + # resource path + local_var_path = '/projects/{project_id}/blacklisted_keys'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['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] + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BlacklistedKeysApi#blacklisted_keys_list\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/api/branches_api.rb b/lib/Phrase/api/branches_api.rb new file mode 100644 index 0000000..242d20c --- /dev/null +++ b/lib/Phrase/api/branches_api.rb @@ -0,0 +1,532 @@ +require 'cgi' + +module Phrase + class BranchesApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Compare branches + # Compare branch with main branch. + # @param project_id [String] Project ID + # @param name [String] name + # @param branch_compare [BranchCompare] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def branch_compare(project_id, name, branch_compare, opts = {}) + branch_compare_with_http_info(project_id, name, branch_compare, opts) + nil + end + + # Compare branches + # Compare branch with main branch. + # @param project_id [String] Project ID + # @param name [String] name + # @param branch_compare [BranchCompare] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def branch_compare_with_http_info(project_id, name, branch_compare, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BranchesApi.branch_compare ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling BranchesApi.branch_compare" + end + # verify the required parameter 'name' is set + if @api_client.config.client_side_validation && name.nil? + fail ArgumentError, "Missing the required parameter 'name' when calling BranchesApi.branch_compare" + end + # verify the required parameter 'branch_compare' is set + if @api_client.config.client_side_validation && branch_compare.nil? + fail ArgumentError, "Missing the required parameter 'branch_compare' when calling BranchesApi.branch_compare" + end + # resource path + local_var_path = '/projects/{project_id}/branches/{name}/compare'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'name' + '}', CGI.escape(name.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(branch_compare) + + # return_type + return_type = opts[:return_type] + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BranchesApi#branch_compare\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Create a branch + # Create a new branch. + # @param project_id [String] Project ID + # @param branch_create [BranchCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def branch_create(project_id, branch_create, opts = {}) + branch_create_with_http_info(project_id, branch_create, opts) + nil + end + + # Create a branch + # Create a new branch. + # @param project_id [String] Project ID + # @param branch_create [BranchCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def branch_create_with_http_info(project_id, branch_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BranchesApi.branch_create ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling BranchesApi.branch_create" + end + # verify the required parameter 'branch_create' is set + if @api_client.config.client_side_validation && branch_create.nil? + fail ArgumentError, "Missing the required parameter 'branch_create' when calling BranchesApi.branch_create" + end + # resource path + local_var_path = '/projects/{project_id}/branches'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(branch_create) + + # return_type + return_type = opts[:return_type] + + # 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: BranchesApi#branch_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete a branch + # Delete an existing branch. + # @param project_id [String] Project ID + # @param name [String] name + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def branch_delete(project_id, name, opts = {}) + branch_delete_with_http_info(project_id, name, opts) + nil + end + + # Delete a branch + # Delete an existing branch. + # @param project_id [String] Project ID + # @param name [String] name + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def branch_delete_with_http_info(project_id, name, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BranchesApi.branch_delete ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling BranchesApi.branch_delete" + end + # verify the required parameter 'name' is set + if @api_client.config.client_side_validation && name.nil? + fail ArgumentError, "Missing the required parameter 'name' when calling BranchesApi.branch_delete" + end + # resource path + local_var_path = '/projects/{project_id}/branches/{name}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'name' + '}', CGI.escape(name.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + 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] + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BranchesApi#branch_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Merge a branch + # Merge an existing branch. + # @param project_id [String] Project ID + # @param name [String] name + # @param branch_merge [BranchMerge] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def branch_merge(project_id, name, branch_merge, opts = {}) + branch_merge_with_http_info(project_id, name, branch_merge, opts) + nil + end + + # Merge a branch + # Merge an existing branch. + # @param project_id [String] Project ID + # @param name [String] name + # @param branch_merge [BranchMerge] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def branch_merge_with_http_info(project_id, name, branch_merge, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BranchesApi.branch_merge ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling BranchesApi.branch_merge" + end + # verify the required parameter 'name' is set + if @api_client.config.client_side_validation && name.nil? + fail ArgumentError, "Missing the required parameter 'name' when calling BranchesApi.branch_merge" + end + # verify the required parameter 'branch_merge' is set + if @api_client.config.client_side_validation && branch_merge.nil? + fail ArgumentError, "Missing the required parameter 'branch_merge' when calling BranchesApi.branch_merge" + end + # resource path + local_var_path = '/projects/{project_id}/branches/{name}/merge'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'name' + '}', CGI.escape(name.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(branch_merge) + + # return_type + return_type = opts[:return_type] + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BranchesApi#branch_merge\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single branch + # Get details on a single branch for a given project. + # @param project_id [String] Project ID + # @param name [String] name + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Branch] + def branch_show(project_id, name, opts = {}) + data, _status_code, _headers = branch_show_with_http_info(project_id, name, opts) + data + end + + # Get a single branch + # Get details on a single branch for a given project. + # @param project_id [String] Project ID + # @param name [String] name + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Branch)>, Integer, Hash)>] Response<(Branch)> data, response status code and response headers + def branch_show_with_http_info(project_id, name, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BranchesApi.branch_show ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling BranchesApi.branch_show" + end + # verify the required parameter 'name' is set + if @api_client.config.client_side_validation && name.nil? + fail ArgumentError, "Missing the required parameter 'name' when calling BranchesApi.branch_show" + end + # resource path + local_var_path = '/projects/{project_id}/branches/{name}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'name' + '}', CGI.escape(name.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']) + 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] + + # return_type + return_type = opts[:return_type] || 'Branch' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BranchesApi#branch_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update a branch + # Update an existing branch. + # @param project_id [String] Project ID + # @param name [String] name + # @param branch_update [BranchUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def branch_update(project_id, name, branch_update, opts = {}) + data, _status_code, _headers = branch_update_with_http_info(project_id, name, branch_update, opts) + data + end + + # Update a branch + # Update an existing branch. + # @param project_id [String] Project ID + # @param name [String] name + # @param branch_update [BranchUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def branch_update_with_http_info(project_id, name, branch_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BranchesApi.branch_update ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling BranchesApi.branch_update" + end + # verify the required parameter 'name' is set + if @api_client.config.client_side_validation && name.nil? + fail ArgumentError, "Missing the required parameter 'name' when calling BranchesApi.branch_update" + end + # verify the required parameter 'branch_update' is set + if @api_client.config.client_side_validation && branch_update.nil? + fail ArgumentError, "Missing the required parameter 'branch_update' when calling BranchesApi.branch_update" + end + # resource path + local_var_path = '/projects/{project_id}/branches/{name}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'name' + '}', CGI.escape(name.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(branch_update) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BranchesApi#branch_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List branches + # List all branches the of the current project. + # @param project_id [String] Project ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def branches_list(project_id, opts = {}) + data, _status_code, _headers = branches_list_with_http_info(project_id, opts) + data + end + + # List branches + # List all branches the of the current project. + # @param project_id [String] Project ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def branches_list_with_http_info(project_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BranchesApi.branches_list ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling BranchesApi.branches_list" + end + # resource path + local_var_path = '/projects/{project_id}/branches'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['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] + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BranchesApi#branches_list\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/api/comments_api.rb b/lib/Phrase/api/comments_api.rb new file mode 100644 index 0000000..71b0605 --- /dev/null +++ b/lib/Phrase/api/comments_api.rb @@ -0,0 +1,682 @@ +require 'cgi' + +module Phrase + class CommentsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a comment + # Create a new comment for a key. + # @param project_id [String] Project ID + # @param key_id [String] Translation Key ID + # @param comment_create [CommentCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def comment_create(project_id, key_id, comment_create, opts = {}) + comment_create_with_http_info(project_id, key_id, comment_create, opts) + nil + end + + # Create a comment + # Create a new comment for a key. + # @param project_id [String] Project ID + # @param key_id [String] Translation Key ID + # @param comment_create [CommentCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def comment_create_with_http_info(project_id, key_id, comment_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CommentsApi.comment_create ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling CommentsApi.comment_create" + end + # verify the required parameter 'key_id' is set + if @api_client.config.client_side_validation && key_id.nil? + fail ArgumentError, "Missing the required parameter 'key_id' when calling CommentsApi.comment_create" + end + # verify the required parameter 'comment_create' is set + if @api_client.config.client_side_validation && comment_create.nil? + fail ArgumentError, "Missing the required parameter 'comment_create' when calling CommentsApi.comment_create" + end + # resource path + local_var_path = '/projects/{project_id}/keys/{key_id}/comments'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'key_id' + '}', CGI.escape(key_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(comment_create) + + # return_type + return_type = opts[:return_type] + + # 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: CommentsApi#comment_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete a comment + # Delete an existing comment. + # @param project_id [String] Project ID + # @param key_id [String] Translation Key ID + # @param id [String] ID + # @param comment_delete [CommentDelete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def comment_delete(project_id, key_id, id, comment_delete, opts = {}) + comment_delete_with_http_info(project_id, key_id, id, comment_delete, opts) + nil + end + + # Delete a comment + # Delete an existing comment. + # @param project_id [String] Project ID + # @param key_id [String] Translation Key ID + # @param id [String] ID + # @param comment_delete [CommentDelete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def comment_delete_with_http_info(project_id, key_id, id, comment_delete, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CommentsApi.comment_delete ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling CommentsApi.comment_delete" + end + # verify the required parameter 'key_id' is set + if @api_client.config.client_side_validation && key_id.nil? + fail ArgumentError, "Missing the required parameter 'key_id' when calling CommentsApi.comment_delete" + 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 CommentsApi.comment_delete" + end + # verify the required parameter 'comment_delete' is set + if @api_client.config.client_side_validation && comment_delete.nil? + fail ArgumentError, "Missing the required parameter 'comment_delete' when calling CommentsApi.comment_delete" + end + # resource path + local_var_path = '/projects/{project_id}/keys/{key_id}/comments/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'key_id' + '}', CGI.escape(key_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(comment_delete) + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CommentsApi#comment_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Check if comment is read + # Check if comment was marked as read. Returns 204 if read, 404 if unread. + # @param project_id [String] Project ID + # @param key_id [String] Translation Key ID + # @param id [String] ID + # @param comment_mark_check [CommentMarkCheck] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def comment_mark_check(project_id, key_id, id, comment_mark_check, opts = {}) + comment_mark_check_with_http_info(project_id, key_id, id, comment_mark_check, opts) + nil + end + + # Check if comment is read + # Check if comment was marked as read. Returns 204 if read, 404 if unread. + # @param project_id [String] Project ID + # @param key_id [String] Translation Key ID + # @param id [String] ID + # @param comment_mark_check [CommentMarkCheck] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def comment_mark_check_with_http_info(project_id, key_id, id, comment_mark_check, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CommentsApi.comment_mark_check ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling CommentsApi.comment_mark_check" + end + # verify the required parameter 'key_id' is set + if @api_client.config.client_side_validation && key_id.nil? + fail ArgumentError, "Missing the required parameter 'key_id' when calling CommentsApi.comment_mark_check" + 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 CommentsApi.comment_mark_check" + end + # verify the required parameter 'comment_mark_check' is set + if @api_client.config.client_side_validation && comment_mark_check.nil? + fail ArgumentError, "Missing the required parameter 'comment_mark_check' when calling CommentsApi.comment_mark_check" + end + # resource path + local_var_path = '/projects/{project_id}/keys/{key_id}/comments/{id}/read'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'key_id' + '}', CGI.escape(key_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(comment_mark_check) + + # return_type + return_type = opts[:return_type] + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CommentsApi#comment_mark_check\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Mark a comment as read + # Mark a comment as read. + # @param project_id [String] Project ID + # @param key_id [String] Translation Key ID + # @param id [String] ID + # @param comment_mark_read [CommentMarkRead] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def comment_mark_read(project_id, key_id, id, comment_mark_read, opts = {}) + comment_mark_read_with_http_info(project_id, key_id, id, comment_mark_read, opts) + nil + end + + # Mark a comment as read + # Mark a comment as read. + # @param project_id [String] Project ID + # @param key_id [String] Translation Key ID + # @param id [String] ID + # @param comment_mark_read [CommentMarkRead] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def comment_mark_read_with_http_info(project_id, key_id, id, comment_mark_read, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CommentsApi.comment_mark_read ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling CommentsApi.comment_mark_read" + end + # verify the required parameter 'key_id' is set + if @api_client.config.client_side_validation && key_id.nil? + fail ArgumentError, "Missing the required parameter 'key_id' when calling CommentsApi.comment_mark_read" + 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 CommentsApi.comment_mark_read" + end + # verify the required parameter 'comment_mark_read' is set + if @api_client.config.client_side_validation && comment_mark_read.nil? + fail ArgumentError, "Missing the required parameter 'comment_mark_read' when calling CommentsApi.comment_mark_read" + end + # resource path + local_var_path = '/projects/{project_id}/keys/{key_id}/comments/{id}/read'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'key_id' + '}', CGI.escape(key_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(comment_mark_read) + + # return_type + return_type = opts[:return_type] + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CommentsApi#comment_mark_read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Mark a comment as unread + # Mark a comment as unread. + # @param project_id [String] Project ID + # @param key_id [String] Translation Key ID + # @param id [String] ID + # @param comment_mark_unread [CommentMarkUnread] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def comment_mark_unread(project_id, key_id, id, comment_mark_unread, opts = {}) + comment_mark_unread_with_http_info(project_id, key_id, id, comment_mark_unread, opts) + nil + end + + # Mark a comment as unread + # Mark a comment as unread. + # @param project_id [String] Project ID + # @param key_id [String] Translation Key ID + # @param id [String] ID + # @param comment_mark_unread [CommentMarkUnread] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def comment_mark_unread_with_http_info(project_id, key_id, id, comment_mark_unread, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CommentsApi.comment_mark_unread ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling CommentsApi.comment_mark_unread" + end + # verify the required parameter 'key_id' is set + if @api_client.config.client_side_validation && key_id.nil? + fail ArgumentError, "Missing the required parameter 'key_id' when calling CommentsApi.comment_mark_unread" + 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 CommentsApi.comment_mark_unread" + end + # verify the required parameter 'comment_mark_unread' is set + if @api_client.config.client_side_validation && comment_mark_unread.nil? + fail ArgumentError, "Missing the required parameter 'comment_mark_unread' when calling CommentsApi.comment_mark_unread" + end + # resource path + local_var_path = '/projects/{project_id}/keys/{key_id}/comments/{id}/read'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'key_id' + '}', CGI.escape(key_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(comment_mark_unread) + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CommentsApi#comment_mark_unread\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single comment + # Get details on a single comment. + # @param project_id [String] Project ID + # @param key_id [String] Translation Key ID + # @param id [String] ID + # @param comment_show [CommentShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Comment] + def comment_show(project_id, key_id, id, comment_show, opts = {}) + data, _status_code, _headers = comment_show_with_http_info(project_id, key_id, id, comment_show, opts) + data + end + + # Get a single comment + # Get details on a single comment. + # @param project_id [String] Project ID + # @param key_id [String] Translation Key ID + # @param id [String] ID + # @param comment_show [CommentShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Comment)>, Integer, Hash)>] Response<(Comment)> data, response status code and response headers + def comment_show_with_http_info(project_id, key_id, id, comment_show, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CommentsApi.comment_show ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling CommentsApi.comment_show" + end + # verify the required parameter 'key_id' is set + if @api_client.config.client_side_validation && key_id.nil? + fail ArgumentError, "Missing the required parameter 'key_id' when calling CommentsApi.comment_show" + 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 CommentsApi.comment_show" + end + # verify the required parameter 'comment_show' is set + if @api_client.config.client_side_validation && comment_show.nil? + fail ArgumentError, "Missing the required parameter 'comment_show' when calling CommentsApi.comment_show" + end + # resource path + local_var_path = '/projects/{project_id}/keys/{key_id}/comments/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'key_id' + '}', CGI.escape(key_id.to_s)).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(comment_show) + + # return_type + return_type = opts[:return_type] || 'Comment' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CommentsApi#comment_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update a comment + # Update an existing comment. + # @param project_id [String] Project ID + # @param key_id [String] Translation Key ID + # @param id [String] ID + # @param comment_update [CommentUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def comment_update(project_id, key_id, id, comment_update, opts = {}) + data, _status_code, _headers = comment_update_with_http_info(project_id, key_id, id, comment_update, opts) + data + end + + # Update a comment + # Update an existing comment. + # @param project_id [String] Project ID + # @param key_id [String] Translation Key ID + # @param id [String] ID + # @param comment_update [CommentUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def comment_update_with_http_info(project_id, key_id, id, comment_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CommentsApi.comment_update ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling CommentsApi.comment_update" + end + # verify the required parameter 'key_id' is set + if @api_client.config.client_side_validation && key_id.nil? + fail ArgumentError, "Missing the required parameter 'key_id' when calling CommentsApi.comment_update" + 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 CommentsApi.comment_update" + end + # verify the required parameter 'comment_update' is set + if @api_client.config.client_side_validation && comment_update.nil? + fail ArgumentError, "Missing the required parameter 'comment_update' when calling CommentsApi.comment_update" + end + # resource path + local_var_path = '/projects/{project_id}/keys/{key_id}/comments/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'key_id' + '}', CGI.escape(key_id.to_s)).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(comment_update) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CommentsApi#comment_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List comments + # List all comments for a key. + # @param project_id [String] Project ID + # @param key_id [String] Translation Key ID + # @param comments_list [CommentsList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def comments_list(project_id, key_id, comments_list, opts = {}) + data, _status_code, _headers = comments_list_with_http_info(project_id, key_id, comments_list, opts) + data + end + + # List comments + # List all comments for a key. + # @param project_id [String] Project ID + # @param key_id [String] Translation Key ID + # @param comments_list [CommentsList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def comments_list_with_http_info(project_id, key_id, comments_list, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CommentsApi.comments_list ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling CommentsApi.comments_list" + end + # verify the required parameter 'key_id' is set + if @api_client.config.client_side_validation && key_id.nil? + fail ArgumentError, "Missing the required parameter 'key_id' when calling CommentsApi.comments_list" + end + # verify the required parameter 'comments_list' is set + if @api_client.config.client_side_validation && comments_list.nil? + fail ArgumentError, "Missing the required parameter 'comments_list' when calling CommentsApi.comments_list" + end + # resource path + local_var_path = '/projects/{project_id}/keys/{key_id}/comments'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'key_id' + '}', CGI.escape(key_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # 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(comments_list) + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CommentsApi#comments_list\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/api/distributions_api.rb b/lib/Phrase/api/distributions_api.rb new file mode 100644 index 0000000..33ebcf5 --- /dev/null +++ b/lib/Phrase/api/distributions_api.rb @@ -0,0 +1,376 @@ +require 'cgi' + +module Phrase + class DistributionsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a distribution + # Create a new distribution. + # @param account_id [String] Account ID + # @param distribution_create [DistributionCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def distribution_create(account_id, distribution_create, opts = {}) + distribution_create_with_http_info(account_id, distribution_create, opts) + nil + end + + # Create a distribution + # Create a new distribution. + # @param account_id [String] Account ID + # @param distribution_create [DistributionCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def distribution_create_with_http_info(account_id, distribution_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DistributionsApi.distribution_create ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling DistributionsApi.distribution_create" + end + # verify the required parameter 'distribution_create' is set + if @api_client.config.client_side_validation && distribution_create.nil? + fail ArgumentError, "Missing the required parameter 'distribution_create' when calling DistributionsApi.distribution_create" + end + # resource path + local_var_path = '/accounts/{account_id}/distributions'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(distribution_create) + + # return_type + return_type = opts[:return_type] + + # 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: DistributionsApi#distribution_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete a distribution + # Delete an existing distribution. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def distribution_delete(account_id, id, opts = {}) + distribution_delete_with_http_info(account_id, id, opts) + nil + end + + # Delete a distribution + # Delete an existing distribution. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def distribution_delete_with_http_info(account_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DistributionsApi.distribution_delete ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling DistributionsApi.distribution_delete" + 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 DistributionsApi.distribution_delete" + end + # resource path + local_var_path = '/accounts/{account_id}/distributions/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + 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] + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DistributionsApi#distribution_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single distribution + # Get details on a single distribution. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Distribution] + def distribution_show(account_id, id, opts = {}) + data, _status_code, _headers = distribution_show_with_http_info(account_id, id, opts) + data + end + + # Get a single distribution + # Get details on a single distribution. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Distribution)>, Integer, Hash)>] Response<(Distribution)> data, response status code and response headers + def distribution_show_with_http_info(account_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DistributionsApi.distribution_show ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling DistributionsApi.distribution_show" + 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 DistributionsApi.distribution_show" + end + # resource path + local_var_path = '/accounts/{account_id}/distributions/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).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']) + 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] + + # return_type + return_type = opts[:return_type] || 'Distribution' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DistributionsApi#distribution_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update a distribution + # Update an existing distribution. + # @param account_id [String] Account ID + # @param id [String] ID + # @param distribution_update [DistributionUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def distribution_update(account_id, id, distribution_update, opts = {}) + data, _status_code, _headers = distribution_update_with_http_info(account_id, id, distribution_update, opts) + data + end + + # Update a distribution + # Update an existing distribution. + # @param account_id [String] Account ID + # @param id [String] ID + # @param distribution_update [DistributionUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def distribution_update_with_http_info(account_id, id, distribution_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DistributionsApi.distribution_update ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling DistributionsApi.distribution_update" + 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 DistributionsApi.distribution_update" + end + # verify the required parameter 'distribution_update' is set + if @api_client.config.client_side_validation && distribution_update.nil? + fail ArgumentError, "Missing the required parameter 'distribution_update' when calling DistributionsApi.distribution_update" + end + # resource path + local_var_path = '/accounts/{account_id}/distributions/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).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(distribution_update) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DistributionsApi#distribution_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List distributions + # List all distributions for the given account. + # @param account_id [String] Account ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def distributions_list(account_id, opts = {}) + data, _status_code, _headers = distributions_list_with_http_info(account_id, opts) + data + end + + # List distributions + # List all distributions for the given account. + # @param account_id [String] Account ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def distributions_list_with_http_info(account_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DistributionsApi.distributions_list ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling DistributionsApi.distributions_list" + end + # resource path + local_var_path = '/accounts/{account_id}/distributions'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['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] + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DistributionsApi#distributions_list\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/api/formats_api.rb b/lib/Phrase/api/formats_api.rb new file mode 100644 index 0000000..db08066 --- /dev/null +++ b/lib/Phrase/api/formats_api.rb @@ -0,0 +1,70 @@ +require 'cgi' + +module Phrase + class FormatsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # List formats + # Get a handy list of all localization file formats supported in Phrase. + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array] + def formats_list(opts = {}) + data, _status_code, _headers = formats_list_with_http_info(opts) + data + end + + # List formats + # Get a handy list of all localization file formats supported in Phrase. + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def formats_list_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FormatsApi.formats_list ...' + end + # resource path + local_var_path = '/formats' + + # 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']) + 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] + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FormatsApi#formats_list\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/api/git_lab_sync_api.rb b/lib/Phrase/api/git_lab_sync_api.rb new file mode 100644 index 0000000..f59ef3a --- /dev/null +++ b/lib/Phrase/api/git_lab_sync_api.rb @@ -0,0 +1,526 @@ +require 'cgi' + +module Phrase + class GitLabSyncApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Delete single Sync Setting + # Deletes a single GitLab Sync Setting. + # @param id [String] ID + # @param gitlab_sync_delete [GitlabSyncDelete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def gitlab_sync_delete(id, gitlab_sync_delete, opts = {}) + gitlab_sync_delete_with_http_info(id, gitlab_sync_delete, opts) + nil + end + + # Delete single Sync Setting + # Deletes a single GitLab Sync Setting. + # @param id [String] ID + # @param gitlab_sync_delete [GitlabSyncDelete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def gitlab_sync_delete_with_http_info(id, gitlab_sync_delete, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GitLabSyncApi.gitlab_sync_delete ...' + 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 GitLabSyncApi.gitlab_sync_delete" + end + # verify the required parameter 'gitlab_sync_delete' is set + if @api_client.config.client_side_validation && gitlab_sync_delete.nil? + fail ArgumentError, "Missing the required parameter 'gitlab_sync_delete' when calling GitLabSyncApi.gitlab_sync_delete" + end + # resource path + local_var_path = '/gitlab_syncs/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(gitlab_sync_delete) + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GitLabSyncApi#gitlab_sync_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Export from Phrase to GitLab + # Export translations from Phrase to GitLab according to the .phraseapp.yml file within the GitLab repository. + # @param gitlab_sync_id [String] Gitlab Sync ID + # @param gitlab_sync_export [GitlabSyncExport] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [GitlabSyncExport1] + def gitlab_sync_export(gitlab_sync_id, gitlab_sync_export, opts = {}) + data, _status_code, _headers = gitlab_sync_export_with_http_info(gitlab_sync_id, gitlab_sync_export, opts) + data + end + + # Export from Phrase to GitLab + # Export translations from Phrase to GitLab according to the .phraseapp.yml file within the GitLab repository. + # @param gitlab_sync_id [String] Gitlab Sync ID + # @param gitlab_sync_export [GitlabSyncExport] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(GitlabSyncExport1)>, Integer, Hash)>] Response<(GitlabSyncExport1)> data, response status code and response headers + def gitlab_sync_export_with_http_info(gitlab_sync_id, gitlab_sync_export, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GitLabSyncApi.gitlab_sync_export ...' + end + # verify the required parameter 'gitlab_sync_id' is set + if @api_client.config.client_side_validation && gitlab_sync_id.nil? + fail ArgumentError, "Missing the required parameter 'gitlab_sync_id' when calling GitLabSyncApi.gitlab_sync_export" + end + # verify the required parameter 'gitlab_sync_export' is set + if @api_client.config.client_side_validation && gitlab_sync_export.nil? + fail ArgumentError, "Missing the required parameter 'gitlab_sync_export' when calling GitLabSyncApi.gitlab_sync_export" + end + # resource path + local_var_path = '/gitlab_syncs/{gitlab_sync_id}/export'.sub('{' + 'gitlab_sync_id' + '}', CGI.escape(gitlab_sync_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(gitlab_sync_export) + + # return_type + return_type = opts[:return_type] || 'GitlabSyncExport1' + + # 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: GitLabSyncApi#gitlab_sync_export\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # History of single Sync Setting + # List history for a single Sync Setting. + # @param gitlab_sync_id [String] Gitlab Sync ID + # @param gitlab_sync_history [GitlabSyncHistory] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def gitlab_sync_history(gitlab_sync_id, gitlab_sync_history, opts = {}) + data, _status_code, _headers = gitlab_sync_history_with_http_info(gitlab_sync_id, gitlab_sync_history, opts) + data + end + + # History of single Sync Setting + # List history for a single Sync Setting. + # @param gitlab_sync_id [String] Gitlab Sync ID + # @param gitlab_sync_history [GitlabSyncHistory] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def gitlab_sync_history_with_http_info(gitlab_sync_id, gitlab_sync_history, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GitLabSyncApi.gitlab_sync_history ...' + end + # verify the required parameter 'gitlab_sync_id' is set + if @api_client.config.client_side_validation && gitlab_sync_id.nil? + fail ArgumentError, "Missing the required parameter 'gitlab_sync_id' when calling GitLabSyncApi.gitlab_sync_history" + end + # verify the required parameter 'gitlab_sync_history' is set + if @api_client.config.client_side_validation && gitlab_sync_history.nil? + fail ArgumentError, "Missing the required parameter 'gitlab_sync_history' when calling GitLabSyncApi.gitlab_sync_history" + end + # resource path + local_var_path = '/gitlab_syncs/{gitlab_sync_id}/history'.sub('{' + 'gitlab_sync_id' + '}', CGI.escape(gitlab_sync_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # 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(gitlab_sync_history) + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GitLabSyncApi#gitlab_sync_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Import from GitLab to Phrase + # Import translations from GitLab to Phrase according to the .phraseapp.yml file within the GitLab repository. + # @param gitlab_sync_id [String] Gitlab Sync ID + # @param gitlab_sync_import [GitlabSyncImport] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array] + def gitlab_sync_import(gitlab_sync_id, gitlab_sync_import, opts = {}) + data, _status_code, _headers = gitlab_sync_import_with_http_info(gitlab_sync_id, gitlab_sync_import, opts) + data + end + + # Import from GitLab to Phrase + # Import translations from GitLab to Phrase according to the .phraseapp.yml file within the GitLab repository. + # @param gitlab_sync_id [String] Gitlab Sync ID + # @param gitlab_sync_import [GitlabSyncImport] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def gitlab_sync_import_with_http_info(gitlab_sync_id, gitlab_sync_import, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GitLabSyncApi.gitlab_sync_import ...' + end + # verify the required parameter 'gitlab_sync_id' is set + if @api_client.config.client_side_validation && gitlab_sync_id.nil? + fail ArgumentError, "Missing the required parameter 'gitlab_sync_id' when calling GitLabSyncApi.gitlab_sync_import" + end + # verify the required parameter 'gitlab_sync_import' is set + if @api_client.config.client_side_validation && gitlab_sync_import.nil? + fail ArgumentError, "Missing the required parameter 'gitlab_sync_import' when calling GitLabSyncApi.gitlab_sync_import" + end + # resource path + local_var_path = '/gitlab_syncs/{gitlab_sync_id}/import'.sub('{' + 'gitlab_sync_id' + '}', CGI.escape(gitlab_sync_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(gitlab_sync_import) + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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: GitLabSyncApi#gitlab_sync_import\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List GitLab syncs + # List all GitLab Sync Settings for which synchronisation with Phrase and GitLab is activated. + # @param gitlab_sync_list [GitlabSyncList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array] + def gitlab_sync_list(gitlab_sync_list, opts = {}) + data, _status_code, _headers = gitlab_sync_list_with_http_info(gitlab_sync_list, opts) + data + end + + # List GitLab syncs + # List all GitLab Sync Settings for which synchronisation with Phrase and GitLab is activated. + # @param gitlab_sync_list [GitlabSyncList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def gitlab_sync_list_with_http_info(gitlab_sync_list, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GitLabSyncApi.gitlab_sync_list ...' + end + # verify the required parameter 'gitlab_sync_list' is set + if @api_client.config.client_side_validation && gitlab_sync_list.nil? + fail ArgumentError, "Missing the required parameter 'gitlab_sync_list' when calling GitLabSyncApi.gitlab_sync_list" + end + # resource path + local_var_path = '/gitlab_syncs' + + # 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(gitlab_sync_list) + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GitLabSyncApi#gitlab_sync_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get single Sync Setting + # Shows a single GitLab Sync Setting. + # @param id [String] ID + # @param gitlab_sync_show [GitlabSyncShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [GitlabSync] + def gitlab_sync_show(id, gitlab_sync_show, opts = {}) + data, _status_code, _headers = gitlab_sync_show_with_http_info(id, gitlab_sync_show, opts) + data + end + + # Get single Sync Setting + # Shows a single GitLab Sync Setting. + # @param id [String] ID + # @param gitlab_sync_show [GitlabSyncShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(GitlabSync)>, Integer, Hash)>] Response<(GitlabSync)> data, response status code and response headers + def gitlab_sync_show_with_http_info(id, gitlab_sync_show, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GitLabSyncApi.gitlab_sync_show ...' + 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 GitLabSyncApi.gitlab_sync_show" + end + # verify the required parameter 'gitlab_sync_show' is set + if @api_client.config.client_side_validation && gitlab_sync_show.nil? + fail ArgumentError, "Missing the required parameter 'gitlab_sync_show' when calling GitLabSyncApi.gitlab_sync_show" + end + # resource path + local_var_path = '/gitlab_syncs/{id}'.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(gitlab_sync_show) + + # return_type + return_type = opts[:return_type] || 'GitlabSync' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GitLabSyncApi#gitlab_sync_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update single Sync Setting + # Updates a single GitLab Sync Setting. + # @param id [String] ID + # @param gitlab_sync_update [GitlabSyncUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def gitlab_sync_update(id, gitlab_sync_update, opts = {}) + data, _status_code, _headers = gitlab_sync_update_with_http_info(id, gitlab_sync_update, opts) + data + end + + # Update single Sync Setting + # Updates a single GitLab Sync Setting. + # @param id [String] ID + # @param gitlab_sync_update [GitlabSyncUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def gitlab_sync_update_with_http_info(id, gitlab_sync_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GitLabSyncApi.gitlab_sync_update ...' + 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 GitLabSyncApi.gitlab_sync_update" + end + # verify the required parameter 'gitlab_sync_update' is set + if @api_client.config.client_side_validation && gitlab_sync_update.nil? + fail ArgumentError, "Missing the required parameter 'gitlab_sync_update' when calling GitLabSyncApi.gitlab_sync_update" + end + # resource path + local_var_path = '/gitlab_syncs/{id}'.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(gitlab_sync_update) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GitLabSyncApi#gitlab_sync_update\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/api/glossary_api.rb b/lib/Phrase/api/glossary_api.rb new file mode 100644 index 0000000..d7e2042 --- /dev/null +++ b/lib/Phrase/api/glossary_api.rb @@ -0,0 +1,376 @@ +require 'cgi' + +module Phrase + class GlossaryApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # List glossaries + # List all glossaries the current user has access to. + # @param account_id [String] Account ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def glossaries_list(account_id, opts = {}) + data, _status_code, _headers = glossaries_list_with_http_info(account_id, opts) + data + end + + # List glossaries + # List all glossaries the current user has access to. + # @param account_id [String] Account ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def glossaries_list_with_http_info(account_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GlossaryApi.glossaries_list ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling GlossaryApi.glossaries_list" + end + # resource path + local_var_path = '/accounts/{account_id}/glossaries'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['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] + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GlossaryApi#glossaries_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Create a glossary + # Create a new glossary. + # @param account_id [String] Account ID + # @param glossary_create [GlossaryCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def glossary_create(account_id, glossary_create, opts = {}) + glossary_create_with_http_info(account_id, glossary_create, opts) + nil + end + + # Create a glossary + # Create a new glossary. + # @param account_id [String] Account ID + # @param glossary_create [GlossaryCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def glossary_create_with_http_info(account_id, glossary_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GlossaryApi.glossary_create ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling GlossaryApi.glossary_create" + end + # verify the required parameter 'glossary_create' is set + if @api_client.config.client_side_validation && glossary_create.nil? + fail ArgumentError, "Missing the required parameter 'glossary_create' when calling GlossaryApi.glossary_create" + end + # resource path + local_var_path = '/accounts/{account_id}/glossaries'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(glossary_create) + + # return_type + return_type = opts[:return_type] + + # 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: GlossaryApi#glossary_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete a glossary + # Delete an existing glossary. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def glossary_delete(account_id, id, opts = {}) + glossary_delete_with_http_info(account_id, id, opts) + nil + end + + # Delete a glossary + # Delete an existing glossary. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def glossary_delete_with_http_info(account_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GlossaryApi.glossary_delete ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling GlossaryApi.glossary_delete" + 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 GlossaryApi.glossary_delete" + end + # resource path + local_var_path = '/accounts/{account_id}/glossaries/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + 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] + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GlossaryApi#glossary_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single glossary + # Get details on a single glossary. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Glossary] + def glossary_show(account_id, id, opts = {}) + data, _status_code, _headers = glossary_show_with_http_info(account_id, id, opts) + data + end + + # Get a single glossary + # Get details on a single glossary. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Glossary)>, Integer, Hash)>] Response<(Glossary)> data, response status code and response headers + def glossary_show_with_http_info(account_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GlossaryApi.glossary_show ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling GlossaryApi.glossary_show" + 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 GlossaryApi.glossary_show" + end + # resource path + local_var_path = '/accounts/{account_id}/glossaries/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).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']) + 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] + + # return_type + return_type = opts[:return_type] || 'Glossary' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GlossaryApi#glossary_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update a glossary + # Update an existing glossary. + # @param account_id [String] Account ID + # @param id [String] ID + # @param glossary_update [GlossaryUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def glossary_update(account_id, id, glossary_update, opts = {}) + data, _status_code, _headers = glossary_update_with_http_info(account_id, id, glossary_update, opts) + data + end + + # Update a glossary + # Update an existing glossary. + # @param account_id [String] Account ID + # @param id [String] ID + # @param glossary_update [GlossaryUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def glossary_update_with_http_info(account_id, id, glossary_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GlossaryApi.glossary_update ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling GlossaryApi.glossary_update" + 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 GlossaryApi.glossary_update" + end + # verify the required parameter 'glossary_update' is set + if @api_client.config.client_side_validation && glossary_update.nil? + fail ArgumentError, "Missing the required parameter 'glossary_update' when calling GlossaryApi.glossary_update" + end + # resource path + local_var_path = '/accounts/{account_id}/glossaries/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).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(glossary_update) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GlossaryApi#glossary_update\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/api/glossary_term_translations_api.rb b/lib/Phrase/api/glossary_term_translations_api.rb new file mode 100644 index 0000000..01396fb --- /dev/null +++ b/lib/Phrase/api/glossary_term_translations_api.rb @@ -0,0 +1,268 @@ +require 'cgi' + +module Phrase + class GlossaryTermTranslationsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a glossary term translation + # Create a new glossary term translation. + # @param account_id [String] Account ID + # @param glossary_id [String] Glossary ID + # @param term_id [String] Term ID + # @param glossary_term_translation_create [GlossaryTermTranslationCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def glossary_term_translation_create(account_id, glossary_id, term_id, glossary_term_translation_create, opts = {}) + glossary_term_translation_create_with_http_info(account_id, glossary_id, term_id, glossary_term_translation_create, opts) + nil + end + + # Create a glossary term translation + # Create a new glossary term translation. + # @param account_id [String] Account ID + # @param glossary_id [String] Glossary ID + # @param term_id [String] Term ID + # @param glossary_term_translation_create [GlossaryTermTranslationCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def glossary_term_translation_create_with_http_info(account_id, glossary_id, term_id, glossary_term_translation_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GlossaryTermTranslationsApi.glossary_term_translation_create ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling GlossaryTermTranslationsApi.glossary_term_translation_create" + end + # verify the required parameter 'glossary_id' is set + if @api_client.config.client_side_validation && glossary_id.nil? + fail ArgumentError, "Missing the required parameter 'glossary_id' when calling GlossaryTermTranslationsApi.glossary_term_translation_create" + end + # verify the required parameter 'term_id' is set + if @api_client.config.client_side_validation && term_id.nil? + fail ArgumentError, "Missing the required parameter 'term_id' when calling GlossaryTermTranslationsApi.glossary_term_translation_create" + end + # verify the required parameter 'glossary_term_translation_create' is set + if @api_client.config.client_side_validation && glossary_term_translation_create.nil? + fail ArgumentError, "Missing the required parameter 'glossary_term_translation_create' when calling GlossaryTermTranslationsApi.glossary_term_translation_create" + end + # resource path + local_var_path = '/accounts/{account_id}/glossaries/{glossary_id}/terms/{term_id}/translations'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'glossary_id' + '}', CGI.escape(glossary_id.to_s)).sub('{' + 'term_id' + '}', CGI.escape(term_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(glossary_term_translation_create) + + # return_type + return_type = opts[:return_type] + + # 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: GlossaryTermTranslationsApi#glossary_term_translation_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete a glossary term translation + # Delete an existing glossary term translation. + # @param account_id [String] Account ID + # @param glossary_id [String] Glossary ID + # @param term_id [String] Term ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def glossary_term_translation_delete(account_id, glossary_id, term_id, id, opts = {}) + glossary_term_translation_delete_with_http_info(account_id, glossary_id, term_id, id, opts) + nil + end + + # Delete a glossary term translation + # Delete an existing glossary term translation. + # @param account_id [String] Account ID + # @param glossary_id [String] Glossary ID + # @param term_id [String] Term ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def glossary_term_translation_delete_with_http_info(account_id, glossary_id, term_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GlossaryTermTranslationsApi.glossary_term_translation_delete ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling GlossaryTermTranslationsApi.glossary_term_translation_delete" + end + # verify the required parameter 'glossary_id' is set + if @api_client.config.client_side_validation && glossary_id.nil? + fail ArgumentError, "Missing the required parameter 'glossary_id' when calling GlossaryTermTranslationsApi.glossary_term_translation_delete" + end + # verify the required parameter 'term_id' is set + if @api_client.config.client_side_validation && term_id.nil? + fail ArgumentError, "Missing the required parameter 'term_id' when calling GlossaryTermTranslationsApi.glossary_term_translation_delete" + 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 GlossaryTermTranslationsApi.glossary_term_translation_delete" + end + # resource path + local_var_path = '/accounts/{account_id}/glossaries/{glossary_id}/terms/{term_id}/translations/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'glossary_id' + '}', CGI.escape(glossary_id.to_s)).sub('{' + 'term_id' + '}', CGI.escape(term_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + 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] + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GlossaryTermTranslationsApi#glossary_term_translation_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update a glossary term translation + # Update an existing glossary term translation. + # @param account_id [String] Account ID + # @param glossary_id [String] Glossary ID + # @param term_id [String] Term ID + # @param id [String] ID + # @param glossary_term_translation_update [GlossaryTermTranslationUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [GlossaryTermTranslation] + def glossary_term_translation_update(account_id, glossary_id, term_id, id, glossary_term_translation_update, opts = {}) + data, _status_code, _headers = glossary_term_translation_update_with_http_info(account_id, glossary_id, term_id, id, glossary_term_translation_update, opts) + data + end + + # Update a glossary term translation + # Update an existing glossary term translation. + # @param account_id [String] Account ID + # @param glossary_id [String] Glossary ID + # @param term_id [String] Term ID + # @param id [String] ID + # @param glossary_term_translation_update [GlossaryTermTranslationUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(GlossaryTermTranslation)>, Integer, Hash)>] Response<(GlossaryTermTranslation)> data, response status code and response headers + def glossary_term_translation_update_with_http_info(account_id, glossary_id, term_id, id, glossary_term_translation_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GlossaryTermTranslationsApi.glossary_term_translation_update ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling GlossaryTermTranslationsApi.glossary_term_translation_update" + end + # verify the required parameter 'glossary_id' is set + if @api_client.config.client_side_validation && glossary_id.nil? + fail ArgumentError, "Missing the required parameter 'glossary_id' when calling GlossaryTermTranslationsApi.glossary_term_translation_update" + end + # verify the required parameter 'term_id' is set + if @api_client.config.client_side_validation && term_id.nil? + fail ArgumentError, "Missing the required parameter 'term_id' when calling GlossaryTermTranslationsApi.glossary_term_translation_update" + 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 GlossaryTermTranslationsApi.glossary_term_translation_update" + end + # verify the required parameter 'glossary_term_translation_update' is set + if @api_client.config.client_side_validation && glossary_term_translation_update.nil? + fail ArgumentError, "Missing the required parameter 'glossary_term_translation_update' when calling GlossaryTermTranslationsApi.glossary_term_translation_update" + end + # resource path + local_var_path = '/accounts/{account_id}/glossaries/{glossary_id}/terms/{term_id}/translations/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'glossary_id' + '}', CGI.escape(glossary_id.to_s)).sub('{' + 'term_id' + '}', CGI.escape(term_id.to_s)).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(glossary_term_translation_update) + + # return_type + return_type = opts[:return_type] || 'GlossaryTermTranslation' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GlossaryTermTranslationsApi#glossary_term_translation_update\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/api/glossary_terms_api.rb b/lib/Phrase/api/glossary_terms_api.rb new file mode 100644 index 0000000..02adc35 --- /dev/null +++ b/lib/Phrase/api/glossary_terms_api.rb @@ -0,0 +1,406 @@ +require 'cgi' + +module Phrase + class GlossaryTermsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a glossary term + # Create a new glossary term. + # @param account_id [String] Account ID + # @param glossary_id [String] Glossary ID + # @param glossary_term_create [GlossaryTermCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def glossary_term_create(account_id, glossary_id, glossary_term_create, opts = {}) + glossary_term_create_with_http_info(account_id, glossary_id, glossary_term_create, opts) + nil + end + + # Create a glossary term + # Create a new glossary term. + # @param account_id [String] Account ID + # @param glossary_id [String] Glossary ID + # @param glossary_term_create [GlossaryTermCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def glossary_term_create_with_http_info(account_id, glossary_id, glossary_term_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GlossaryTermsApi.glossary_term_create ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling GlossaryTermsApi.glossary_term_create" + end + # verify the required parameter 'glossary_id' is set + if @api_client.config.client_side_validation && glossary_id.nil? + fail ArgumentError, "Missing the required parameter 'glossary_id' when calling GlossaryTermsApi.glossary_term_create" + end + # verify the required parameter 'glossary_term_create' is set + if @api_client.config.client_side_validation && glossary_term_create.nil? + fail ArgumentError, "Missing the required parameter 'glossary_term_create' when calling GlossaryTermsApi.glossary_term_create" + end + # resource path + local_var_path = '/accounts/{account_id}/glossaries/{glossary_id}/terms'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'glossary_id' + '}', CGI.escape(glossary_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(glossary_term_create) + + # return_type + return_type = opts[:return_type] + + # 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: GlossaryTermsApi#glossary_term_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete a glossary term + # Delete an existing glossary term. + # @param account_id [String] Account ID + # @param glossary_id [String] Glossary ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def glossary_term_delete(account_id, glossary_id, id, opts = {}) + glossary_term_delete_with_http_info(account_id, glossary_id, id, opts) + nil + end + + # Delete a glossary term + # Delete an existing glossary term. + # @param account_id [String] Account ID + # @param glossary_id [String] Glossary ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def glossary_term_delete_with_http_info(account_id, glossary_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GlossaryTermsApi.glossary_term_delete ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling GlossaryTermsApi.glossary_term_delete" + end + # verify the required parameter 'glossary_id' is set + if @api_client.config.client_side_validation && glossary_id.nil? + fail ArgumentError, "Missing the required parameter 'glossary_id' when calling GlossaryTermsApi.glossary_term_delete" + 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 GlossaryTermsApi.glossary_term_delete" + end + # resource path + local_var_path = '/accounts/{account_id}/glossaries/{glossary_id}/terms/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'glossary_id' + '}', CGI.escape(glossary_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + 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] + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GlossaryTermsApi#glossary_term_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single glossary term + # Get details on a single glossary term. + # @param account_id [String] Account ID + # @param glossary_id [String] Glossary ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [GlossaryTerm] + def glossary_term_show(account_id, glossary_id, id, opts = {}) + data, _status_code, _headers = glossary_term_show_with_http_info(account_id, glossary_id, id, opts) + data + end + + # Get a single glossary term + # Get details on a single glossary term. + # @param account_id [String] Account ID + # @param glossary_id [String] Glossary ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(GlossaryTerm)>, Integer, Hash)>] Response<(GlossaryTerm)> data, response status code and response headers + def glossary_term_show_with_http_info(account_id, glossary_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GlossaryTermsApi.glossary_term_show ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling GlossaryTermsApi.glossary_term_show" + end + # verify the required parameter 'glossary_id' is set + if @api_client.config.client_side_validation && glossary_id.nil? + fail ArgumentError, "Missing the required parameter 'glossary_id' when calling GlossaryTermsApi.glossary_term_show" + 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 GlossaryTermsApi.glossary_term_show" + end + # resource path + local_var_path = '/accounts/{account_id}/glossaries/{glossary_id}/terms/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'glossary_id' + '}', CGI.escape(glossary_id.to_s)).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']) + 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] + + # return_type + return_type = opts[:return_type] || 'GlossaryTerm' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GlossaryTermsApi#glossary_term_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update a glossary term + # Update an existing glossary term. + # @param account_id [String] Account ID + # @param glossary_id [String] Glossary ID + # @param id [String] ID + # @param glossary_term_update [GlossaryTermUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def glossary_term_update(account_id, glossary_id, id, glossary_term_update, opts = {}) + data, _status_code, _headers = glossary_term_update_with_http_info(account_id, glossary_id, id, glossary_term_update, opts) + data + end + + # Update a glossary term + # Update an existing glossary term. + # @param account_id [String] Account ID + # @param glossary_id [String] Glossary ID + # @param id [String] ID + # @param glossary_term_update [GlossaryTermUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def glossary_term_update_with_http_info(account_id, glossary_id, id, glossary_term_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GlossaryTermsApi.glossary_term_update ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling GlossaryTermsApi.glossary_term_update" + end + # verify the required parameter 'glossary_id' is set + if @api_client.config.client_side_validation && glossary_id.nil? + fail ArgumentError, "Missing the required parameter 'glossary_id' when calling GlossaryTermsApi.glossary_term_update" + 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 GlossaryTermsApi.glossary_term_update" + end + # verify the required parameter 'glossary_term_update' is set + if @api_client.config.client_side_validation && glossary_term_update.nil? + fail ArgumentError, "Missing the required parameter 'glossary_term_update' when calling GlossaryTermsApi.glossary_term_update" + end + # resource path + local_var_path = '/accounts/{account_id}/glossaries/{glossary_id}/terms/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'glossary_id' + '}', CGI.escape(glossary_id.to_s)).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(glossary_term_update) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GlossaryTermsApi#glossary_term_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List glossary terms + # List all glossary terms the current user has access to. + # @param account_id [String] Account ID + # @param glossary_id [String] Glossary ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def glossary_terms_list(account_id, glossary_id, opts = {}) + data, _status_code, _headers = glossary_terms_list_with_http_info(account_id, glossary_id, opts) + data + end + + # List glossary terms + # List all glossary terms the current user has access to. + # @param account_id [String] Account ID + # @param glossary_id [String] Glossary ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def glossary_terms_list_with_http_info(account_id, glossary_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: GlossaryTermsApi.glossary_terms_list ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling GlossaryTermsApi.glossary_terms_list" + end + # verify the required parameter 'glossary_id' is set + if @api_client.config.client_side_validation && glossary_id.nil? + fail ArgumentError, "Missing the required parameter 'glossary_id' when calling GlossaryTermsApi.glossary_terms_list" + end + # resource path + local_var_path = '/accounts/{account_id}/glossaries/{glossary_id}/terms'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'glossary_id' + '}', CGI.escape(glossary_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['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] + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: GlossaryTermsApi#glossary_terms_list\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/api/invitations_api.rb b/lib/Phrase/api/invitations_api.rb new file mode 100644 index 0000000..d0cabbc --- /dev/null +++ b/lib/Phrase/api/invitations_api.rb @@ -0,0 +1,448 @@ +require 'cgi' + +module Phrase + class InvitationsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a new invitation + # Invite a person to an account. Developers and translators need project_ids and locale_ids assigned to access them. Access token scope must include team.manage. + # @param account_id [String] Account ID + # @param invitation_create [InvitationCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def invitation_create(account_id, invitation_create, opts = {}) + invitation_create_with_http_info(account_id, invitation_create, opts) + nil + end + + # Create a new invitation + # Invite a person to an account. Developers and translators need <code>project_ids</code> and <code>locale_ids</code> assigned to access them. Access token scope must include <code>team.manage</code>. + # @param account_id [String] Account ID + # @param invitation_create [InvitationCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def invitation_create_with_http_info(account_id, invitation_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: InvitationsApi.invitation_create ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling InvitationsApi.invitation_create" + end + # verify the required parameter 'invitation_create' is set + if @api_client.config.client_side_validation && invitation_create.nil? + fail ArgumentError, "Missing the required parameter 'invitation_create' when calling InvitationsApi.invitation_create" + end + # resource path + local_var_path = '/accounts/{account_id}/invitations'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(invitation_create) + + # return_type + return_type = opts[:return_type] + + # 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: InvitationsApi#invitation_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete an invitation + # Delete an existing invitation (must not be accepted yet). Access token scope must include team.manage. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def invitation_delete(account_id, id, opts = {}) + invitation_delete_with_http_info(account_id, id, opts) + nil + end + + # Delete an invitation + # Delete an existing invitation (must not be accepted yet). Access token scope must include <code>team.manage</code>. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def invitation_delete_with_http_info(account_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: InvitationsApi.invitation_delete ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling InvitationsApi.invitation_delete" + 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 InvitationsApi.invitation_delete" + end + # resource path + local_var_path = '/accounts/{account_id}/invitations/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + 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] + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: InvitationsApi#invitation_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Resend an invitation + # Resend the invitation email (must not be accepted yet). Access token scope must include team.manage. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def invitation_resend(account_id, id, opts = {}) + data, _status_code, _headers = invitation_resend_with_http_info(account_id, id, opts) + data + end + + # Resend an invitation + # Resend the invitation email (must not be accepted yet). Access token scope must include <code>team.manage</code>. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def invitation_resend_with_http_info(account_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: InvitationsApi.invitation_resend ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling InvitationsApi.invitation_resend" + 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 InvitationsApi.invitation_resend" + end + # resource path + local_var_path = '/accounts/{account_id}/invitations/{id}/resend'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).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']) + 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] + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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: InvitationsApi#invitation_resend\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single invitation + # Get details on a single invitation. Access token scope must include team.manage. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Invitation] + def invitation_show(account_id, id, opts = {}) + data, _status_code, _headers = invitation_show_with_http_info(account_id, id, opts) + data + end + + # Get a single invitation + # Get details on a single invitation. Access token scope must include <code>team.manage</code>. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Invitation)>, Integer, Hash)>] Response<(Invitation)> data, response status code and response headers + def invitation_show_with_http_info(account_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: InvitationsApi.invitation_show ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling InvitationsApi.invitation_show" + 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 InvitationsApi.invitation_show" + end + # resource path + local_var_path = '/accounts/{account_id}/invitations/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).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']) + 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] + + # return_type + return_type = opts[:return_type] || 'Invitation' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: InvitationsApi#invitation_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update an invitation + # Update an existing invitation (must not be accepted yet). The email cannot be updated. Developers and translators need project_ids and locale_ids assigned to access them. Access token scope must include team.manage. + # @param account_id [String] Account ID + # @param id [String] ID + # @param invitation_update [InvitationUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def invitation_update(account_id, id, invitation_update, opts = {}) + data, _status_code, _headers = invitation_update_with_http_info(account_id, id, invitation_update, opts) + data + end + + # Update an invitation + # Update an existing invitation (must not be accepted yet). The <code>email</code> cannot be updated. Developers and translators need <code>project_ids</code> and <code>locale_ids</code> assigned to access them. Access token scope must include <code>team.manage</code>. + # @param account_id [String] Account ID + # @param id [String] ID + # @param invitation_update [InvitationUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def invitation_update_with_http_info(account_id, id, invitation_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: InvitationsApi.invitation_update ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling InvitationsApi.invitation_update" + 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 InvitationsApi.invitation_update" + end + # verify the required parameter 'invitation_update' is set + if @api_client.config.client_side_validation && invitation_update.nil? + fail ArgumentError, "Missing the required parameter 'invitation_update' when calling InvitationsApi.invitation_update" + end + # resource path + local_var_path = '/accounts/{account_id}/invitations/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).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(invitation_update) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: InvitationsApi#invitation_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List invitations + # List invitations for an account. It will also list the accessible resources like projects and locales the invited user has access to. In case nothing is shown the default access from the role is used. Access token scope must include team.manage. + # @param account_id [String] Account ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def invitations_list(account_id, opts = {}) + data, _status_code, _headers = invitations_list_with_http_info(account_id, opts) + data + end + + # List invitations + # List invitations for an account. It will also list the accessible resources like projects and locales the invited user has access to. In case nothing is shown the default access from the role is used. Access token scope must include <code>team.manage</code>. + # @param account_id [String] Account ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def invitations_list_with_http_info(account_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: InvitationsApi.invitations_list ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling InvitationsApi.invitations_list" + end + # resource path + local_var_path = '/accounts/{account_id}/invitations'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['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] + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: InvitationsApi#invitations_list\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/api/job_locales_api.rb b/lib/Phrase/api/job_locales_api.rb new file mode 100644 index 0000000..707113e --- /dev/null +++ b/lib/Phrase/api/job_locales_api.rb @@ -0,0 +1,602 @@ +require 'cgi' + +module Phrase + class JobLocalesApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Complete a job locale + # Mark a job locale as completed. + # @param project_id [String] Project ID + # @param job_id [String] Job ID + # @param id [String] ID + # @param job_locale_complete [JobLocaleComplete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def job_locale_complete(project_id, job_id, id, job_locale_complete, opts = {}) + data, _status_code, _headers = job_locale_complete_with_http_info(project_id, job_id, id, job_locale_complete, opts) + data + end + + # Complete a job locale + # Mark a job locale as completed. + # @param project_id [String] Project ID + # @param job_id [String] Job ID + # @param id [String] ID + # @param job_locale_complete [JobLocaleComplete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def job_locale_complete_with_http_info(project_id, job_id, id, job_locale_complete, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: JobLocalesApi.job_locale_complete ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling JobLocalesApi.job_locale_complete" + end + # verify the required parameter 'job_id' is set + if @api_client.config.client_side_validation && job_id.nil? + fail ArgumentError, "Missing the required parameter 'job_id' when calling JobLocalesApi.job_locale_complete" + 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 JobLocalesApi.job_locale_complete" + end + # verify the required parameter 'job_locale_complete' is set + if @api_client.config.client_side_validation && job_locale_complete.nil? + fail ArgumentError, "Missing the required parameter 'job_locale_complete' when calling JobLocalesApi.job_locale_complete" + end + # resource path + local_var_path = '/projects/{project_id}/jobs/{job_id}/locales/{id}/complete'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s)).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(job_locale_complete) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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: JobLocalesApi#job_locale_complete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete a job locale + # Delete an existing job locale. + # @param project_id [String] Project ID + # @param job_id [String] Job ID + # @param id [String] ID + # @param job_locale_delete [JobLocaleDelete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def job_locale_delete(project_id, job_id, id, job_locale_delete, opts = {}) + job_locale_delete_with_http_info(project_id, job_id, id, job_locale_delete, opts) + nil + end + + # Delete a job locale + # Delete an existing job locale. + # @param project_id [String] Project ID + # @param job_id [String] Job ID + # @param id [String] ID + # @param job_locale_delete [JobLocaleDelete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def job_locale_delete_with_http_info(project_id, job_id, id, job_locale_delete, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: JobLocalesApi.job_locale_delete ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling JobLocalesApi.job_locale_delete" + end + # verify the required parameter 'job_id' is set + if @api_client.config.client_side_validation && job_id.nil? + fail ArgumentError, "Missing the required parameter 'job_id' when calling JobLocalesApi.job_locale_delete" + 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 JobLocalesApi.job_locale_delete" + end + # verify the required parameter 'job_locale_delete' is set + if @api_client.config.client_side_validation && job_locale_delete.nil? + fail ArgumentError, "Missing the required parameter 'job_locale_delete' when calling JobLocalesApi.job_locale_delete" + end + # resource path + local_var_path = '/projects/{project_id}/jobs/{job_id}/locales/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(job_locale_delete) + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: JobLocalesApi#job_locale_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Reopen a job locale + # Mark a job locale as uncompleted. + # @param project_id [String] Project ID + # @param job_id [String] Job ID + # @param id [String] ID + # @param job_locale_reopen [JobLocaleReopen] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def job_locale_reopen(project_id, job_id, id, job_locale_reopen, opts = {}) + data, _status_code, _headers = job_locale_reopen_with_http_info(project_id, job_id, id, job_locale_reopen, opts) + data + end + + # Reopen a job locale + # Mark a job locale as uncompleted. + # @param project_id [String] Project ID + # @param job_id [String] Job ID + # @param id [String] ID + # @param job_locale_reopen [JobLocaleReopen] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def job_locale_reopen_with_http_info(project_id, job_id, id, job_locale_reopen, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: JobLocalesApi.job_locale_reopen ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling JobLocalesApi.job_locale_reopen" + end + # verify the required parameter 'job_id' is set + if @api_client.config.client_side_validation && job_id.nil? + fail ArgumentError, "Missing the required parameter 'job_id' when calling JobLocalesApi.job_locale_reopen" + 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 JobLocalesApi.job_locale_reopen" + end + # verify the required parameter 'job_locale_reopen' is set + if @api_client.config.client_side_validation && job_locale_reopen.nil? + fail ArgumentError, "Missing the required parameter 'job_locale_reopen' when calling JobLocalesApi.job_locale_reopen" + end + # resource path + local_var_path = '/projects/{project_id}/jobs/{job_id}/locales/{id}/reopen'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s)).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(job_locale_reopen) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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: JobLocalesApi#job_locale_reopen\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single job locale + # Get a single job locale for a given job. + # @param project_id [String] Project ID + # @param job_id [String] Job ID + # @param id [String] ID + # @param job_locale_show [JobLocaleShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [JobLocale] + def job_locale_show(project_id, job_id, id, job_locale_show, opts = {}) + data, _status_code, _headers = job_locale_show_with_http_info(project_id, job_id, id, job_locale_show, opts) + data + end + + # Get a single job locale + # Get a single job locale for a given job. + # @param project_id [String] Project ID + # @param job_id [String] Job ID + # @param id [String] ID + # @param job_locale_show [JobLocaleShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(JobLocale)>, Integer, Hash)>] Response<(JobLocale)> data, response status code and response headers + def job_locale_show_with_http_info(project_id, job_id, id, job_locale_show, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: JobLocalesApi.job_locale_show ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling JobLocalesApi.job_locale_show" + end + # verify the required parameter 'job_id' is set + if @api_client.config.client_side_validation && job_id.nil? + fail ArgumentError, "Missing the required parameter 'job_id' when calling JobLocalesApi.job_locale_show" + 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 JobLocalesApi.job_locale_show" + end + # verify the required parameter 'job_locale_show' is set + if @api_client.config.client_side_validation && job_locale_show.nil? + fail ArgumentError, "Missing the required parameter 'job_locale_show' when calling JobLocalesApi.job_locale_show" + end + # resource path + local_var_path = '/projects/{project_id}/jobs/{job_id}/locale/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s)).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(job_locale_show) + + # return_type + return_type = opts[:return_type] || 'JobLocale' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: JobLocalesApi#job_locale_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update a job locale + # Update an existing job locale. + # @param project_id [String] Project ID + # @param job_id [String] Job ID + # @param id [String] ID + # @param job_locale_update [JobLocaleUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def job_locale_update(project_id, job_id, id, job_locale_update, opts = {}) + data, _status_code, _headers = job_locale_update_with_http_info(project_id, job_id, id, job_locale_update, opts) + data + end + + # Update a job locale + # Update an existing job locale. + # @param project_id [String] Project ID + # @param job_id [String] Job ID + # @param id [String] ID + # @param job_locale_update [JobLocaleUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def job_locale_update_with_http_info(project_id, job_id, id, job_locale_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: JobLocalesApi.job_locale_update ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling JobLocalesApi.job_locale_update" + end + # verify the required parameter 'job_id' is set + if @api_client.config.client_side_validation && job_id.nil? + fail ArgumentError, "Missing the required parameter 'job_id' when calling JobLocalesApi.job_locale_update" + 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 JobLocalesApi.job_locale_update" + end + # verify the required parameter 'job_locale_update' is set + if @api_client.config.client_side_validation && job_locale_update.nil? + fail ArgumentError, "Missing the required parameter 'job_locale_update' when calling JobLocalesApi.job_locale_update" + end + # resource path + local_var_path = '/projects/{project_id}/jobs/{job_id}/locales/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s)).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(job_locale_update) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: JobLocalesApi#job_locale_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Create a job locale + # Create a new job locale. + # @param project_id [String] Project ID + # @param job_id [String] Job ID + # @param job_locales_create [JobLocalesCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def job_locales_create(project_id, job_id, job_locales_create, opts = {}) + job_locales_create_with_http_info(project_id, job_id, job_locales_create, opts) + nil + end + + # Create a job locale + # Create a new job locale. + # @param project_id [String] Project ID + # @param job_id [String] Job ID + # @param job_locales_create [JobLocalesCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def job_locales_create_with_http_info(project_id, job_id, job_locales_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: JobLocalesApi.job_locales_create ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling JobLocalesApi.job_locales_create" + end + # verify the required parameter 'job_id' is set + if @api_client.config.client_side_validation && job_id.nil? + fail ArgumentError, "Missing the required parameter 'job_id' when calling JobLocalesApi.job_locales_create" + end + # verify the required parameter 'job_locales_create' is set + if @api_client.config.client_side_validation && job_locales_create.nil? + fail ArgumentError, "Missing the required parameter 'job_locales_create' when calling JobLocalesApi.job_locales_create" + end + # resource path + local_var_path = '/projects/{project_id}/jobs/{job_id}/locales'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(job_locales_create) + + # return_type + return_type = opts[:return_type] + + # 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: JobLocalesApi#job_locales_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List job locales + # List all job locales for a given job. + # @param project_id [String] Project ID + # @param job_id [String] Job ID + # @param job_locales_list [JobLocalesList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def job_locales_list(project_id, job_id, job_locales_list, opts = {}) + data, _status_code, _headers = job_locales_list_with_http_info(project_id, job_id, job_locales_list, opts) + data + end + + # List job locales + # List all job locales for a given job. + # @param project_id [String] Project ID + # @param job_id [String] Job ID + # @param job_locales_list [JobLocalesList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def job_locales_list_with_http_info(project_id, job_id, job_locales_list, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: JobLocalesApi.job_locales_list ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling JobLocalesApi.job_locales_list" + end + # verify the required parameter 'job_id' is set + if @api_client.config.client_side_validation && job_id.nil? + fail ArgumentError, "Missing the required parameter 'job_id' when calling JobLocalesApi.job_locales_list" + end + # verify the required parameter 'job_locales_list' is set + if @api_client.config.client_side_validation && job_locales_list.nil? + fail ArgumentError, "Missing the required parameter 'job_locales_list' when calling JobLocalesApi.job_locales_list" + end + # resource path + local_var_path = '/projects/{project_id}/jobs/{job_id}/locales'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # 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(job_locales_list) + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: JobLocalesApi#job_locales_list\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/api/jobs_api.rb b/lib/Phrase/api/jobs_api.rb new file mode 100644 index 0000000..df45385 --- /dev/null +++ b/lib/Phrase/api/jobs_api.rb @@ -0,0 +1,798 @@ +require 'cgi' + +module Phrase + class JobsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Complete a job + # Mark a job as completed. + # @param project_id [String] Project ID + # @param id [String] ID + # @param job_complete [JobComplete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def job_complete(project_id, id, job_complete, opts = {}) + data, _status_code, _headers = job_complete_with_http_info(project_id, id, job_complete, opts) + data + end + + # Complete a job + # Mark a job as completed. + # @param project_id [String] Project ID + # @param id [String] ID + # @param job_complete [JobComplete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def job_complete_with_http_info(project_id, id, job_complete, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: JobsApi.job_complete ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling JobsApi.job_complete" + 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 JobsApi.job_complete" + end + # verify the required parameter 'job_complete' is set + if @api_client.config.client_side_validation && job_complete.nil? + fail ArgumentError, "Missing the required parameter 'job_complete' when calling JobsApi.job_complete" + end + # resource path + local_var_path = '/projects/{project_id}/jobs/{id}/complete'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(job_complete) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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: JobsApi#job_complete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Create a job + # Create a new job. + # @param project_id [String] Project ID + # @param job_create [JobCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def job_create(project_id, job_create, opts = {}) + job_create_with_http_info(project_id, job_create, opts) + nil + end + + # Create a job + # Create a new job. + # @param project_id [String] Project ID + # @param job_create [JobCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def job_create_with_http_info(project_id, job_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: JobsApi.job_create ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling JobsApi.job_create" + end + # verify the required parameter 'job_create' is set + if @api_client.config.client_side_validation && job_create.nil? + fail ArgumentError, "Missing the required parameter 'job_create' when calling JobsApi.job_create" + end + # resource path + local_var_path = '/projects/{project_id}/jobs'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(job_create) + + # return_type + return_type = opts[:return_type] + + # 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: JobsApi#job_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete a job + # Delete an existing job. + # @param project_id [String] Project ID + # @param id [String] ID + # @param job_delete [JobDelete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def job_delete(project_id, id, job_delete, opts = {}) + job_delete_with_http_info(project_id, id, job_delete, opts) + nil + end + + # Delete a job + # Delete an existing job. + # @param project_id [String] Project ID + # @param id [String] ID + # @param job_delete [JobDelete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def job_delete_with_http_info(project_id, id, job_delete, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: JobsApi.job_delete ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling JobsApi.job_delete" + 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 JobsApi.job_delete" + end + # verify the required parameter 'job_delete' is set + if @api_client.config.client_side_validation && job_delete.nil? + fail ArgumentError, "Missing the required parameter 'job_delete' when calling JobsApi.job_delete" + end + # resource path + local_var_path = '/projects/{project_id}/jobs/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(job_delete) + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: JobsApi#job_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Add keys to job + # Add multiple keys to a existing job. + # @param project_id [String] Project ID + # @param id [String] ID + # @param job_keys_create [JobKeysCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def job_keys_create(project_id, id, job_keys_create, opts = {}) + data, _status_code, _headers = job_keys_create_with_http_info(project_id, id, job_keys_create, opts) + data + end + + # Add keys to job + # Add multiple keys to a existing job. + # @param project_id [String] Project ID + # @param id [String] ID + # @param job_keys_create [JobKeysCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def job_keys_create_with_http_info(project_id, id, job_keys_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: JobsApi.job_keys_create ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling JobsApi.job_keys_create" + 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 JobsApi.job_keys_create" + end + # verify the required parameter 'job_keys_create' is set + if @api_client.config.client_side_validation && job_keys_create.nil? + fail ArgumentError, "Missing the required parameter 'job_keys_create' when calling JobsApi.job_keys_create" + end + # resource path + local_var_path = '/projects/{project_id}/jobs/{id}/keys'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(job_keys_create) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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: JobsApi#job_keys_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Remove keys from job + # Remove multiple keys from existing job. + # @param project_id [String] Project ID + # @param id [String] ID + # @param job_keys_delete [JobKeysDelete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def job_keys_delete(project_id, id, job_keys_delete, opts = {}) + job_keys_delete_with_http_info(project_id, id, job_keys_delete, opts) + nil + end + + # Remove keys from job + # Remove multiple keys from existing job. + # @param project_id [String] Project ID + # @param id [String] ID + # @param job_keys_delete [JobKeysDelete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def job_keys_delete_with_http_info(project_id, id, job_keys_delete, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: JobsApi.job_keys_delete ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling JobsApi.job_keys_delete" + 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 JobsApi.job_keys_delete" + end + # verify the required parameter 'job_keys_delete' is set + if @api_client.config.client_side_validation && job_keys_delete.nil? + fail ArgumentError, "Missing the required parameter 'job_keys_delete' when calling JobsApi.job_keys_delete" + end + # resource path + local_var_path = '/projects/{project_id}/jobs/{id}/keys'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(job_keys_delete) + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: JobsApi#job_keys_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Reopen a job + # Mark a job as uncompleted. + # @param project_id [String] Project ID + # @param id [String] ID + # @param job_reopen [JobReopen] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def job_reopen(project_id, id, job_reopen, opts = {}) + data, _status_code, _headers = job_reopen_with_http_info(project_id, id, job_reopen, opts) + data + end + + # Reopen a job + # Mark a job as uncompleted. + # @param project_id [String] Project ID + # @param id [String] ID + # @param job_reopen [JobReopen] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def job_reopen_with_http_info(project_id, id, job_reopen, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: JobsApi.job_reopen ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling JobsApi.job_reopen" + 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 JobsApi.job_reopen" + end + # verify the required parameter 'job_reopen' is set + if @api_client.config.client_side_validation && job_reopen.nil? + fail ArgumentError, "Missing the required parameter 'job_reopen' when calling JobsApi.job_reopen" + end + # resource path + local_var_path = '/projects/{project_id}/jobs/{id}/reopen'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(job_reopen) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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: JobsApi#job_reopen\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single job + # Get details on a single job for a given project. + # @param project_id [String] Project ID + # @param id [String] ID + # @param job_show [JobShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def job_show(project_id, id, job_show, opts = {}) + data, _status_code, _headers = job_show_with_http_info(project_id, id, job_show, opts) + data + end + + # Get a single job + # Get details on a single job for a given project. + # @param project_id [String] Project ID + # @param id [String] ID + # @param job_show [JobShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def job_show_with_http_info(project_id, id, job_show, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: JobsApi.job_show ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling JobsApi.job_show" + 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 JobsApi.job_show" + end + # verify the required parameter 'job_show' is set + if @api_client.config.client_side_validation && job_show.nil? + fail ArgumentError, "Missing the required parameter 'job_show' when calling JobsApi.job_show" + end + # resource path + local_var_path = '/projects/{project_id}/jobs/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(job_show) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: JobsApi#job_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Start a job + # Starts an existing job in state draft. + # @param project_id [String] Project ID + # @param id [String] ID + # @param job_start [JobStart] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def job_start(project_id, id, job_start, opts = {}) + data, _status_code, _headers = job_start_with_http_info(project_id, id, job_start, opts) + data + end + + # Start a job + # Starts an existing job in state draft. + # @param project_id [String] Project ID + # @param id [String] ID + # @param job_start [JobStart] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def job_start_with_http_info(project_id, id, job_start, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: JobsApi.job_start ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling JobsApi.job_start" + 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 JobsApi.job_start" + end + # verify the required parameter 'job_start' is set + if @api_client.config.client_side_validation && job_start.nil? + fail ArgumentError, "Missing the required parameter 'job_start' when calling JobsApi.job_start" + end + # resource path + local_var_path = '/projects/{project_id}/jobs/{id}/start'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(job_start) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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: JobsApi#job_start\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update a job + # Update an existing job. + # @param project_id [String] Project ID + # @param id [String] ID + # @param job_update [JobUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def job_update(project_id, id, job_update, opts = {}) + data, _status_code, _headers = job_update_with_http_info(project_id, id, job_update, opts) + data + end + + # Update a job + # Update an existing job. + # @param project_id [String] Project ID + # @param id [String] ID + # @param job_update [JobUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def job_update_with_http_info(project_id, id, job_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: JobsApi.job_update ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling JobsApi.job_update" + 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 JobsApi.job_update" + end + # verify the required parameter 'job_update' is set + if @api_client.config.client_side_validation && job_update.nil? + fail ArgumentError, "Missing the required parameter 'job_update' when calling JobsApi.job_update" + end + # resource path + local_var_path = '/projects/{project_id}/jobs/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(job_update) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: JobsApi#job_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List jobs + # List all jobs for the given project. + # @param project_id [String] Project ID + # @param jobs_list [JobsList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def jobs_list(project_id, jobs_list, opts = {}) + data, _status_code, _headers = jobs_list_with_http_info(project_id, jobs_list, opts) + data + end + + # List jobs + # List all jobs for the given project. + # @param project_id [String] Project ID + # @param jobs_list [JobsList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def jobs_list_with_http_info(project_id, jobs_list, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: JobsApi.jobs_list ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling JobsApi.jobs_list" + end + # verify the required parameter 'jobs_list' is set + if @api_client.config.client_side_validation && jobs_list.nil? + fail ArgumentError, "Missing the required parameter 'jobs_list' when calling JobsApi.jobs_list" + end + # resource path + local_var_path = '/projects/{project_id}/jobs'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # 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(jobs_list) + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: JobsApi#jobs_list\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/api/keys_api.rb b/lib/Phrase/api/keys_api.rb new file mode 100644 index 0000000..ae405f7 --- /dev/null +++ b/lib/Phrase/api/keys_api.rb @@ -0,0 +1,702 @@ +require 'cgi' + +module Phrase + class KeysApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a key + # Create a new key. + # @param project_id [String] Project ID + # @param key_create [KeyCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def key_create(project_id, key_create, opts = {}) + key_create_with_http_info(project_id, key_create, opts) + nil + end + + # Create a key + # Create a new key. + # @param project_id [String] Project ID + # @param key_create [KeyCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def key_create_with_http_info(project_id, key_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: KeysApi.key_create ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling KeysApi.key_create" + end + # verify the required parameter 'key_create' is set + if @api_client.config.client_side_validation && key_create.nil? + fail ArgumentError, "Missing the required parameter 'key_create' when calling KeysApi.key_create" + end + # resource path + local_var_path = '/projects/{project_id}/keys'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(key_create) + + # return_type + return_type = opts[:return_type] + + # 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: KeysApi#key_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete a key + # Delete an existing key. + # @param project_id [String] Project ID + # @param id [String] ID + # @param key_delete [KeyDelete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def key_delete(project_id, id, key_delete, opts = {}) + key_delete_with_http_info(project_id, id, key_delete, opts) + nil + end + + # Delete a key + # Delete an existing key. + # @param project_id [String] Project ID + # @param id [String] ID + # @param key_delete [KeyDelete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def key_delete_with_http_info(project_id, id, key_delete, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: KeysApi.key_delete ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling KeysApi.key_delete" + 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 KeysApi.key_delete" + end + # verify the required parameter 'key_delete' is set + if @api_client.config.client_side_validation && key_delete.nil? + fail ArgumentError, "Missing the required parameter 'key_delete' when calling KeysApi.key_delete" + end + # resource path + local_var_path = '/projects/{project_id}/keys/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(key_delete) + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: KeysApi#key_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single key + # Get details on a single key for a given project. + # @param project_id [String] Project ID + # @param id [String] ID + # @param key_show [KeyShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def key_show(project_id, id, key_show, opts = {}) + data, _status_code, _headers = key_show_with_http_info(project_id, id, key_show, opts) + data + end + + # Get a single key + # Get details on a single key for a given project. + # @param project_id [String] Project ID + # @param id [String] ID + # @param key_show [KeyShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def key_show_with_http_info(project_id, id, key_show, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: KeysApi.key_show ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling KeysApi.key_show" + 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 KeysApi.key_show" + end + # verify the required parameter 'key_show' is set + if @api_client.config.client_side_validation && key_show.nil? + fail ArgumentError, "Missing the required parameter 'key_show' when calling KeysApi.key_show" + end + # resource path + local_var_path = '/projects/{project_id}/keys/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(key_show) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: KeysApi#key_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update a key + # Update an existing key. + # @param project_id [String] Project ID + # @param id [String] ID + # @param key_update [KeyUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def key_update(project_id, id, key_update, opts = {}) + data, _status_code, _headers = key_update_with_http_info(project_id, id, key_update, opts) + data + end + + # Update a key + # Update an existing key. + # @param project_id [String] Project ID + # @param id [String] ID + # @param key_update [KeyUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def key_update_with_http_info(project_id, id, key_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: KeysApi.key_update ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling KeysApi.key_update" + 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 KeysApi.key_update" + end + # verify the required parameter 'key_update' is set + if @api_client.config.client_side_validation && key_update.nil? + fail ArgumentError, "Missing the required parameter 'key_update' when calling KeysApi.key_update" + end + # resource path + local_var_path = '/projects/{project_id}/keys/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(key_update) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: KeysApi#key_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete collection of keys + # Delete all keys matching query. Same constraints as list. Please limit the number of affected keys to about 1,000 as you might experience timeouts otherwise. + # @param project_id [String] Project ID + # @param keys_delete [KeysDelete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [AffectedResources] + def keys_delete(project_id, keys_delete, opts = {}) + data, _status_code, _headers = keys_delete_with_http_info(project_id, keys_delete, opts) + data + end + + # Delete collection of keys + # Delete all keys matching query. Same constraints as list. Please limit the number of affected keys to about 1,000 as you might experience timeouts otherwise. + # @param project_id [String] Project ID + # @param keys_delete [KeysDelete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(AffectedResources)>, Integer, Hash)>] Response<(AffectedResources)> data, response status code and response headers + def keys_delete_with_http_info(project_id, keys_delete, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: KeysApi.keys_delete ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling KeysApi.keys_delete" + end + # verify the required parameter 'keys_delete' is set + if @api_client.config.client_side_validation && keys_delete.nil? + fail ArgumentError, "Missing the required parameter 'keys_delete' when calling KeysApi.keys_delete" + end + # resource path + local_var_path = '/projects/{project_id}/keys'.sub('{' + 'project_id' + '}', CGI.escape(project_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(keys_delete) + + # return_type + return_type = opts[:return_type] || 'AffectedResources' + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: KeysApi#keys_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List keys + # List all keys for the given project. Alternatively you can POST requests to /search. + # @param project_id [String] Project ID + # @param keys_list [KeysList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def keys_list(project_id, keys_list, opts = {}) + data, _status_code, _headers = keys_list_with_http_info(project_id, keys_list, opts) + data + end + + # List keys + # List all keys for the given project. Alternatively you can POST requests to /search. + # @param project_id [String] Project ID + # @param keys_list [KeysList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def keys_list_with_http_info(project_id, keys_list, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: KeysApi.keys_list ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling KeysApi.keys_list" + end + # verify the required parameter 'keys_list' is set + if @api_client.config.client_side_validation && keys_list.nil? + fail ArgumentError, "Missing the required parameter 'keys_list' when calling KeysApi.keys_list" + end + # resource path + local_var_path = '/projects/{project_id}/keys'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # 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(keys_list) + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: KeysApi#keys_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Search keys + # Search keys for the given project matching query. + # @param project_id [String] Project ID + # @param keys_search [KeysSearch] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def keys_search(project_id, keys_search, opts = {}) + data, _status_code, _headers = keys_search_with_http_info(project_id, keys_search, opts) + data + end + + # Search keys + # Search keys for the given project matching query. + # @param project_id [String] Project ID + # @param keys_search [KeysSearch] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def keys_search_with_http_info(project_id, keys_search, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: KeysApi.keys_search ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling KeysApi.keys_search" + end + # verify the required parameter 'keys_search' is set + if @api_client.config.client_side_validation && keys_search.nil? + fail ArgumentError, "Missing the required parameter 'keys_search' when calling KeysApi.keys_search" + end + # resource path + local_var_path = '/projects/{project_id}/keys/search'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # 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(keys_search) + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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: KeysApi#keys_search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Add tags to collection of keys + # Tags all keys matching query. Same constraints as list. + # @param project_id [String] Project ID + # @param keys_tag [KeysTag] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def keys_tag(project_id, keys_tag, opts = {}) + data, _status_code, _headers = keys_tag_with_http_info(project_id, keys_tag, opts) + data + end + + # Add tags to collection of keys + # Tags all keys matching query. Same constraints as list. + # @param project_id [String] Project ID + # @param keys_tag [KeysTag] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def keys_tag_with_http_info(project_id, keys_tag, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: KeysApi.keys_tag ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling KeysApi.keys_tag" + end + # verify the required parameter 'keys_tag' is set + if @api_client.config.client_side_validation && keys_tag.nil? + fail ArgumentError, "Missing the required parameter 'keys_tag' when calling KeysApi.keys_tag" + end + # resource path + local_var_path = '/projects/{project_id}/keys/tag'.sub('{' + 'project_id' + '}', CGI.escape(project_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(keys_tag) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: KeysApi#keys_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Remove tags from collection of keys + # Removes specified tags from keys matching query. + # @param project_id [String] Project ID + # @param keys_untag [KeysUntag] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def keys_untag(project_id, keys_untag, opts = {}) + data, _status_code, _headers = keys_untag_with_http_info(project_id, keys_untag, opts) + data + end + + # Remove tags from collection of keys + # Removes specified tags from keys matching query. + # @param project_id [String] Project ID + # @param keys_untag [KeysUntag] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def keys_untag_with_http_info(project_id, keys_untag, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: KeysApi.keys_untag ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling KeysApi.keys_untag" + end + # verify the required parameter 'keys_untag' is set + if @api_client.config.client_side_validation && keys_untag.nil? + fail ArgumentError, "Missing the required parameter 'keys_untag' when calling KeysApi.keys_untag" + end + # resource path + local_var_path = '/projects/{project_id}/keys/untag'.sub('{' + 'project_id' + '}', CGI.escape(project_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(keys_untag) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: KeysApi#keys_untag\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/api/locales_api.rb b/lib/Phrase/api/locales_api.rb new file mode 100644 index 0000000..eb3b49e --- /dev/null +++ b/lib/Phrase/api/locales_api.rb @@ -0,0 +1,478 @@ +require 'cgi' + +module Phrase + class LocalesApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a locale + # Create a new locale. + # @param project_id [String] Project ID + # @param locale_create [LocaleCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def locale_create(project_id, locale_create, opts = {}) + locale_create_with_http_info(project_id, locale_create, opts) + nil + end + + # Create a locale + # Create a new locale. + # @param project_id [String] Project ID + # @param locale_create [LocaleCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def locale_create_with_http_info(project_id, locale_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LocalesApi.locale_create ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling LocalesApi.locale_create" + end + # verify the required parameter 'locale_create' is set + if @api_client.config.client_side_validation && locale_create.nil? + fail ArgumentError, "Missing the required parameter 'locale_create' when calling LocalesApi.locale_create" + end + # resource path + local_var_path = '/projects/{project_id}/locales'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(locale_create) + + # return_type + return_type = opts[:return_type] + + # 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: LocalesApi#locale_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete a locale + # Delete an existing locale. + # @param project_id [String] Project ID + # @param id [String] ID + # @param locale_delete [LocaleDelete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def locale_delete(project_id, id, locale_delete, opts = {}) + locale_delete_with_http_info(project_id, id, locale_delete, opts) + nil + end + + # Delete a locale + # Delete an existing locale. + # @param project_id [String] Project ID + # @param id [String] ID + # @param locale_delete [LocaleDelete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def locale_delete_with_http_info(project_id, id, locale_delete, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LocalesApi.locale_delete ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling LocalesApi.locale_delete" + 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 LocalesApi.locale_delete" + end + # verify the required parameter 'locale_delete' is set + if @api_client.config.client_side_validation && locale_delete.nil? + fail ArgumentError, "Missing the required parameter 'locale_delete' when calling LocalesApi.locale_delete" + end + # resource path + local_var_path = '/projects/{project_id}/locales/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(locale_delete) + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LocalesApi#locale_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Download a locale + # Download a locale in a specific file format. + # @param project_id [String] Project ID + # @param id [String] ID + # @param locale_download [LocaleDownload] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def locale_download(project_id, id, locale_download, opts = {}) + locale_download_with_http_info(project_id, id, locale_download, opts) + nil + end + + # Download a locale + # Download a locale in a specific file format. + # @param project_id [String] Project ID + # @param id [String] ID + # @param locale_download [LocaleDownload] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def locale_download_with_http_info(project_id, id, locale_download, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LocalesApi.locale_download ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling LocalesApi.locale_download" + 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 LocalesApi.locale_download" + end + # verify the required parameter 'locale_download' is set + if @api_client.config.client_side_validation && locale_download.nil? + fail ArgumentError, "Missing the required parameter 'locale_download' when calling LocalesApi.locale_download" + end + # resource path + local_var_path = '/projects/{project_id}/locales/{id}/download'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(locale_download) + + # return_type + return_type = opts[:return_type] + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LocalesApi#locale_download\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single locale + # Get details on a single locale for a given project. + # @param project_id [String] Project ID + # @param id [String] ID + # @param locale_show [LocaleShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def locale_show(project_id, id, locale_show, opts = {}) + data, _status_code, _headers = locale_show_with_http_info(project_id, id, locale_show, opts) + data + end + + # Get a single locale + # Get details on a single locale for a given project. + # @param project_id [String] Project ID + # @param id [String] ID + # @param locale_show [LocaleShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def locale_show_with_http_info(project_id, id, locale_show, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LocalesApi.locale_show ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling LocalesApi.locale_show" + 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 LocalesApi.locale_show" + end + # verify the required parameter 'locale_show' is set + if @api_client.config.client_side_validation && locale_show.nil? + fail ArgumentError, "Missing the required parameter 'locale_show' when calling LocalesApi.locale_show" + end + # resource path + local_var_path = '/projects/{project_id}/locales/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(locale_show) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LocalesApi#locale_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update a locale + # Update an existing locale. + # @param project_id [String] Project ID + # @param id [String] ID + # @param locale_update [LocaleUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def locale_update(project_id, id, locale_update, opts = {}) + data, _status_code, _headers = locale_update_with_http_info(project_id, id, locale_update, opts) + data + end + + # Update a locale + # Update an existing locale. + # @param project_id [String] Project ID + # @param id [String] ID + # @param locale_update [LocaleUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def locale_update_with_http_info(project_id, id, locale_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LocalesApi.locale_update ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling LocalesApi.locale_update" + 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 LocalesApi.locale_update" + end + # verify the required parameter 'locale_update' is set + if @api_client.config.client_side_validation && locale_update.nil? + fail ArgumentError, "Missing the required parameter 'locale_update' when calling LocalesApi.locale_update" + end + # resource path + local_var_path = '/projects/{project_id}/locales/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(locale_update) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LocalesApi#locale_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List locales + # List all locales for the given project. + # @param project_id [String] Project ID + # @param locales_list [LocalesList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def locales_list(project_id, locales_list, opts = {}) + data, _status_code, _headers = locales_list_with_http_info(project_id, locales_list, opts) + data + end + + # List locales + # List all locales for the given project. + # @param project_id [String] Project ID + # @param locales_list [LocalesList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def locales_list_with_http_info(project_id, locales_list, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LocalesApi.locales_list ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling LocalesApi.locales_list" + end + # verify the required parameter 'locales_list' is set + if @api_client.config.client_side_validation && locales_list.nil? + fail ArgumentError, "Missing the required parameter 'locales_list' when calling LocalesApi.locales_list" + end + # resource path + local_var_path = '/projects/{project_id}/locales'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # 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(locales_list) + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LocalesApi#locales_list\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/api/members_api.rb b/lib/Phrase/api/members_api.rb new file mode 100644 index 0000000..a4ca267 --- /dev/null +++ b/lib/Phrase/api/members_api.rb @@ -0,0 +1,304 @@ +require 'cgi' + +module Phrase + class MembersApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Remove a user from the account + # Remove a user from the account. The user will be removed from the account but not deleted from Phrase. Access token scope must include team.manage. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def member_delete(account_id, id, opts = {}) + member_delete_with_http_info(account_id, id, opts) + nil + end + + # Remove a user from the account + # Remove a user from the account. The user will be removed from the account but not deleted from Phrase. Access token scope must include <code>team.manage</code>. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def member_delete_with_http_info(account_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MembersApi.member_delete ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling MembersApi.member_delete" + 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 MembersApi.member_delete" + end + # resource path + local_var_path = '/accounts/{account_id}/members/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + 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] + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MembersApi#member_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get single member + # Get details on a single user in the account. Access token scope must include team.manage. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Member] + def member_show(account_id, id, opts = {}) + data, _status_code, _headers = member_show_with_http_info(account_id, id, opts) + data + end + + # Get single member + # Get details on a single user in the account. Access token scope must include <code>team.manage</code>. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Member)>, Integer, Hash)>] Response<(Member)> data, response status code and response headers + def member_show_with_http_info(account_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MembersApi.member_show ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling MembersApi.member_show" + 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 MembersApi.member_show" + end + # resource path + local_var_path = '/accounts/{account_id}/members/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).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']) + 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] + + # return_type + return_type = opts[:return_type] || 'Member' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MembersApi#member_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update a member + # Update user permissions in the account. Developers and translators need project_ids and locale_ids assigned to access them. Access token scope must include team.manage. + # @param account_id [String] Account ID + # @param id [String] ID + # @param member_update [MemberUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def member_update(account_id, id, member_update, opts = {}) + data, _status_code, _headers = member_update_with_http_info(account_id, id, member_update, opts) + data + end + + # Update a member + # Update user permissions in the account. Developers and translators need <code>project_ids</code> and <code>locale_ids</code> assigned to access them. Access token scope must include <code>team.manage</code>. + # @param account_id [String] Account ID + # @param id [String] ID + # @param member_update [MemberUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def member_update_with_http_info(account_id, id, member_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MembersApi.member_update ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling MembersApi.member_update" + 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 MembersApi.member_update" + end + # verify the required parameter 'member_update' is set + if @api_client.config.client_side_validation && member_update.nil? + fail ArgumentError, "Missing the required parameter 'member_update' when calling MembersApi.member_update" + end + # resource path + local_var_path = '/accounts/{account_id}/members/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).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(member_update) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MembersApi#member_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List members + # Get all users active in the account. It also lists resources like projects and locales the member has access to. In case nothing is shown the default access from the role is used. Access token scope must include team.manage. + # @param account_id [String] Account ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def members_list(account_id, opts = {}) + data, _status_code, _headers = members_list_with_http_info(account_id, opts) + data + end + + # List members + # Get all users active in the account. It also lists resources like projects and locales the member has access to. In case nothing is shown the default access from the role is used. Access token scope must include <code>team.manage</code>. + # @param account_id [String] Account ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def members_list_with_http_info(account_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MembersApi.members_list ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling MembersApi.members_list" + end + # resource path + local_var_path = '/accounts/{account_id}/members'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['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] + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MembersApi#members_list\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/api/orders_api.rb b/lib/Phrase/api/orders_api.rb new file mode 100644 index 0000000..ef60ed2 --- /dev/null +++ b/lib/Phrase/api/orders_api.rb @@ -0,0 +1,400 @@ +require 'cgi' + +module Phrase + class OrdersApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Confirm an order + # Confirm an existing order and send it to the provider for translation. Same constraints as for create. + # @param project_id [String] Project ID + # @param id [String] ID + # @param order_confirm [OrderConfirm] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def order_confirm(project_id, id, order_confirm, opts = {}) + data, _status_code, _headers = order_confirm_with_http_info(project_id, id, order_confirm, opts) + data + end + + # Confirm an order + # Confirm an existing order and send it to the provider for translation. Same constraints as for create. + # @param project_id [String] Project ID + # @param id [String] ID + # @param order_confirm [OrderConfirm] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def order_confirm_with_http_info(project_id, id, order_confirm, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrdersApi.order_confirm ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling OrdersApi.order_confirm" + 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 OrdersApi.order_confirm" + end + # verify the required parameter 'order_confirm' is set + if @api_client.config.client_side_validation && order_confirm.nil? + fail ArgumentError, "Missing the required parameter 'order_confirm' when calling OrdersApi.order_confirm" + end + # resource path + local_var_path = '/projects/{project_id}/orders/{id}/confirm'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(order_confirm) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrdersApi#order_confirm\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Create a new order + # Create a new order. Access token scope must include orders.create. + # @param project_id [String] Project ID + # @param order_create [OrderCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def order_create(project_id, order_create, opts = {}) + order_create_with_http_info(project_id, order_create, opts) + nil + end + + # Create a new order + # Create a new order. Access token scope must include <code>orders.create</code>. + # @param project_id [String] Project ID + # @param order_create [OrderCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def order_create_with_http_info(project_id, order_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrdersApi.order_create ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling OrdersApi.order_create" + end + # verify the required parameter 'order_create' is set + if @api_client.config.client_side_validation && order_create.nil? + fail ArgumentError, "Missing the required parameter 'order_create' when calling OrdersApi.order_create" + end + # resource path + local_var_path = '/projects/{project_id}/orders'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(order_create) + + # return_type + return_type = opts[:return_type] + + # 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: OrdersApi#order_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Cancel an order + # Cancel an existing order. Must not yet be confirmed. + # @param project_id [String] Project ID + # @param id [String] ID + # @param order_delete [OrderDelete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def order_delete(project_id, id, order_delete, opts = {}) + order_delete_with_http_info(project_id, id, order_delete, opts) + nil + end + + # Cancel an order + # Cancel an existing order. Must not yet be confirmed. + # @param project_id [String] Project ID + # @param id [String] ID + # @param order_delete [OrderDelete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def order_delete_with_http_info(project_id, id, order_delete, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrdersApi.order_delete ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling OrdersApi.order_delete" + 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 OrdersApi.order_delete" + end + # verify the required parameter 'order_delete' is set + if @api_client.config.client_side_validation && order_delete.nil? + fail ArgumentError, "Missing the required parameter 'order_delete' when calling OrdersApi.order_delete" + end + # resource path + local_var_path = '/projects/{project_id}/orders/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(order_delete) + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrdersApi#order_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single order + # Get details on a single order. + # @param project_id [String] Project ID + # @param id [String] ID + # @param order_show [OrderShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [TranslationOrder] + def order_show(project_id, id, order_show, opts = {}) + data, _status_code, _headers = order_show_with_http_info(project_id, id, order_show, opts) + data + end + + # Get a single order + # Get details on a single order. + # @param project_id [String] Project ID + # @param id [String] ID + # @param order_show [OrderShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(TranslationOrder)>, Integer, Hash)>] Response<(TranslationOrder)> data, response status code and response headers + def order_show_with_http_info(project_id, id, order_show, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrdersApi.order_show ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling OrdersApi.order_show" + 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 OrdersApi.order_show" + end + # verify the required parameter 'order_show' is set + if @api_client.config.client_side_validation && order_show.nil? + fail ArgumentError, "Missing the required parameter 'order_show' when calling OrdersApi.order_show" + end + # resource path + local_var_path = '/projects/{project_id}/orders/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(order_show) + + # return_type + return_type = opts[:return_type] || 'TranslationOrder' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrdersApi#order_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List orders + # List all orders for the given project. + # @param project_id [String] Project ID + # @param orders_list [OrdersList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def orders_list(project_id, orders_list, opts = {}) + data, _status_code, _headers = orders_list_with_http_info(project_id, orders_list, opts) + data + end + + # List orders + # List all orders for the given project. + # @param project_id [String] Project ID + # @param orders_list [OrdersList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def orders_list_with_http_info(project_id, orders_list, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrdersApi.orders_list ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling OrdersApi.orders_list" + end + # verify the required parameter 'orders_list' is set + if @api_client.config.client_side_validation && orders_list.nil? + fail ArgumentError, "Missing the required parameter 'orders_list' when calling OrdersApi.orders_list" + end + # resource path + local_var_path = '/projects/{project_id}/orders'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # 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(orders_list) + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrdersApi#orders_list\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/api/projects_api.rb b/lib/Phrase/api/projects_api.rb new file mode 100644 index 0000000..02396b1 --- /dev/null +++ b/lib/Phrase/api/projects_api.rb @@ -0,0 +1,346 @@ +require 'cgi' + +module Phrase + class ProjectsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a project + # Create a new project. + # @param project_create [ProjectCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def project_create(project_create, opts = {}) + project_create_with_http_info(project_create, opts) + nil + end + + # Create a project + # Create a new project. + # @param project_create [ProjectCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def project_create_with_http_info(project_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ProjectsApi.project_create ...' + end + # verify the required parameter 'project_create' is set + if @api_client.config.client_side_validation && project_create.nil? + fail ArgumentError, "Missing the required parameter 'project_create' when calling ProjectsApi.project_create" + end + # resource path + local_var_path = '/projects' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(project_create) + + # return_type + return_type = opts[:return_type] + + # 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: ProjectsApi#project_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete a project + # Delete an existing project. + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def project_delete(id, opts = {}) + project_delete_with_http_info(id, opts) + nil + end + + # Delete a project + # Delete an existing project. + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def project_delete_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ProjectsApi.project_delete ...' + 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 ProjectsApi.project_delete" + end + # resource path + local_var_path = '/projects/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + 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] + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ProjectsApi#project_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single project + # Get details on a single project. + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Project] + def project_show(id, opts = {}) + data, _status_code, _headers = project_show_with_http_info(id, opts) + data + end + + # Get a single project + # Get details on a single project. + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Project)>, Integer, Hash)>] Response<(Project)> data, response status code and response headers + def project_show_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ProjectsApi.project_show ...' + 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 ProjectsApi.project_show" + end + # resource path + local_var_path = '/projects/{id}'.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']) + 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] + + # return_type + return_type = opts[:return_type] || 'Project' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ProjectsApi#project_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update a project + # Update an existing project. + # @param id [String] ID + # @param project_update [ProjectUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def project_update(id, project_update, opts = {}) + data, _status_code, _headers = project_update_with_http_info(id, project_update, opts) + data + end + + # Update a project + # Update an existing project. + # @param id [String] ID + # @param project_update [ProjectUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def project_update_with_http_info(id, project_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ProjectsApi.project_update ...' + 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 ProjectsApi.project_update" + end + # verify the required parameter 'project_update' is set + if @api_client.config.client_side_validation && project_update.nil? + fail ArgumentError, "Missing the required parameter 'project_update' when calling ProjectsApi.project_update" + end + # resource path + local_var_path = '/projects/{id}'.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(project_update) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ProjectsApi#project_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List projects + # List all projects the current user has access to. + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def projects_list(opts = {}) + data, _status_code, _headers = projects_list_with_http_info(opts) + data + end + + # List projects + # List all projects the current user has access to. + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def projects_list_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ProjectsApi.projects_list ...' + end + # resource path + local_var_path = '/projects' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['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] + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ProjectsApi#projects_list\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/api/releases_api.rb b/lib/Phrase/api/releases_api.rb new file mode 100644 index 0000000..ce5efb3 --- /dev/null +++ b/lib/Phrase/api/releases_api.rb @@ -0,0 +1,484 @@ +require 'cgi' + +module Phrase + class ReleasesApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a release + # Create a new release. + # @param account_id [String] Account ID + # @param distribution_id [String] Distribution ID + # @param release_create [ReleaseCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def release_create(account_id, distribution_id, release_create, opts = {}) + release_create_with_http_info(account_id, distribution_id, release_create, opts) + nil + end + + # Create a release + # Create a new release. + # @param account_id [String] Account ID + # @param distribution_id [String] Distribution ID + # @param release_create [ReleaseCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def release_create_with_http_info(account_id, distribution_id, release_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ReleasesApi.release_create ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling ReleasesApi.release_create" + end + # verify the required parameter 'distribution_id' is set + if @api_client.config.client_side_validation && distribution_id.nil? + fail ArgumentError, "Missing the required parameter 'distribution_id' when calling ReleasesApi.release_create" + end + # verify the required parameter 'release_create' is set + if @api_client.config.client_side_validation && release_create.nil? + fail ArgumentError, "Missing the required parameter 'release_create' when calling ReleasesApi.release_create" + end + # resource path + local_var_path = '/accounts/{account_id}/distributions/{distribution_id}/releases'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'distribution_id' + '}', CGI.escape(distribution_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(release_create) + + # return_type + return_type = opts[:return_type] + + # 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: ReleasesApi#release_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete a release + # Delete an existing release. + # @param account_id [String] Account ID + # @param distribution_id [String] Distribution ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def release_delete(account_id, distribution_id, id, opts = {}) + release_delete_with_http_info(account_id, distribution_id, id, opts) + nil + end + + # Delete a release + # Delete an existing release. + # @param account_id [String] Account ID + # @param distribution_id [String] Distribution ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def release_delete_with_http_info(account_id, distribution_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ReleasesApi.release_delete ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling ReleasesApi.release_delete" + end + # verify the required parameter 'distribution_id' is set + if @api_client.config.client_side_validation && distribution_id.nil? + fail ArgumentError, "Missing the required parameter 'distribution_id' when calling ReleasesApi.release_delete" + 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 ReleasesApi.release_delete" + end + # resource path + local_var_path = '/accounts/{account_id}/distributions/{distribution_id}/releases/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'distribution_id' + '}', CGI.escape(distribution_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + 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] + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ReleasesApi#release_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Publish a release + # Publish a release for production. + # @param account_id [String] Account ID + # @param distribution_id [String] Distribution ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def release_publish(account_id, distribution_id, id, opts = {}) + data, _status_code, _headers = release_publish_with_http_info(account_id, distribution_id, id, opts) + data + end + + # Publish a release + # Publish a release for production. + # @param account_id [String] Account ID + # @param distribution_id [String] Distribution ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def release_publish_with_http_info(account_id, distribution_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ReleasesApi.release_publish ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling ReleasesApi.release_publish" + end + # verify the required parameter 'distribution_id' is set + if @api_client.config.client_side_validation && distribution_id.nil? + fail ArgumentError, "Missing the required parameter 'distribution_id' when calling ReleasesApi.release_publish" + 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 ReleasesApi.release_publish" + end + # resource path + local_var_path = '/accounts/{account_id}/distributions/{distribution_id}/releases/{id}/publish'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'distribution_id' + '}', CGI.escape(distribution_id.to_s)).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']) + 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] + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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: ReleasesApi#release_publish\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single release + # Get details on a single release. + # @param account_id [String] Account ID + # @param distribution_id [String] Distribution ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Release] + def release_show(account_id, distribution_id, id, opts = {}) + data, _status_code, _headers = release_show_with_http_info(account_id, distribution_id, id, opts) + data + end + + # Get a single release + # Get details on a single release. + # @param account_id [String] Account ID + # @param distribution_id [String] Distribution ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Release)>, Integer, Hash)>] Response<(Release)> data, response status code and response headers + def release_show_with_http_info(account_id, distribution_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ReleasesApi.release_show ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling ReleasesApi.release_show" + end + # verify the required parameter 'distribution_id' is set + if @api_client.config.client_side_validation && distribution_id.nil? + fail ArgumentError, "Missing the required parameter 'distribution_id' when calling ReleasesApi.release_show" + 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 ReleasesApi.release_show" + end + # resource path + local_var_path = '/accounts/{account_id}/distributions/{distribution_id}/releases/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'distribution_id' + '}', CGI.escape(distribution_id.to_s)).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']) + 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] + + # return_type + return_type = opts[:return_type] || 'Release' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ReleasesApi#release_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update a release + # Update an existing release. + # @param account_id [String] Account ID + # @param distribution_id [String] Distribution ID + # @param id [String] ID + # @param release_update [ReleaseUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def release_update(account_id, distribution_id, id, release_update, opts = {}) + data, _status_code, _headers = release_update_with_http_info(account_id, distribution_id, id, release_update, opts) + data + end + + # Update a release + # Update an existing release. + # @param account_id [String] Account ID + # @param distribution_id [String] Distribution ID + # @param id [String] ID + # @param release_update [ReleaseUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def release_update_with_http_info(account_id, distribution_id, id, release_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ReleasesApi.release_update ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling ReleasesApi.release_update" + end + # verify the required parameter 'distribution_id' is set + if @api_client.config.client_side_validation && distribution_id.nil? + fail ArgumentError, "Missing the required parameter 'distribution_id' when calling ReleasesApi.release_update" + 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 ReleasesApi.release_update" + end + # verify the required parameter 'release_update' is set + if @api_client.config.client_side_validation && release_update.nil? + fail ArgumentError, "Missing the required parameter 'release_update' when calling ReleasesApi.release_update" + end + # resource path + local_var_path = '/accounts/{account_id}/distributions/{distribution_id}/releases/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'distribution_id' + '}', CGI.escape(distribution_id.to_s)).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(release_update) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ReleasesApi#release_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List releases + # List all releases for the given distribution. + # @param account_id [String] Account ID + # @param distribution_id [String] Distribution ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def releases_list(account_id, distribution_id, opts = {}) + data, _status_code, _headers = releases_list_with_http_info(account_id, distribution_id, opts) + data + end + + # List releases + # List all releases for the given distribution. + # @param account_id [String] Account ID + # @param distribution_id [String] Distribution ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def releases_list_with_http_info(account_id, distribution_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ReleasesApi.releases_list ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling ReleasesApi.releases_list" + end + # verify the required parameter 'distribution_id' is set + if @api_client.config.client_side_validation && distribution_id.nil? + fail ArgumentError, "Missing the required parameter 'distribution_id' when calling ReleasesApi.releases_list" + end + # resource path + local_var_path = '/accounts/{account_id}/distributions/{distribution_id}/releases'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'distribution_id' + '}', CGI.escape(distribution_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['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] + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ReleasesApi#releases_list\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/api/screenshot_markers_api.rb b/lib/Phrase/api/screenshot_markers_api.rb new file mode 100644 index 0000000..62cf416 --- /dev/null +++ b/lib/Phrase/api/screenshot_markers_api.rb @@ -0,0 +1,394 @@ +require 'cgi' + +module Phrase + class ScreenshotMarkersApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a screenshot marker + # Create a new screenshot marker. + # @param project_id [String] Project ID + # @param screenshot_id [String] Screenshot ID + # @param screenshot_marker_create [ScreenshotMarkerCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def screenshot_marker_create(project_id, screenshot_id, screenshot_marker_create, opts = {}) + screenshot_marker_create_with_http_info(project_id, screenshot_id, screenshot_marker_create, opts) + nil + end + + # Create a screenshot marker + # Create a new screenshot marker. + # @param project_id [String] Project ID + # @param screenshot_id [String] Screenshot ID + # @param screenshot_marker_create [ScreenshotMarkerCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def screenshot_marker_create_with_http_info(project_id, screenshot_id, screenshot_marker_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ScreenshotMarkersApi.screenshot_marker_create ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling ScreenshotMarkersApi.screenshot_marker_create" + end + # verify the required parameter 'screenshot_id' is set + if @api_client.config.client_side_validation && screenshot_id.nil? + fail ArgumentError, "Missing the required parameter 'screenshot_id' when calling ScreenshotMarkersApi.screenshot_marker_create" + end + # verify the required parameter 'screenshot_marker_create' is set + if @api_client.config.client_side_validation && screenshot_marker_create.nil? + fail ArgumentError, "Missing the required parameter 'screenshot_marker_create' when calling ScreenshotMarkersApi.screenshot_marker_create" + end + # resource path + local_var_path = '/projects/{project_id}/screenshots/{screenshot_id}/markers'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'screenshot_id' + '}', CGI.escape(screenshot_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(screenshot_marker_create) + + # return_type + return_type = opts[:return_type] + + # 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: ScreenshotMarkersApi#screenshot_marker_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete a screenshot marker + # Delete an existing screenshot marker. + # @param project_id [String] Project ID + # @param screenshot_id [String] Screenshot ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def screenshot_marker_delete(project_id, screenshot_id, opts = {}) + screenshot_marker_delete_with_http_info(project_id, screenshot_id, opts) + nil + end + + # Delete a screenshot marker + # Delete an existing screenshot marker. + # @param project_id [String] Project ID + # @param screenshot_id [String] Screenshot ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def screenshot_marker_delete_with_http_info(project_id, screenshot_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ScreenshotMarkersApi.screenshot_marker_delete ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling ScreenshotMarkersApi.screenshot_marker_delete" + end + # verify the required parameter 'screenshot_id' is set + if @api_client.config.client_side_validation && screenshot_id.nil? + fail ArgumentError, "Missing the required parameter 'screenshot_id' when calling ScreenshotMarkersApi.screenshot_marker_delete" + end + # resource path + local_var_path = '/projects/{project_id}/screenshots/{screenshot_id}/markers'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'screenshot_id' + '}', CGI.escape(screenshot_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + 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] + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ScreenshotMarkersApi#screenshot_marker_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single screenshot marker + # Get details on a single screenshot marker for a given project. + # @param project_id [String] Project ID + # @param screenshot_id [String] Screenshot ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def screenshot_marker_show(project_id, screenshot_id, id, opts = {}) + data, _status_code, _headers = screenshot_marker_show_with_http_info(project_id, screenshot_id, id, opts) + data + end + + # Get a single screenshot marker + # Get details on a single screenshot marker for a given project. + # @param project_id [String] Project ID + # @param screenshot_id [String] Screenshot ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def screenshot_marker_show_with_http_info(project_id, screenshot_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ScreenshotMarkersApi.screenshot_marker_show ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling ScreenshotMarkersApi.screenshot_marker_show" + end + # verify the required parameter 'screenshot_id' is set + if @api_client.config.client_side_validation && screenshot_id.nil? + fail ArgumentError, "Missing the required parameter 'screenshot_id' when calling ScreenshotMarkersApi.screenshot_marker_show" + 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 ScreenshotMarkersApi.screenshot_marker_show" + end + # resource path + local_var_path = '/projects/{project_id}/screenshots/{screenshot_id}/markers/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'screenshot_id' + '}', CGI.escape(screenshot_id.to_s)).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']) + 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] + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ScreenshotMarkersApi#screenshot_marker_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update a screenshot marker + # Update an existing screenshot marker. + # @param project_id [String] Project ID + # @param screenshot_id [String] Screenshot ID + # @param screenshot_marker_update [ScreenshotMarkerUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [ScreenshotMarker] + def screenshot_marker_update(project_id, screenshot_id, screenshot_marker_update, opts = {}) + data, _status_code, _headers = screenshot_marker_update_with_http_info(project_id, screenshot_id, screenshot_marker_update, opts) + data + end + + # Update a screenshot marker + # Update an existing screenshot marker. + # @param project_id [String] Project ID + # @param screenshot_id [String] Screenshot ID + # @param screenshot_marker_update [ScreenshotMarkerUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(ScreenshotMarker)>, Integer, Hash)>] Response<(ScreenshotMarker)> data, response status code and response headers + def screenshot_marker_update_with_http_info(project_id, screenshot_id, screenshot_marker_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ScreenshotMarkersApi.screenshot_marker_update ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling ScreenshotMarkersApi.screenshot_marker_update" + end + # verify the required parameter 'screenshot_id' is set + if @api_client.config.client_side_validation && screenshot_id.nil? + fail ArgumentError, "Missing the required parameter 'screenshot_id' when calling ScreenshotMarkersApi.screenshot_marker_update" + end + # verify the required parameter 'screenshot_marker_update' is set + if @api_client.config.client_side_validation && screenshot_marker_update.nil? + fail ArgumentError, "Missing the required parameter 'screenshot_marker_update' when calling ScreenshotMarkersApi.screenshot_marker_update" + end + # resource path + local_var_path = '/projects/{project_id}/screenshots/{screenshot_id}/markers'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'screenshot_id' + '}', CGI.escape(screenshot_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(screenshot_marker_update) + + # return_type + return_type = opts[:return_type] || 'ScreenshotMarker' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ScreenshotMarkersApi#screenshot_marker_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List screenshot markers + # List all screenshot markers for the given project. + # @param project_id [String] Project ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def screenshot_markers_list(project_id, id, opts = {}) + data, _status_code, _headers = screenshot_markers_list_with_http_info(project_id, id, opts) + data + end + + # List screenshot markers + # List all screenshot markers for the given project. + # @param project_id [String] Project ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def screenshot_markers_list_with_http_info(project_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ScreenshotMarkersApi.screenshot_markers_list ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling ScreenshotMarkersApi.screenshot_markers_list" + 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 ScreenshotMarkersApi.screenshot_markers_list" + end + # resource path + local_var_path = '/projects/{project_id}/screenshots/{id}/markers'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['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] + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ScreenshotMarkersApi#screenshot_markers_list\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/api/screenshots_api.rb b/lib/Phrase/api/screenshots_api.rb new file mode 100644 index 0000000..68c24f0 --- /dev/null +++ b/lib/Phrase/api/screenshots_api.rb @@ -0,0 +1,376 @@ +require 'cgi' + +module Phrase + class ScreenshotsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a screenshot + # Create a new screenshot. + # @param project_id [String] Project ID + # @param screenshot_create [ScreenshotCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def screenshot_create(project_id, screenshot_create, opts = {}) + screenshot_create_with_http_info(project_id, screenshot_create, opts) + nil + end + + # Create a screenshot + # Create a new screenshot. + # @param project_id [String] Project ID + # @param screenshot_create [ScreenshotCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def screenshot_create_with_http_info(project_id, screenshot_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ScreenshotsApi.screenshot_create ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling ScreenshotsApi.screenshot_create" + end + # verify the required parameter 'screenshot_create' is set + if @api_client.config.client_side_validation && screenshot_create.nil? + fail ArgumentError, "Missing the required parameter 'screenshot_create' when calling ScreenshotsApi.screenshot_create" + end + # resource path + local_var_path = '/projects/{project_id}/screenshots'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(screenshot_create) + + # return_type + return_type = opts[:return_type] + + # 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: ScreenshotsApi#screenshot_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete a screenshot + # Delete an existing screenshot. + # @param project_id [String] Project ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def screenshot_delete(project_id, id, opts = {}) + screenshot_delete_with_http_info(project_id, id, opts) + nil + end + + # Delete a screenshot + # Delete an existing screenshot. + # @param project_id [String] Project ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def screenshot_delete_with_http_info(project_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ScreenshotsApi.screenshot_delete ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling ScreenshotsApi.screenshot_delete" + 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 ScreenshotsApi.screenshot_delete" + end + # resource path + local_var_path = '/projects/{project_id}/screenshots/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + 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] + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ScreenshotsApi#screenshot_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single screenshot + # Get details on a single screenshot for a given project. + # @param project_id [String] Project ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Screenshot] + def screenshot_show(project_id, id, opts = {}) + data, _status_code, _headers = screenshot_show_with_http_info(project_id, id, opts) + data + end + + # Get a single screenshot + # Get details on a single screenshot for a given project. + # @param project_id [String] Project ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Screenshot)>, Integer, Hash)>] Response<(Screenshot)> data, response status code and response headers + def screenshot_show_with_http_info(project_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ScreenshotsApi.screenshot_show ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling ScreenshotsApi.screenshot_show" + 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 ScreenshotsApi.screenshot_show" + end + # resource path + local_var_path = '/projects/{project_id}/screenshots/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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']) + 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] + + # return_type + return_type = opts[:return_type] || 'Screenshot' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ScreenshotsApi#screenshot_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update a screenshot + # Update an existing screenshot. + # @param project_id [String] Project ID + # @param id [String] ID + # @param screenshot_update [ScreenshotUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def screenshot_update(project_id, id, screenshot_update, opts = {}) + data, _status_code, _headers = screenshot_update_with_http_info(project_id, id, screenshot_update, opts) + data + end + + # Update a screenshot + # Update an existing screenshot. + # @param project_id [String] Project ID + # @param id [String] ID + # @param screenshot_update [ScreenshotUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def screenshot_update_with_http_info(project_id, id, screenshot_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ScreenshotsApi.screenshot_update ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling ScreenshotsApi.screenshot_update" + 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 ScreenshotsApi.screenshot_update" + end + # verify the required parameter 'screenshot_update' is set + if @api_client.config.client_side_validation && screenshot_update.nil? + fail ArgumentError, "Missing the required parameter 'screenshot_update' when calling ScreenshotsApi.screenshot_update" + end + # resource path + local_var_path = '/projects/{project_id}/screenshots/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(screenshot_update) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ScreenshotsApi#screenshot_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List screenshots + # List all screenshots for the given project. + # @param project_id [String] Project ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def screenshots_list(project_id, opts = {}) + data, _status_code, _headers = screenshots_list_with_http_info(project_id, opts) + data + end + + # List screenshots + # List all screenshots for the given project. + # @param project_id [String] Project ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def screenshots_list_with_http_info(project_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ScreenshotsApi.screenshots_list ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling ScreenshotsApi.screenshots_list" + end + # resource path + local_var_path = '/projects/{project_id}/screenshots'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['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] + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ScreenshotsApi#screenshots_list\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/api/spaces_api.rb b/lib/Phrase/api/spaces_api.rb new file mode 100644 index 0000000..09d9eeb --- /dev/null +++ b/lib/Phrase/api/spaces_api.rb @@ -0,0 +1,608 @@ +require 'cgi' + +module Phrase + class SpacesApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a Space + # Create a new Space. + # @param account_id [String] Account ID + # @param space_create [SpaceCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def space_create(account_id, space_create, opts = {}) + space_create_with_http_info(account_id, space_create, opts) + nil + end + + # Create a Space + # Create a new Space. + # @param account_id [String] Account ID + # @param space_create [SpaceCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def space_create_with_http_info(account_id, space_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SpacesApi.space_create ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling SpacesApi.space_create" + end + # verify the required parameter 'space_create' is set + if @api_client.config.client_side_validation && space_create.nil? + fail ArgumentError, "Missing the required parameter 'space_create' when calling SpacesApi.space_create" + end + # resource path + local_var_path = '/accounts/{account_id}/spaces'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(space_create) + + # return_type + return_type = opts[:return_type] + + # 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: SpacesApi#space_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete Space + # Delete the specified Space. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def space_delete(account_id, id, opts = {}) + space_delete_with_http_info(account_id, id, opts) + nil + end + + # Delete Space + # Delete the specified Space. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def space_delete_with_http_info(account_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SpacesApi.space_delete ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling SpacesApi.space_delete" + 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 SpacesApi.space_delete" + end + # resource path + local_var_path = '/accounts/{account_id}/spaces/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + 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] + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SpacesApi#space_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get Space + # Show the specified Space. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Space] + def space_show(account_id, id, opts = {}) + data, _status_code, _headers = space_show_with_http_info(account_id, id, opts) + data + end + + # Get Space + # Show the specified Space. + # @param account_id [String] Account ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Space)>, Integer, Hash)>] Response<(Space)> data, response status code and response headers + def space_show_with_http_info(account_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SpacesApi.space_show ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling SpacesApi.space_show" + 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 SpacesApi.space_show" + end + # resource path + local_var_path = '/accounts/{account_id}/spaces/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).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']) + 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] + + # return_type + return_type = opts[:return_type] || 'Space' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SpacesApi#space_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update Space + # Update the specified Space. + # @param account_id [String] Account ID + # @param id [String] ID + # @param space_update [SpaceUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Space] + def space_update(account_id, id, space_update, opts = {}) + data, _status_code, _headers = space_update_with_http_info(account_id, id, space_update, opts) + data + end + + # Update Space + # Update the specified Space. + # @param account_id [String] Account ID + # @param id [String] ID + # @param space_update [SpaceUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Space)>, Integer, Hash)>] Response<(Space)> data, response status code and response headers + def space_update_with_http_info(account_id, id, space_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SpacesApi.space_update ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling SpacesApi.space_update" + 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 SpacesApi.space_update" + end + # verify the required parameter 'space_update' is set + if @api_client.config.client_side_validation && space_update.nil? + fail ArgumentError, "Missing the required parameter 'space_update' when calling SpacesApi.space_update" + end + # resource path + local_var_path = '/accounts/{account_id}/spaces/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).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(space_update) + + # return_type + return_type = opts[:return_type] || 'Space' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SpacesApi#space_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List Spaces + # List all Spaces for the given account. + # @param account_id [String] Account ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def spaces_list(account_id, opts = {}) + data, _status_code, _headers = spaces_list_with_http_info(account_id, opts) + data + end + + # List Spaces + # List all Spaces for the given account. + # @param account_id [String] Account ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def spaces_list_with_http_info(account_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SpacesApi.spaces_list ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling SpacesApi.spaces_list" + end + # resource path + local_var_path = '/accounts/{account_id}/spaces'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['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] + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SpacesApi#spaces_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Add Project + # Adds an existing project to the space. + # @param account_id [String] Account ID + # @param space_id [String] Space ID + # @param spaces_projects_create [SpacesProjectsCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def spaces_projects_create(account_id, space_id, spaces_projects_create, opts = {}) + spaces_projects_create_with_http_info(account_id, space_id, spaces_projects_create, opts) + nil + end + + # Add Project + # Adds an existing project to the space. + # @param account_id [String] Account ID + # @param space_id [String] Space ID + # @param spaces_projects_create [SpacesProjectsCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def spaces_projects_create_with_http_info(account_id, space_id, spaces_projects_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SpacesApi.spaces_projects_create ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling SpacesApi.spaces_projects_create" + end + # verify the required parameter 'space_id' is set + if @api_client.config.client_side_validation && space_id.nil? + fail ArgumentError, "Missing the required parameter 'space_id' when calling SpacesApi.spaces_projects_create" + end + # verify the required parameter 'spaces_projects_create' is set + if @api_client.config.client_side_validation && spaces_projects_create.nil? + fail ArgumentError, "Missing the required parameter 'spaces_projects_create' when calling SpacesApi.spaces_projects_create" + end + # resource path + local_var_path = '/accounts/{account_id}/spaces/{space_id}/projects'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'space_id' + '}', CGI.escape(space_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(spaces_projects_create) + + # return_type + return_type = opts[:return_type] + + # 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: SpacesApi#spaces_projects_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Remove Project + # Removes a specified project from the specified space. + # @param account_id [String] Account ID + # @param space_id [String] Space ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def spaces_projects_delete(account_id, space_id, id, opts = {}) + spaces_projects_delete_with_http_info(account_id, space_id, id, opts) + nil + end + + # Remove Project + # Removes a specified project from the specified space. + # @param account_id [String] Account ID + # @param space_id [String] Space ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def spaces_projects_delete_with_http_info(account_id, space_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SpacesApi.spaces_projects_delete ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling SpacesApi.spaces_projects_delete" + end + # verify the required parameter 'space_id' is set + if @api_client.config.client_side_validation && space_id.nil? + fail ArgumentError, "Missing the required parameter 'space_id' when calling SpacesApi.spaces_projects_delete" + 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 SpacesApi.spaces_projects_delete" + end + # resource path + local_var_path = '/accounts/{account_id}/spaces/{space_id}/projects/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'space_id' + '}', CGI.escape(space_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + 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] + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SpacesApi#spaces_projects_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List Projects + # List all projects for the specified Space. + # @param account_id [String] Account ID + # @param space_id [String] Space ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def spaces_projects_list(account_id, space_id, opts = {}) + data, _status_code, _headers = spaces_projects_list_with_http_info(account_id, space_id, opts) + data + end + + # List Projects + # List all projects for the specified Space. + # @param account_id [String] Account ID + # @param space_id [String] Space ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def spaces_projects_list_with_http_info(account_id, space_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SpacesApi.spaces_projects_list ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling SpacesApi.spaces_projects_list" + end + # verify the required parameter 'space_id' is set + if @api_client.config.client_side_validation && space_id.nil? + fail ArgumentError, "Missing the required parameter 'space_id' when calling SpacesApi.spaces_projects_list" + end + # resource path + local_var_path = '/accounts/{account_id}/spaces/{space_id}/projects'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'space_id' + '}', CGI.escape(space_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['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] + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SpacesApi#spaces_projects_list\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/api/style_guides_api.rb b/lib/Phrase/api/style_guides_api.rb new file mode 100644 index 0000000..8320e8a --- /dev/null +++ b/lib/Phrase/api/style_guides_api.rb @@ -0,0 +1,376 @@ +require 'cgi' + +module Phrase + class StyleGuidesApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a style guide + # Create a new style guide. + # @param project_id [String] Project ID + # @param styleguide_create [StyleguideCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def styleguide_create(project_id, styleguide_create, opts = {}) + styleguide_create_with_http_info(project_id, styleguide_create, opts) + nil + end + + # Create a style guide + # Create a new style guide. + # @param project_id [String] Project ID + # @param styleguide_create [StyleguideCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def styleguide_create_with_http_info(project_id, styleguide_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: StyleGuidesApi.styleguide_create ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling StyleGuidesApi.styleguide_create" + end + # verify the required parameter 'styleguide_create' is set + if @api_client.config.client_side_validation && styleguide_create.nil? + fail ArgumentError, "Missing the required parameter 'styleguide_create' when calling StyleGuidesApi.styleguide_create" + end + # resource path + local_var_path = '/projects/{project_id}/styleguides'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(styleguide_create) + + # return_type + return_type = opts[:return_type] + + # 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: StyleGuidesApi#styleguide_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete a style guide + # Delete an existing style guide. + # @param project_id [String] Project ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def styleguide_delete(project_id, id, opts = {}) + styleguide_delete_with_http_info(project_id, id, opts) + nil + end + + # Delete a style guide + # Delete an existing style guide. + # @param project_id [String] Project ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def styleguide_delete_with_http_info(project_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: StyleGuidesApi.styleguide_delete ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling StyleGuidesApi.styleguide_delete" + 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 StyleGuidesApi.styleguide_delete" + end + # resource path + local_var_path = '/projects/{project_id}/styleguides/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + 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] + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: StyleGuidesApi#styleguide_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single style guide + # Get details on a single style guide. + # @param project_id [String] Project ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def styleguide_show(project_id, id, opts = {}) + data, _status_code, _headers = styleguide_show_with_http_info(project_id, id, opts) + data + end + + # Get a single style guide + # Get details on a single style guide. + # @param project_id [String] Project ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def styleguide_show_with_http_info(project_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: StyleGuidesApi.styleguide_show ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling StyleGuidesApi.styleguide_show" + 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 StyleGuidesApi.styleguide_show" + end + # resource path + local_var_path = '/projects/{project_id}/styleguides/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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']) + 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] + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: StyleGuidesApi#styleguide_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update a style guide + # Update an existing style guide. + # @param project_id [String] Project ID + # @param id [String] ID + # @param styleguide_update [StyleguideUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def styleguide_update(project_id, id, styleguide_update, opts = {}) + data, _status_code, _headers = styleguide_update_with_http_info(project_id, id, styleguide_update, opts) + data + end + + # Update a style guide + # Update an existing style guide. + # @param project_id [String] Project ID + # @param id [String] ID + # @param styleguide_update [StyleguideUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def styleguide_update_with_http_info(project_id, id, styleguide_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: StyleGuidesApi.styleguide_update ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling StyleGuidesApi.styleguide_update" + 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 StyleGuidesApi.styleguide_update" + end + # verify the required parameter 'styleguide_update' is set + if @api_client.config.client_side_validation && styleguide_update.nil? + fail ArgumentError, "Missing the required parameter 'styleguide_update' when calling StyleGuidesApi.styleguide_update" + end + # resource path + local_var_path = '/projects/{project_id}/styleguides/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(styleguide_update) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: StyleGuidesApi#styleguide_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List style guides + # List all styleguides for the given project. + # @param project_id [String] Project ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def styleguides_list(project_id, opts = {}) + data, _status_code, _headers = styleguides_list_with_http_info(project_id, opts) + data + end + + # List style guides + # List all styleguides for the given project. + # @param project_id [String] Project ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def styleguides_list_with_http_info(project_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: StyleGuidesApi.styleguides_list ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling StyleGuidesApi.styleguides_list" + end + # resource path + local_var_path = '/projects/{project_id}/styleguides'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['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] + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: StyleGuidesApi#styleguides_list\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/api/tags_api.rb b/lib/Phrase/api/tags_api.rb new file mode 100644 index 0000000..60ad9e3 --- /dev/null +++ b/lib/Phrase/api/tags_api.rb @@ -0,0 +1,320 @@ +require 'cgi' + +module Phrase + class TagsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a tag + # Create a new tag. + # @param project_id [String] Project ID + # @param tag_create [TagCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def tag_create(project_id, tag_create, opts = {}) + tag_create_with_http_info(project_id, tag_create, opts) + nil + end + + # Create a tag + # Create a new tag. + # @param project_id [String] Project ID + # @param tag_create [TagCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def tag_create_with_http_info(project_id, tag_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TagsApi.tag_create ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling TagsApi.tag_create" + end + # verify the required parameter 'tag_create' is set + if @api_client.config.client_side_validation && tag_create.nil? + fail ArgumentError, "Missing the required parameter 'tag_create' when calling TagsApi.tag_create" + end + # resource path + local_var_path = '/projects/{project_id}/tags'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(tag_create) + + # return_type + return_type = opts[:return_type] + + # 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: TagsApi#tag_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete a tag + # Delete an existing tag. + # @param project_id [String] Project ID + # @param name [String] name + # @param tag_delete [TagDelete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def tag_delete(project_id, name, tag_delete, opts = {}) + tag_delete_with_http_info(project_id, name, tag_delete, opts) + nil + end + + # Delete a tag + # Delete an existing tag. + # @param project_id [String] Project ID + # @param name [String] name + # @param tag_delete [TagDelete] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def tag_delete_with_http_info(project_id, name, tag_delete, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TagsApi.tag_delete ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling TagsApi.tag_delete" + end + # verify the required parameter 'name' is set + if @api_client.config.client_side_validation && name.nil? + fail ArgumentError, "Missing the required parameter 'name' when calling TagsApi.tag_delete" + end + # verify the required parameter 'tag_delete' is set + if @api_client.config.client_side_validation && tag_delete.nil? + fail ArgumentError, "Missing the required parameter 'tag_delete' when calling TagsApi.tag_delete" + end + # resource path + local_var_path = '/projects/{project_id}/tags/{name}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'name' + '}', CGI.escape(name.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(tag_delete) + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TagsApi#tag_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single tag + # Get details and progress information on a single tag for a given project. + # @param project_id [String] Project ID + # @param name [String] name + # @param tag_show [TagShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def tag_show(project_id, name, tag_show, opts = {}) + data, _status_code, _headers = tag_show_with_http_info(project_id, name, tag_show, opts) + data + end + + # Get a single tag + # Get details and progress information on a single tag for a given project. + # @param project_id [String] Project ID + # @param name [String] name + # @param tag_show [TagShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def tag_show_with_http_info(project_id, name, tag_show, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TagsApi.tag_show ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling TagsApi.tag_show" + end + # verify the required parameter 'name' is set + if @api_client.config.client_side_validation && name.nil? + fail ArgumentError, "Missing the required parameter 'name' when calling TagsApi.tag_show" + end + # verify the required parameter 'tag_show' is set + if @api_client.config.client_side_validation && tag_show.nil? + fail ArgumentError, "Missing the required parameter 'tag_show' when calling TagsApi.tag_show" + end + # resource path + local_var_path = '/projects/{project_id}/tags/{name}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'name' + '}', CGI.escape(name.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(tag_show) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TagsApi#tag_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List tags + # List all tags for the given project. + # @param project_id [String] Project ID + # @param tags_list [TagsList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def tags_list(project_id, tags_list, opts = {}) + data, _status_code, _headers = tags_list_with_http_info(project_id, tags_list, opts) + data + end + + # List tags + # List all tags for the given project. + # @param project_id [String] Project ID + # @param tags_list [TagsList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def tags_list_with_http_info(project_id, tags_list, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TagsApi.tags_list ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling TagsApi.tags_list" + end + # verify the required parameter 'tags_list' is set + if @api_client.config.client_side_validation && tags_list.nil? + fail ArgumentError, "Missing the required parameter 'tags_list' when calling TagsApi.tags_list" + end + # resource path + local_var_path = '/projects/{project_id}/tags'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # 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(tags_list) + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TagsApi#tags_list\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/api/translations_api.rb b/lib/Phrase/api/translations_api.rb new file mode 100644 index 0000000..e1f51af --- /dev/null +++ b/lib/Phrase/api/translations_api.rb @@ -0,0 +1,1344 @@ +require 'cgi' + +module Phrase + class TranslationsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a translation + # Create a translation. + # @param project_id [String] Project ID + # @param translation_create [TranslationCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def translation_create(project_id, translation_create, opts = {}) + translation_create_with_http_info(project_id, translation_create, opts) + nil + end + + # Create a translation + # Create a translation. + # @param project_id [String] Project ID + # @param translation_create [TranslationCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def translation_create_with_http_info(project_id, translation_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TranslationsApi.translation_create ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translation_create" + end + # verify the required parameter 'translation_create' is set + if @api_client.config.client_side_validation && translation_create.nil? + fail ArgumentError, "Missing the required parameter 'translation_create' when calling TranslationsApi.translation_create" + end + # resource path + local_var_path = '/projects/{project_id}/translations'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(translation_create) + + # return_type + return_type = opts[:return_type] + + # 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: TranslationsApi#translation_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Exclude a translation from export + # Set exclude from export flag on an existing translation. + # @param project_id [String] Project ID + # @param id [String] ID + # @param translation_exclude [TranslationExclude] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def translation_exclude(project_id, id, translation_exclude, opts = {}) + data, _status_code, _headers = translation_exclude_with_http_info(project_id, id, translation_exclude, opts) + data + end + + # Exclude a translation from export + # Set exclude from export flag on an existing translation. + # @param project_id [String] Project ID + # @param id [String] ID + # @param translation_exclude [TranslationExclude] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def translation_exclude_with_http_info(project_id, id, translation_exclude, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TranslationsApi.translation_exclude ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translation_exclude" + 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 TranslationsApi.translation_exclude" + end + # verify the required parameter 'translation_exclude' is set + if @api_client.config.client_side_validation && translation_exclude.nil? + fail ArgumentError, "Missing the required parameter 'translation_exclude' when calling TranslationsApi.translation_exclude" + end + # resource path + local_var_path = '/projects/{project_id}/translations/{id}/exclude'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(translation_exclude) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TranslationsApi#translation_exclude\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Revoke exclusion of a translation in export + # Remove exclude from export flag from an existing translation. + # @param project_id [String] Project ID + # @param id [String] ID + # @param translation_include [TranslationInclude] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def translation_include(project_id, id, translation_include, opts = {}) + data, _status_code, _headers = translation_include_with_http_info(project_id, id, translation_include, opts) + data + end + + # Revoke exclusion of a translation in export + # Remove exclude from export flag from an existing translation. + # @param project_id [String] Project ID + # @param id [String] ID + # @param translation_include [TranslationInclude] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def translation_include_with_http_info(project_id, id, translation_include, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TranslationsApi.translation_include ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translation_include" + 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 TranslationsApi.translation_include" + end + # verify the required parameter 'translation_include' is set + if @api_client.config.client_side_validation && translation_include.nil? + fail ArgumentError, "Missing the required parameter 'translation_include' when calling TranslationsApi.translation_include" + end + # resource path + local_var_path = '/projects/{project_id}/translations/{id}/include'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(translation_include) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TranslationsApi#translation_include\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Review a translation + # Mark an existing translation as reviewed. + # @param project_id [String] Project ID + # @param id [String] ID + # @param translation_review [TranslationReview] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def translation_review(project_id, id, translation_review, opts = {}) + data, _status_code, _headers = translation_review_with_http_info(project_id, id, translation_review, opts) + data + end + + # Review a translation + # Mark an existing translation as reviewed. + # @param project_id [String] Project ID + # @param id [String] ID + # @param translation_review [TranslationReview] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def translation_review_with_http_info(project_id, id, translation_review, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TranslationsApi.translation_review ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translation_review" + 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 TranslationsApi.translation_review" + end + # verify the required parameter 'translation_review' is set + if @api_client.config.client_side_validation && translation_review.nil? + fail ArgumentError, "Missing the required parameter 'translation_review' when calling TranslationsApi.translation_review" + end + # resource path + local_var_path = '/projects/{project_id}/translations/{id}/review'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(translation_review) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TranslationsApi#translation_review\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single translation + # Get details on a single translation. + # @param project_id [String] Project ID + # @param id [String] ID + # @param translation_show [TranslationShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def translation_show(project_id, id, translation_show, opts = {}) + data, _status_code, _headers = translation_show_with_http_info(project_id, id, translation_show, opts) + data + end + + # Get a single translation + # Get details on a single translation. + # @param project_id [String] Project ID + # @param id [String] ID + # @param translation_show [TranslationShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def translation_show_with_http_info(project_id, id, translation_show, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TranslationsApi.translation_show ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translation_show" + 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 TranslationsApi.translation_show" + end + # verify the required parameter 'translation_show' is set + if @api_client.config.client_side_validation && translation_show.nil? + fail ArgumentError, "Missing the required parameter 'translation_show' when calling TranslationsApi.translation_show" + end + # resource path + local_var_path = '/projects/{project_id}/translations/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(translation_show) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TranslationsApi#translation_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Mark a translation as unverified + # Mark an existing translation as unverified. + # @param project_id [String] Project ID + # @param id [String] ID + # @param translation_unverify [TranslationUnverify] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def translation_unverify(project_id, id, translation_unverify, opts = {}) + data, _status_code, _headers = translation_unverify_with_http_info(project_id, id, translation_unverify, opts) + data + end + + # Mark a translation as unverified + # Mark an existing translation as unverified. + # @param project_id [String] Project ID + # @param id [String] ID + # @param translation_unverify [TranslationUnverify] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def translation_unverify_with_http_info(project_id, id, translation_unverify, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TranslationsApi.translation_unverify ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translation_unverify" + 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 TranslationsApi.translation_unverify" + end + # verify the required parameter 'translation_unverify' is set + if @api_client.config.client_side_validation && translation_unverify.nil? + fail ArgumentError, "Missing the required parameter 'translation_unverify' when calling TranslationsApi.translation_unverify" + end + # resource path + local_var_path = '/projects/{project_id}/translations/{id}/unverify'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(translation_unverify) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TranslationsApi#translation_unverify\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update a translation + # Update an existing translation. + # @param project_id [String] Project ID + # @param id [String] ID + # @param translation_update [TranslationUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def translation_update(project_id, id, translation_update, opts = {}) + data, _status_code, _headers = translation_update_with_http_info(project_id, id, translation_update, opts) + data + end + + # Update a translation + # Update an existing translation. + # @param project_id [String] Project ID + # @param id [String] ID + # @param translation_update [TranslationUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def translation_update_with_http_info(project_id, id, translation_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TranslationsApi.translation_update ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translation_update" + 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 TranslationsApi.translation_update" + end + # verify the required parameter 'translation_update' is set + if @api_client.config.client_side_validation && translation_update.nil? + fail ArgumentError, "Missing the required parameter 'translation_update' when calling TranslationsApi.translation_update" + end + # resource path + local_var_path = '/projects/{project_id}/translations/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(translation_update) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TranslationsApi#translation_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Verify a translation + # Verify an existing translation. + # @param project_id [String] Project ID + # @param id [String] ID + # @param translation_verify [TranslationVerify] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def translation_verify(project_id, id, translation_verify, opts = {}) + data, _status_code, _headers = translation_verify_with_http_info(project_id, id, translation_verify, opts) + data + end + + # Verify a translation + # Verify an existing translation. + # @param project_id [String] Project ID + # @param id [String] ID + # @param translation_verify [TranslationVerify] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def translation_verify_with_http_info(project_id, id, translation_verify, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TranslationsApi.translation_verify ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translation_verify" + 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 TranslationsApi.translation_verify" + end + # verify the required parameter 'translation_verify' is set + if @api_client.config.client_side_validation && translation_verify.nil? + fail ArgumentError, "Missing the required parameter 'translation_verify' when calling TranslationsApi.translation_verify" + end + # resource path + local_var_path = '/projects/{project_id}/translations/{id}/verify'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(translation_verify) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TranslationsApi#translation_verify\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List translations by key + # List translations for a specific key. + # @param project_id [String] Project ID + # @param key_id [String] Translation Key ID + # @param translations_by_key [TranslationsByKey] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def translations_by_key(project_id, key_id, translations_by_key, opts = {}) + data, _status_code, _headers = translations_by_key_with_http_info(project_id, key_id, translations_by_key, opts) + data + end + + # List translations by key + # List translations for a specific key. + # @param project_id [String] Project ID + # @param key_id [String] Translation Key ID + # @param translations_by_key [TranslationsByKey] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def translations_by_key_with_http_info(project_id, key_id, translations_by_key, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TranslationsApi.translations_by_key ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translations_by_key" + end + # verify the required parameter 'key_id' is set + if @api_client.config.client_side_validation && key_id.nil? + fail ArgumentError, "Missing the required parameter 'key_id' when calling TranslationsApi.translations_by_key" + end + # verify the required parameter 'translations_by_key' is set + if @api_client.config.client_side_validation && translations_by_key.nil? + fail ArgumentError, "Missing the required parameter 'translations_by_key' when calling TranslationsApi.translations_by_key" + end + # resource path + local_var_path = '/projects/{project_id}/keys/{key_id}/translations'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'key_id' + '}', CGI.escape(key_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # 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(translations_by_key) + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TranslationsApi#translations_by_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List translations by locale + # List translations for a specific locale. If you want to download all translations for one locale we recommend to use the locales#download endpoint. + # @param project_id [String] Project ID + # @param locale_id [String] Locale ID + # @param translations_by_locale [TranslationsByLocale] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def translations_by_locale(project_id, locale_id, translations_by_locale, opts = {}) + data, _status_code, _headers = translations_by_locale_with_http_info(project_id, locale_id, translations_by_locale, opts) + data + end + + # List translations by locale + # List translations for a specific locale. If you want to download all translations for one locale we recommend to use the <code>locales#download</code> endpoint. + # @param project_id [String] Project ID + # @param locale_id [String] Locale ID + # @param translations_by_locale [TranslationsByLocale] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def translations_by_locale_with_http_info(project_id, locale_id, translations_by_locale, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TranslationsApi.translations_by_locale ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translations_by_locale" + end + # verify the required parameter 'locale_id' is set + if @api_client.config.client_side_validation && locale_id.nil? + fail ArgumentError, "Missing the required parameter 'locale_id' when calling TranslationsApi.translations_by_locale" + end + # verify the required parameter 'translations_by_locale' is set + if @api_client.config.client_side_validation && translations_by_locale.nil? + fail ArgumentError, "Missing the required parameter 'translations_by_locale' when calling TranslationsApi.translations_by_locale" + end + # resource path + local_var_path = '/projects/{project_id}/locales/{locale_id}/translations'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'locale_id' + '}', CGI.escape(locale_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # 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(translations_by_locale) + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TranslationsApi#translations_by_locale\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Set exclude from export flag on translations selected by query + # Exclude translations matching query from locale export. + # @param project_id [String] Project ID + # @param translations_exclude [TranslationsExclude] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def translations_exclude(project_id, translations_exclude, opts = {}) + data, _status_code, _headers = translations_exclude_with_http_info(project_id, translations_exclude, opts) + data + end + + # Set exclude from export flag on translations selected by query + # Exclude translations matching query from locale export. + # @param project_id [String] Project ID + # @param translations_exclude [TranslationsExclude] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def translations_exclude_with_http_info(project_id, translations_exclude, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TranslationsApi.translations_exclude ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translations_exclude" + end + # verify the required parameter 'translations_exclude' is set + if @api_client.config.client_side_validation && translations_exclude.nil? + fail ArgumentError, "Missing the required parameter 'translations_exclude' when calling TranslationsApi.translations_exclude" + end + # resource path + local_var_path = '/projects/{project_id}/translations/exclude'.sub('{' + 'project_id' + '}', CGI.escape(project_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(translations_exclude) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TranslationsApi#translations_exclude\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Remove exlude from import flag from translations selected by query + # Include translations matching query in locale export. + # @param project_id [String] Project ID + # @param translations_include [TranslationsInclude] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def translations_include(project_id, translations_include, opts = {}) + data, _status_code, _headers = translations_include_with_http_info(project_id, translations_include, opts) + data + end + + # Remove exlude from import flag from translations selected by query + # Include translations matching query in locale export. + # @param project_id [String] Project ID + # @param translations_include [TranslationsInclude] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def translations_include_with_http_info(project_id, translations_include, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TranslationsApi.translations_include ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translations_include" + end + # verify the required parameter 'translations_include' is set + if @api_client.config.client_side_validation && translations_include.nil? + fail ArgumentError, "Missing the required parameter 'translations_include' when calling TranslationsApi.translations_include" + end + # resource path + local_var_path = '/projects/{project_id}/translations/include'.sub('{' + 'project_id' + '}', CGI.escape(project_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(translations_include) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TranslationsApi#translations_include\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List all translations + # List translations for the given project. If you want to download all translations for one locale we recommend to use the locales#download endpoint. + # @param project_id [String] Project ID + # @param translations_list [TranslationsList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def translations_list(project_id, translations_list, opts = {}) + data, _status_code, _headers = translations_list_with_http_info(project_id, translations_list, opts) + data + end + + # List all translations + # List translations for the given project. If you want to download all translations for one locale we recommend to use the <code>locales#download</code> endpoint. + # @param project_id [String] Project ID + # @param translations_list [TranslationsList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def translations_list_with_http_info(project_id, translations_list, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TranslationsApi.translations_list ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translations_list" + end + # verify the required parameter 'translations_list' is set + if @api_client.config.client_side_validation && translations_list.nil? + fail ArgumentError, "Missing the required parameter 'translations_list' when calling TranslationsApi.translations_list" + end + # resource path + local_var_path = '/projects/{project_id}/translations'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # 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(translations_list) + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TranslationsApi#translations_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Review translations selected by query + # Review translations matching query. + # @param project_id [String] Project ID + # @param translations_review [TranslationsReview] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def translations_review(project_id, translations_review, opts = {}) + data, _status_code, _headers = translations_review_with_http_info(project_id, translations_review, opts) + data + end + + # Review translations selected by query + # Review translations matching query. + # @param project_id [String] Project ID + # @param translations_review [TranslationsReview] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def translations_review_with_http_info(project_id, translations_review, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TranslationsApi.translations_review ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translations_review" + end + # verify the required parameter 'translations_review' is set + if @api_client.config.client_side_validation && translations_review.nil? + fail ArgumentError, "Missing the required parameter 'translations_review' when calling TranslationsApi.translations_review" + end + # resource path + local_var_path = '/projects/{project_id}/translations/review'.sub('{' + 'project_id' + '}', CGI.escape(project_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(translations_review) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TranslationsApi#translations_review\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Search translations + # Search translations for the given project. Provides the same search interface as translations#index but allows POST requests to avoid limitations imposed by GET requests. If you want to download all translations for one locale we recommend to use the locales#download endpoint. + # @param project_id [String] Project ID + # @param translations_search [TranslationsSearch] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def translations_search(project_id, translations_search, opts = {}) + data, _status_code, _headers = translations_search_with_http_info(project_id, translations_search, opts) + data + end + + # Search translations + # Search translations for the given project. Provides the same search interface as <code>translations#index</code> but allows POST requests to avoid limitations imposed by GET requests. If you want to download all translations for one locale we recommend to use the <code>locales#download</code> endpoint. + # @param project_id [String] Project ID + # @param translations_search [TranslationsSearch] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def translations_search_with_http_info(project_id, translations_search, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TranslationsApi.translations_search ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translations_search" + end + # verify the required parameter 'translations_search' is set + if @api_client.config.client_side_validation && translations_search.nil? + fail ArgumentError, "Missing the required parameter 'translations_search' when calling TranslationsApi.translations_search" + end + # resource path + local_var_path = '/projects/{project_id}/translations/search'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # 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(translations_search) + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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: TranslationsApi#translations_search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Mark translations selected by query as unverified + # Mark translations matching query as unverified. + # @param project_id [String] Project ID + # @param translations_unverify [TranslationsUnverify] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def translations_unverify(project_id, translations_unverify, opts = {}) + data, _status_code, _headers = translations_unverify_with_http_info(project_id, translations_unverify, opts) + data + end + + # Mark translations selected by query as unverified + # Mark translations matching query as unverified. + # @param project_id [String] Project ID + # @param translations_unverify [TranslationsUnverify] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def translations_unverify_with_http_info(project_id, translations_unverify, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TranslationsApi.translations_unverify ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translations_unverify" + end + # verify the required parameter 'translations_unverify' is set + if @api_client.config.client_side_validation && translations_unverify.nil? + fail ArgumentError, "Missing the required parameter 'translations_unverify' when calling TranslationsApi.translations_unverify" + end + # resource path + local_var_path = '/projects/{project_id}/translations/unverify'.sub('{' + 'project_id' + '}', CGI.escape(project_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(translations_unverify) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TranslationsApi#translations_unverify\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Verify translations selected by query + # Verify translations matching query. + # @param project_id [String] Project ID + # @param translations_verify [TranslationsVerify] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [AffectedCount] + def translations_verify(project_id, translations_verify, opts = {}) + data, _status_code, _headers = translations_verify_with_http_info(project_id, translations_verify, opts) + data + end + + # Verify translations selected by query + # Verify translations matching query. + # @param project_id [String] Project ID + # @param translations_verify [TranslationsVerify] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(AffectedCount)>, Integer, Hash)>] Response<(AffectedCount)> data, response status code and response headers + def translations_verify_with_http_info(project_id, translations_verify, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TranslationsApi.translations_verify ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling TranslationsApi.translations_verify" + end + # verify the required parameter 'translations_verify' is set + if @api_client.config.client_side_validation && translations_verify.nil? + fail ArgumentError, "Missing the required parameter 'translations_verify' when calling TranslationsApi.translations_verify" + end + # resource path + local_var_path = '/projects/{project_id}/translations/verify'.sub('{' + 'project_id' + '}', CGI.escape(project_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(translations_verify) + + # return_type + return_type = opts[:return_type] || 'AffectedCount' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TranslationsApi#translations_verify\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/api/uploads_api.rb b/lib/Phrase/api/uploads_api.rb new file mode 100644 index 0000000..f13de9d --- /dev/null +++ b/lib/Phrase/api/uploads_api.rb @@ -0,0 +1,242 @@ +require 'cgi' + +module Phrase + class UploadsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Upload a new file + # Upload a new language file. Creates necessary resources in your project. + # @param project_id [String] Project ID + # @param upload_create [UploadCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def upload_create(project_id, upload_create, opts = {}) + upload_create_with_http_info(project_id, upload_create, opts) + nil + end + + # Upload a new file + # Upload a new language file. Creates necessary resources in your project. + # @param project_id [String] Project ID + # @param upload_create [UploadCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def upload_create_with_http_info(project_id, upload_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: UploadsApi.upload_create ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling UploadsApi.upload_create" + end + # verify the required parameter 'upload_create' is set + if @api_client.config.client_side_validation && upload_create.nil? + fail ArgumentError, "Missing the required parameter 'upload_create' when calling UploadsApi.upload_create" + end + # resource path + local_var_path = '/projects/{project_id}/uploads'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(upload_create) + + # return_type + return_type = opts[:return_type] + + # 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: UploadsApi#upload_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # View upload details + # View details and summary for a single upload. + # @param project_id [String] Project ID + # @param id [String] ID + # @param upload_show [UploadShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Upload] + def upload_show(project_id, id, upload_show, opts = {}) + data, _status_code, _headers = upload_show_with_http_info(project_id, id, upload_show, opts) + data + end + + # View upload details + # View details and summary for a single upload. + # @param project_id [String] Project ID + # @param id [String] ID + # @param upload_show [UploadShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Upload)>, Integer, Hash)>] Response<(Upload)> data, response status code and response headers + def upload_show_with_http_info(project_id, id, upload_show, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: UploadsApi.upload_show ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling UploadsApi.upload_show" + 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 UploadsApi.upload_show" + end + # verify the required parameter 'upload_show' is set + if @api_client.config.client_side_validation && upload_show.nil? + fail ArgumentError, "Missing the required parameter 'upload_show' when calling UploadsApi.upload_show" + end + # resource path + local_var_path = '/projects/{project_id}/uploads/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(upload_show) + + # return_type + return_type = opts[:return_type] || 'Upload' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: UploadsApi#upload_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List uploads + # List all uploads for the given project. + # @param project_id [String] Project ID + # @param uploads_list [UploadsList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def uploads_list(project_id, uploads_list, opts = {}) + data, _status_code, _headers = uploads_list_with_http_info(project_id, uploads_list, opts) + data + end + + # List uploads + # List all uploads for the given project. + # @param project_id [String] Project ID + # @param uploads_list [UploadsList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def uploads_list_with_http_info(project_id, uploads_list, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: UploadsApi.uploads_list ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling UploadsApi.uploads_list" + end + # verify the required parameter 'uploads_list' is set + if @api_client.config.client_side_validation && uploads_list.nil? + fail ArgumentError, "Missing the required parameter 'uploads_list' when calling UploadsApi.uploads_list" + end + # resource path + local_var_path = '/projects/{project_id}/uploads'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # 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(uploads_list) + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: UploadsApi#uploads_list\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/api/users_api.rb b/lib/Phrase/api/users_api.rb new file mode 100644 index 0000000..a24a504 --- /dev/null +++ b/lib/Phrase/api/users_api.rb @@ -0,0 +1,70 @@ +require 'cgi' + +module Phrase + class UsersApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Show current User + # Show details for current User. + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [User] + def show_user(opts = {}) + data, _status_code, _headers = show_user_with_http_info(opts) + data + end + + # Show current User + # Show details for current User. + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(User)>, Integer, Hash)>] Response<(User)> data, response status code and response headers + def show_user_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: UsersApi.show_user ...' + end + # resource path + local_var_path = '/user' + + # 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']) + 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] + + # return_type + return_type = opts[:return_type] || 'User' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: UsersApi#show_user\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/api/versions_history_api.rb b/lib/Phrase/api/versions_history_api.rb new file mode 100644 index 0000000..844897b --- /dev/null +++ b/lib/Phrase/api/versions_history_api.rb @@ -0,0 +1,182 @@ +require 'cgi' + +module Phrase + class VersionsHistoryApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Get a single version + # Get details on a single version. + # @param project_id [String] Project ID + # @param translation_id [String] Translation ID + # @param id [String] ID + # @param version_show [VersionShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def version_show(project_id, translation_id, id, version_show, opts = {}) + data, _status_code, _headers = version_show_with_http_info(project_id, translation_id, id, version_show, opts) + data + end + + # Get a single version + # Get details on a single version. + # @param project_id [String] Project ID + # @param translation_id [String] Translation ID + # @param id [String] ID + # @param version_show [VersionShow] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def version_show_with_http_info(project_id, translation_id, id, version_show, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: VersionsHistoryApi.version_show ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling VersionsHistoryApi.version_show" + end + # verify the required parameter 'translation_id' is set + if @api_client.config.client_side_validation && translation_id.nil? + fail ArgumentError, "Missing the required parameter 'translation_id' when calling VersionsHistoryApi.version_show" + 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 VersionsHistoryApi.version_show" + end + # verify the required parameter 'version_show' is set + if @api_client.config.client_side_validation && version_show.nil? + fail ArgumentError, "Missing the required parameter 'version_show' when calling VersionsHistoryApi.version_show" + end + # resource path + local_var_path = '/projects/{project_id}/translations/{translation_id}/versions/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'translation_id' + '}', CGI.escape(translation_id.to_s)).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(version_show) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: VersionsHistoryApi#version_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List all versions + # List all versions for the given translation. + # @param project_id [String] Project ID + # @param translation_id [String] Translation ID + # @param versions_list [VersionsList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def versions_list(project_id, translation_id, versions_list, opts = {}) + data, _status_code, _headers = versions_list_with_http_info(project_id, translation_id, versions_list, opts) + data + end + + # List all versions + # List all versions for the given translation. + # @param project_id [String] Project ID + # @param translation_id [String] Translation ID + # @param versions_list [VersionsList] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def versions_list_with_http_info(project_id, translation_id, versions_list, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: VersionsHistoryApi.versions_list ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling VersionsHistoryApi.versions_list" + end + # verify the required parameter 'translation_id' is set + if @api_client.config.client_side_validation && translation_id.nil? + fail ArgumentError, "Missing the required parameter 'translation_id' when calling VersionsHistoryApi.versions_list" + end + # verify the required parameter 'versions_list' is set + if @api_client.config.client_side_validation && versions_list.nil? + fail ArgumentError, "Missing the required parameter 'versions_list' when calling VersionsHistoryApi.versions_list" + end + # resource path + local_var_path = '/projects/{project_id}/translations/{translation_id}/versions'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'translation_id' + '}', CGI.escape(translation_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # 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(versions_list) + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: VersionsHistoryApi#versions_list\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/api/webhooks_api.rb b/lib/Phrase/api/webhooks_api.rb new file mode 100644 index 0000000..f350e67 --- /dev/null +++ b/lib/Phrase/api/webhooks_api.rb @@ -0,0 +1,446 @@ +require 'cgi' + +module Phrase + class WebhooksApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a webhook + # Create a new webhook. + # @param project_id [String] Project ID + # @param webhook_create [WebhookCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def webhook_create(project_id, webhook_create, opts = {}) + webhook_create_with_http_info(project_id, webhook_create, opts) + nil + end + + # Create a webhook + # Create a new webhook. + # @param project_id [String] Project ID + # @param webhook_create [WebhookCreate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def webhook_create_with_http_info(project_id, webhook_create, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksApi.webhook_create ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling WebhooksApi.webhook_create" + end + # verify the required parameter 'webhook_create' is set + if @api_client.config.client_side_validation && webhook_create.nil? + fail ArgumentError, "Missing the required parameter 'webhook_create' when calling WebhooksApi.webhook_create" + end + # resource path + local_var_path = '/projects/{project_id}/webhooks'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # 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(webhook_create) + + # return_type + return_type = opts[:return_type] + + # 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: WebhooksApi#webhook_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Delete a webhook + # Delete an existing webhook. + # @param project_id [String] Project ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def webhook_delete(project_id, id, opts = {}) + webhook_delete_with_http_info(project_id, id, opts) + nil + end + + # Delete a webhook + # Delete an existing webhook. + # @param project_id [String] Project ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def webhook_delete_with_http_info(project_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksApi.webhook_delete ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling WebhooksApi.webhook_delete" + 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 WebhooksApi.webhook_delete" + end + # resource path + local_var_path = '/projects/{project_id}/webhooks/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + 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] + + # return_type + return_type = opts[:return_type] + + # 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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhooksApi#webhook_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single webhook + # Get details on a single webhook. + # @param project_id [String] Project ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Webhook] + def webhook_show(project_id, id, opts = {}) + data, _status_code, _headers = webhook_show_with_http_info(project_id, id, opts) + data + end + + # Get a single webhook + # Get details on a single webhook. + # @param project_id [String] Project ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Webhook)>, Integer, Hash)>] Response<(Webhook)> data, response status code and response headers + def webhook_show_with_http_info(project_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksApi.webhook_show ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling WebhooksApi.webhook_show" + 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 WebhooksApi.webhook_show" + end + # resource path + local_var_path = '/projects/{project_id}/webhooks/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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']) + 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] + + # return_type + return_type = opts[:return_type] || 'Webhook' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhooksApi#webhook_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Test a webhook + # Perform a test request for a webhook. + # @param project_id [String] Project ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + def webhook_test(project_id, id, opts = {}) + webhook_test_with_http_info(project_id, id, opts) + nil + end + + # Test a webhook + # Perform a test request for a webhook. + # @param project_id [String] Project ID + # @param id [String] ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(nil)>, Integer, Hash)>] Response<(nil, response status code and response headers + def webhook_test_with_http_info(project_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksApi.webhook_test ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling WebhooksApi.webhook_test" + 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 WebhooksApi.webhook_test" + end + # resource path + local_var_path = '/projects/{project_id}/webhooks/{id}/test'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + 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] + + # return_type + return_type = opts[:return_type] + + # 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: WebhooksApi#webhook_test\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Update a webhook + # Update an existing webhook. + # @param project_id [String] Project ID + # @param id [String] ID + # @param webhook_update [WebhookUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + def webhook_update(project_id, id, webhook_update, opts = {}) + data, _status_code, _headers = webhook_update_with_http_info(project_id, id, webhook_update, opts) + data + end + + # Update a webhook + # Update an existing webhook. + # @param project_id [String] Project ID + # @param id [String] ID + # @param webhook_update [WebhookUpdate] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Object)>, Integer, Hash)>] Response<(Object)> data, response status code and response headers + def webhook_update_with_http_info(project_id, id, webhook_update, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksApi.webhook_update ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling WebhooksApi.webhook_update" + 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 WebhooksApi.webhook_update" + end + # verify the required parameter 'webhook_update' is set + if @api_client.config.client_side_validation && webhook_update.nil? + fail ArgumentError, "Missing the required parameter 'webhook_update' when calling WebhooksApi.webhook_update" + end + # resource path + local_var_path = '/projects/{project_id}/webhooks/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).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(webhook_update) + + # return_type + return_type = opts[:return_type] || 'Object' + + # 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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhooksApi#webhook_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # List webhooks + # List all webhooks for the given project. + # @param project_id [String] Project ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + def webhooks_list(project_id, opts = {}) + data, _status_code, _headers = webhooks_list_with_http_info(project_id, opts) + data + end + + # List webhooks + # List all webhooks for the given project. + # @param project_id [String] Project ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def webhooks_list_with_http_info(project_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksApi.webhooks_list ...' + end + # verify the required parameter 'project_id' is set + if @api_client.config.client_side_validation && project_id.nil? + fail ArgumentError, "Missing the required parameter 'project_id' when calling WebhooksApi.webhooks_list" + end + # resource path + local_var_path = '/projects/{project_id}/webhooks'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['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] + + # return_type + return_type = opts[:return_type] || 'Array' + + # 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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhooksApi#webhooks_list\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/api_client.rb b/lib/Phrase/api_client.rb new file mode 100644 index 0000000..85b57c8 --- /dev/null +++ b/lib/Phrase/api_client.rb @@ -0,0 +1,376 @@ +require 'date' +require 'json' +require 'logger' +require 'tempfile' +require 'typhoeus' + +module Phrase + class ApiClient + # The Configuration object holding settings to be used in the API client. + attr_accessor :config + + # Defines the headers to be used in HTTP requests of all API calls by default. + # + # @return [Hash] + attr_accessor :default_headers + + # Initializes the ApiClient + # @option config [Configuration] Configuration for initializing the object, default to Configuration.default + def initialize(config = Configuration.default) + @config = config + @user_agent = "OpenAPI-Generator/#{VERSION}/ruby" + @default_headers = { + 'Content-Type' => 'application/json', + 'User-Agent' => @user_agent + } + end + + def self.default + @@default ||= ApiClient.new + end + + # Call an API with given options. + # + # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: + # the data deserialized from response body (could be nil), response status code and response headers. + def call_api(http_method, path, opts = {}) + request = build_request(http_method, path, opts) + response = request.run + + if @config.debugging + @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" + end + + unless response.success? + if response.timed_out? + fail ApiError.new('Connection timed out') + elsif response.code == 0 + # Errors from libcurl will be made visible here + fail ApiError.new(:code => 0, + :message => response.return_message) + else + fail ApiError.new(:code => response.code, + :response_headers => response.headers, + :response_body => response.body), + response.status_message + end + end + + if opts[:return_type] + data = deserialize(response, opts[:return_type]) + else + data = nil + end + return data, response.code, response.headers + end + + # Builds the HTTP request + # + # @param [String] http_method HTTP method/verb (e.g. POST) + # @param [String] path URL path (e.g. /account/new) + # @option opts [Hash] :header_params Header parameters + # @option opts [Hash] :query_params Query parameters + # @option opts [Hash] :form_params Query parameters + # @option opts [Object] :body HTTP body (JSON/XML) + # @return [Typhoeus::Request] A Typhoeus Request + def build_request(http_method, path, opts = {}) + url = build_request_url(path) + http_method = http_method.to_sym.downcase + + header_params = @default_headers.merge(opts[:header_params] || {}) + query_params = opts[:query_params] || {} + form_params = opts[:form_params] || {} + + update_params_for_auth! header_params, query_params, opts[:auth_names] + + # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false) + _verify_ssl_host = @config.verify_ssl_host ? 2 : 0 + + req_opts = { + :method => http_method, + :headers => header_params, + :params => query_params, + :params_encoding => @config.params_encoding, + :timeout => @config.timeout, + :ssl_verifypeer => @config.verify_ssl, + :ssl_verifyhost => _verify_ssl_host, + :sslcert => @config.cert_file, + :sslkey => @config.key_file, + :verbose => @config.debugging + } + + # set custom cert, if provided + req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert + + if [:post, :patch, :put, :delete].include?(http_method) + req_body = build_request_body(header_params, form_params, opts[:body]) + req_opts.update :body => req_body + if @config.debugging + @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" + end + end + + request = Typhoeus::Request.new(url, req_opts) + download_file(request) if opts[:return_type] == 'File' + request + end + + # Builds the HTTP request body + # + # @param [Hash] header_params Header parameters + # @param [Hash] form_params Query parameters + # @param [Object] body HTTP body (JSON/XML) + # @return [String] HTTP body data in the form of string + def build_request_body(header_params, form_params, body) + # http form + if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || + header_params['Content-Type'] == 'multipart/form-data' + data = {} + form_params.each do |key, value| + case value + when ::File, ::Array, nil + # let typhoeus handle File, Array and nil parameters + data[key] = value + else + data[key] = value.to_s + end + end + elsif body + data = body.is_a?(String) ? body : body.to_json + else + data = nil + end + data + end + + # Check if the given MIME is a JSON MIME. + # JSON MIME examples: + # application/json + # application/json; charset=UTF8 + # APPLICATION/JSON + # */* + # @param [String] mime MIME + # @return [Boolean] True if the MIME is application/json + def json_mime?(mime) + (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + end + + # Deserialize the response to the given return type. + # + # @param [Response] response HTTP response + # @param [String] return_type some examples: "User", "Array", "Hash" + def deserialize(response, return_type) + body = response.body + + # handle file downloading - return the File instance processed in request callbacks + # note that response body is empty when the file is written in chunks in request on_body callback + return @tempfile if return_type == 'File' + + return nil if body.nil? || body.empty? + + # return response body directly for String return type + return body if return_type == 'String' + + # ensuring a default content type + content_type = response.headers['Content-Type'] || 'application/json' + + fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) + + begin + data = JSON.parse("[#{body}]", :symbolize_names => true)[0] + rescue JSON::ParserError => e + if %w(String Date DateTime).include?(return_type) + data = body + else + raise e + end + end + + convert_to_type data, return_type + end + + # Convert data to the given return type. + # @param [Object] data Data to be converted + # @param [String] return_type Return type + # @return [Mixed] Data in a particular type + def convert_to_type(data, return_type) + return nil if data.nil? + case return_type + when 'String' + data.to_s + when 'Integer' + data.to_i + when 'Float' + data.to_f + when 'Boolean' + data == true + when 'DateTime' + # parse date time (expecting ISO 8601 format) + DateTime.parse data + when 'Date' + # parse date time (expecting ISO 8601 format) + Date.parse data + when 'Object' + # generic object (usually a Hash), return directly + data + when /\AArray<(.+)>\z/ + # e.g. Array + sub_type = $1 + data.map { |item| convert_to_type(item, sub_type) } + when /\AHash\\z/ + # e.g. Hash + sub_type = $1 + {}.tap do |hash| + data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } + end + else + # models, e.g. Pet + Phrase.const_get(return_type).build_from_hash(data) + end + end + + # Save response body into a file in (the defined) temporary folder, using the filename + # from the "Content-Disposition" header if provided, otherwise a random filename. + # The response body is written to the file in chunks in order to handle files which + # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby + # process can use. + # + # @see Configuration#temp_folder_path + def download_file(request) + tempfile = nil + encoding = nil + request.on_headers do |response| + content_disposition = response.headers['Content-Disposition'] + if content_disposition && content_disposition =~ /filename=/i + filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] + prefix = sanitize_filename(filename) + else + prefix = 'download-' + end + prefix = prefix + '-' unless prefix.end_with?('-') + encoding = response.body.encoding + tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) + @tempfile = tempfile + end + request.on_body do |chunk| + chunk.force_encoding(encoding) + tempfile.write(chunk) + end + request.on_complete do |response| + if tempfile + tempfile.close + @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ + "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ + "will be deleted automatically with GC. It's also recommended to delete the temp file "\ + "explicitly with `tempfile.delete`" + end + end + end + + # Sanitize filename by removing path. + # e.g. ../../sun.gif becomes sun.gif + # + # @param [String] filename the filename to be sanitized + # @return [String] the sanitized filename + def sanitize_filename(filename) + filename.gsub(/.*[\/\\]/, '') + end + + def build_request_url(path) + # Add leading and trailing slashes to path + path = "/#{path}".gsub(/\/+/, '/') + @config.base_url + path + end + + # Update hearder and query params based on authentication settings. + # + # @param [Hash] header_params Header parameters + # @param [Hash] query_params Query parameters + # @param [String] auth_names Authentication scheme name + def update_params_for_auth!(header_params, query_params, auth_names) + Array(auth_names).each do |auth_name| + auth_setting = @config.auth_settings[auth_name] + next unless auth_setting + case auth_setting[:in] + when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] + when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] + else fail ArgumentError, 'Authentication token must be in `query` of `header`' + end + end + end + + # Sets user agent in HTTP header + # + # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) + def user_agent=(user_agent) + @user_agent = user_agent + @default_headers['User-Agent'] = @user_agent + end + + # Return Accept header based on an array of accepts provided. + # @param [Array] accepts array for Accept + # @return [String] the Accept header (e.g. application/json) + def select_header_accept(accepts) + return nil if accepts.nil? || accepts.empty? + # use JSON when present, otherwise use all of the provided + json_accept = accepts.find { |s| json_mime?(s) } + json_accept || accepts.join(',') + end + + # Return Content-Type header based on an array of content types provided. + # @param [Array] content_types array for Content-Type + # @return [String] the Content-Type header (e.g. application/json) + def select_header_content_type(content_types) + # use application/json by default + return 'application/json' if content_types.nil? || content_types.empty? + # use JSON when present, otherwise use the first one + json_content_type = content_types.find { |s| json_mime?(s) } + json_content_type || content_types.first + end + + # Convert object (array, hash, object, etc) to JSON string. + # @param [Object] model object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_http_body(model) + return model if model.nil? || model.is_a?(String) + local_body = nil + if model.is_a?(Array) + local_body = model.map { |m| object_to_hash(m) } + else + local_body = object_to_hash(model) + end + local_body.to_json + end + + # Convert object(non-array) to hash. + # @param [Object] obj object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_hash(obj) + if obj.respond_to?(:to_hash) + obj.to_hash + else + obj + end + end + + # Build parameter value according to the given collection format. + # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi + def build_collection_param(param, collection_format) + case collection_format + when :csv + param.join(',') + when :ssv + param.join(' ') + when :tsv + param.join("\t") + when :pipes + param.join('|') + when :multi + # return the array directly as typhoeus will handle it as expected + param + else + fail "unknown collection format: #{collection_format.inspect}" + end + end + end +end diff --git a/lib/Phrase/api_error.rb b/lib/Phrase/api_error.rb new file mode 100644 index 0000000..f5e2cfc --- /dev/null +++ b/lib/Phrase/api_error.rb @@ -0,0 +1,45 @@ +module Phrase + class ApiError < StandardError + attr_reader :code, :response_headers, :response_body + + # Usage examples: + # ApiError.new + # ApiError.new("message") + # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") + # ApiError.new(:code => 404, :message => "Not Found") + def initialize(arg = nil) + if arg.is_a? Hash + if arg.key?(:message) || arg.key?('message') + super(arg[:message] || arg['message']) + else + super arg + end + + arg.each do |k, v| + instance_variable_set "@#{k}", v + end + else + super arg + end + end + + # Override to_s to display a friendly error message + def to_s + message + end + + def message + if @message.nil? + msg = "Error message: the server returns an error" + else + msg = @message + end + + msg += "\nHTTP status code: #{code}" if code + msg += "\nResponse headers: #{response_headers}" if response_headers + msg += "\nResponse body: #{response_body}" if response_body + + msg + end + end +end diff --git a/lib/Phrase/configuration.rb b/lib/Phrase/configuration.rb new file mode 100644 index 0000000..9d5d69f --- /dev/null +++ b/lib/Phrase/configuration.rb @@ -0,0 +1,243 @@ +module Phrase + class Configuration + # Defines url scheme + attr_accessor :scheme + + # Defines url host + attr_accessor :host + + # Defines url base path + attr_accessor :base_path + + # Defines API keys used with API Key authentications. + # + # @return [Hash] key: parameter name, value: parameter value (API key) + # + # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) + # config.api_key['api_key'] = 'xxx' + attr_accessor :api_key + + # Defines API key prefixes used with API Key authentications. + # + # @return [Hash] key: parameter name, value: API key prefix + # + # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) + # config.api_key_prefix['api_key'] = 'Token' + attr_accessor :api_key_prefix + + # Defines the username used with HTTP basic authentication. + # + # @return [String] + attr_accessor :username + + # Defines the password used with HTTP basic authentication. + # + # @return [String] + attr_accessor :password + + # Defines the access token (Bearer) used with OAuth2. + attr_accessor :access_token + + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response + # details will be logged with `logger.debug` (see the `logger` attribute). + # Default to false. + # + # @return [true, false] + attr_accessor :debugging + + # Defines the logger used for debugging. + # Default to `Rails.logger` (when in Rails) or logging to STDOUT. + # + # @return [#debug] + attr_accessor :logger + + # Defines the temporary folder to store downloaded files + # (for API endpoints that have file response). + # Default to use `Tempfile`. + # + # @return [String] + attr_accessor :temp_folder_path + + # The time limit for HTTP request in seconds. + # Default to 0 (never times out). + attr_accessor :timeout + + # Set this to false to skip client side validation in the operation. + # Default to true. + # @return [true, false] + attr_accessor :client_side_validation + + ### TLS/SSL setting + # Set this to false to skip verifying SSL certificate when calling API from https server. + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl + + ### TLS/SSL setting + # Set this to false to skip verifying SSL host name + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl_host + + ### TLS/SSL setting + # Set this to customize the certificate file to verify the peer. + # + # @return [String] the path to the certificate file + # + # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: + # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 + attr_accessor :ssl_ca_cert + + ### TLS/SSL setting + # Client certificate file (for client certificate) + attr_accessor :cert_file + + ### TLS/SSL setting + # Client private key file (for client certificate) + attr_accessor :key_file + + # Set this to customize parameters encoding of array parameter with multi collectionFormat. + # Default to nil. + # + # @see The params_encoding option of Ethon. Related source code: + # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 + attr_accessor :params_encoding + + attr_accessor :inject_format + + attr_accessor :force_ending_format + + def initialize + @scheme = 'https' + @host = 'api.phrase.com' + @base_path = '/v2' + @api_key = {} + @api_key_prefix = {} + @timeout = 0 + @client_side_validation = true + @verify_ssl = true + @verify_ssl_host = true + @params_encoding = nil + @cert_file = nil + @key_file = nil + @debugging = false + @inject_format = false + @force_ending_format = false + @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) + + yield(self) if block_given? + end + + # The default Configuration object. + def self.default + @@default ||= Configuration.new + end + + def configure + yield(self) if block_given? + end + + def scheme=(scheme) + # remove :// from scheme + @scheme = scheme.sub(/:\/\//, '') + end + + def host=(host) + # remove http(s):// and anything after a slash + @host = host.sub(/https?:\/\//, '').split('/').first + end + + def base_path=(base_path) + # Add leading and trailing slashes to base_path + @base_path = "/#{base_path}".gsub(/\/+/, '/') + @base_path = '' if @base_path == '/' + end + + def base_url + "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') + end + + # Gets API key (with prefix if set). + # @param [String] param_name the parameter name of API key auth + def api_key_with_prefix(param_name) + if @api_key_prefix[param_name] + "#{@api_key_prefix[param_name]} #{@api_key[param_name]}" + else + @api_key[param_name] + end + end + + # Gets Basic Auth token string + def basic_auth_token + 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") + end + + # Returns Auth Settings hash for api client. + def auth_settings + { + 'Basic' => + { + type: 'basic', + in: 'header', + key: 'Authorization', + value: basic_auth_token + }, + 'Token' => + { + type: 'api_key', + in: 'header', + key: 'Authorization', + value: api_key_with_prefix('Authorization') + }, + } + end + + # Returns an array of Server setting + def server_settings + [ + { + url: "https://api.phrase.com/v2", + description: "No description provided", + } + ] + end + + # Returns URL based on server settings + # + # @param index array index of the server settings + # @param variables hash of variable and the corresponding value + def server_url(index, variables = {}) + servers = server_settings + + # check array index out of bound + if (index < 0 || index >= servers.size) + fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}" + end + + server = servers[index] + url = server[:url] + + # go through variable and assign a value + server[:variables].each do |name, variable| + if variables.key?(name) + if (server[:variables][name][:enum_values].include? variables[name]) + url.gsub! "{" + name.to_s + "}", variables[name] + else + fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." + end + else + # use default value + url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] + end + end + + url + end + end +end diff --git a/lib/Phrase/models/account.rb b/lib/Phrase/models/account.rb new file mode 100644 index 0000000..c55393c --- /dev/null +++ b/lib/Phrase/models/account.rb @@ -0,0 +1,230 @@ +require 'date' + +module Phrase + class Account + attr_accessor :id + + attr_accessor :name + + attr_accessor :company + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'company' => :'company', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'company' => :'String', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime' + } + 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::Account` 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::Account`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'company') + self.company = attributes[:'company'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 && + id == o.id && + name == o.name && + company == o.company && + created_at == o.created_at && + updated_at == o.updated_at + 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 + [id, name, company, created_at, updated_at].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 :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/affected_count.rb b/lib/Phrase/models/affected_count.rb new file mode 100644 index 0000000..b63a5bb --- /dev/null +++ b/lib/Phrase/models/affected_count.rb @@ -0,0 +1,194 @@ +require 'date' + +module Phrase + class AffectedCount + attr_accessor :records_affected + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'records_affected' => :'records_affected' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'records_affected' => :'Integer' + } + 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::AffectedCount` 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::AffectedCount`. 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?(:'records_affected') + self.records_affected = attributes[:'records_affected'] + 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 && + records_affected == o.records_affected + 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 + [records_affected].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 :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/affected_resources.rb b/lib/Phrase/models/affected_resources.rb new file mode 100644 index 0000000..1a43fb3 --- /dev/null +++ b/lib/Phrase/models/affected_resources.rb @@ -0,0 +1,194 @@ +require 'date' + +module Phrase + class AffectedResources + attr_accessor :records_affected + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'records_affected' => :'records_affected' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'records_affected' => :'Integer' + } + 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::AffectedResources` 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::AffectedResources`. 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?(:'records_affected') + self.records_affected = attributes[:'records_affected'] + 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 && + records_affected == o.records_affected + 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 + [records_affected].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 :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/authorization.rb b/lib/Phrase/models/authorization.rb new file mode 100644 index 0000000..34fda68 --- /dev/null +++ b/lib/Phrase/models/authorization.rb @@ -0,0 +1,259 @@ +require 'date' + +module Phrase + class Authorization + attr_accessor :id + + attr_accessor :note + + attr_accessor :token_last_eight + + attr_accessor :hashed_token + + attr_accessor :scopes + + attr_accessor :expires_at + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'note' => :'note', + :'token_last_eight' => :'token_last_eight', + :'hashed_token' => :'hashed_token', + :'scopes' => :'scopes', + :'expires_at' => :'expires_at', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'note' => :'String', + :'token_last_eight' => :'String', + :'hashed_token' => :'String', + :'scopes' => :'Array', + :'expires_at' => :'DateTime', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime' + } + 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::Authorization` 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::Authorization`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'note') + self.note = attributes[:'note'] + end + + if attributes.key?(:'token_last_eight') + self.token_last_eight = attributes[:'token_last_eight'] + end + + if attributes.key?(:'hashed_token') + self.hashed_token = attributes[:'hashed_token'] + end + + if attributes.key?(:'scopes') + if (value = attributes[:'scopes']).is_a?(Array) + self.scopes = value + end + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 && + id == o.id && + note == o.note && + token_last_eight == o.token_last_eight && + hashed_token == o.hashed_token && + scopes == o.scopes && + expires_at == o.expires_at && + created_at == o.created_at && + updated_at == o.updated_at + 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 + [id, note, token_last_eight, hashed_token, scopes, expires_at, created_at, updated_at].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 :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/authorization_create.rb b/lib/Phrase/models/authorization_create.rb new file mode 100644 index 0000000..9ea10a6 --- /dev/null +++ b/lib/Phrase/models/authorization_create.rb @@ -0,0 +1,215 @@ +require 'date' + +module Phrase + class AuthorizationCreate + # A note to help you remember what the access is used for. + attr_accessor :note + + # A list of scopes that the access can be used for. + attr_accessor :scopes + + # Expiration date for the authorization token. Null means no expiration date (default). + attr_accessor :expires_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'note' => :'note', + :'scopes' => :'scopes', + :'expires_at' => :'expires_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'note' => :'String', + :'scopes' => :'String', + :'expires_at' => :'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::AuthorizationCreate` 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::AuthorizationCreate`. 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?(:'note') + self.note = attributes[:'note'] + end + + if attributes.key?(:'scopes') + self.scopes = attributes[:'scopes'] + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + 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 && + note == o.note && + scopes == o.scopes && + expires_at == o.expires_at + 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 + [note, scopes, expires_at].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 :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/authorization_update.rb b/lib/Phrase/models/authorization_update.rb new file mode 100644 index 0000000..730614f --- /dev/null +++ b/lib/Phrase/models/authorization_update.rb @@ -0,0 +1,215 @@ +require 'date' + +module Phrase + class AuthorizationUpdate + # A note to help you remember what the access is used for. + attr_accessor :note + + # A list of scopes that the access can be used for. + attr_accessor :scopes + + # Expiration date for the authorization token. Null means no expiration date (default). + attr_accessor :expires_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'note' => :'note', + :'scopes' => :'scopes', + :'expires_at' => :'expires_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'note' => :'String', + :'scopes' => :'String', + :'expires_at' => :'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::AuthorizationUpdate` 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::AuthorizationUpdate`. 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?(:'note') + self.note = attributes[:'note'] + end + + if attributes.key?(:'scopes') + self.scopes = attributes[:'scopes'] + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + 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 && + note == o.note && + scopes == o.scopes && + expires_at == o.expires_at + 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 + [note, scopes, expires_at].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 :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/bitbucket_sync.rb b/lib/Phrase/models/bitbucket_sync.rb new file mode 100644 index 0000000..e24dbfc --- /dev/null +++ b/lib/Phrase/models/bitbucket_sync.rb @@ -0,0 +1,241 @@ +require 'date' + +module Phrase + class BitbucketSync + attr_accessor :id + + attr_accessor :repository_name + + attr_accessor :last_export_to_bitbucket_at + + attr_accessor :last_import_from_bitbucket_at + + attr_accessor :valid_phraseapp_yaml + + attr_accessor :phraseapp_projects + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'repository_name' => :'repository_name', + :'last_export_to_bitbucket_at' => :'last_export_to_bitbucket_at', + :'last_import_from_bitbucket_at' => :'last_import_from_bitbucket_at', + :'valid_phraseapp_yaml' => :'valid_phraseapp_yaml', + :'phraseapp_projects' => :'phraseapp_projects' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'repository_name' => :'String', + :'last_export_to_bitbucket_at' => :'DateTime', + :'last_import_from_bitbucket_at' => :'DateTime', + :'valid_phraseapp_yaml' => :'Boolean', + :'phraseapp_projects' => :'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::BitbucketSync` 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::BitbucketSync`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'repository_name') + self.repository_name = attributes[:'repository_name'] + end + + if attributes.key?(:'last_export_to_bitbucket_at') + self.last_export_to_bitbucket_at = attributes[:'last_export_to_bitbucket_at'] + end + + if attributes.key?(:'last_import_from_bitbucket_at') + self.last_import_from_bitbucket_at = attributes[:'last_import_from_bitbucket_at'] + end + + if attributes.key?(:'valid_phraseapp_yaml') + self.valid_phraseapp_yaml = attributes[:'valid_phraseapp_yaml'] + end + + if attributes.key?(:'phraseapp_projects') + if (value = attributes[:'phraseapp_projects']).is_a?(Array) + self.phraseapp_projects = 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 && + id == o.id && + repository_name == o.repository_name && + last_export_to_bitbucket_at == o.last_export_to_bitbucket_at && + last_import_from_bitbucket_at == o.last_import_from_bitbucket_at && + valid_phraseapp_yaml == o.valid_phraseapp_yaml && + phraseapp_projects == o.phraseapp_projects + 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 + [id, repository_name, last_export_to_bitbucket_at, last_import_from_bitbucket_at, valid_phraseapp_yaml, phraseapp_projects].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 :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/bitbucket_sync_export.rb b/lib/Phrase/models/bitbucket_sync_export.rb new file mode 100644 index 0000000..ef2681e --- /dev/null +++ b/lib/Phrase/models/bitbucket_sync_export.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class BitbucketSyncExport + # Account ID to specify the actual account the project should be created in. Required if the requesting user is a member of multiple accounts. + attr_accessor :account_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_id' => :'account_id' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_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::BitbucketSyncExport` 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::BitbucketSyncExport`. 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?(:'account_id') + self.account_id = attributes[:'account_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 && + account_id == o.account_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 + [account_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 :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/bitbucket_sync_export_response.rb b/lib/Phrase/models/bitbucket_sync_export_response.rb new file mode 100644 index 0000000..1b67a3e --- /dev/null +++ b/lib/Phrase/models/bitbucket_sync_export_response.rb @@ -0,0 +1,194 @@ +require 'date' + +module Phrase + class BitbucketSyncExportResponse + attr_accessor :status_path + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'status_path' => :'status_path' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'status_path' => :'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::BitbucketSyncExportResponse` 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::BitbucketSyncExportResponse`. 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?(:'status_path') + self.status_path = attributes[:'status_path'] + 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 && + status_path == o.status_path + 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 + [status_path].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 :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/bitbucket_sync_import.rb b/lib/Phrase/models/bitbucket_sync_import.rb new file mode 100644 index 0000000..9b46bf6 --- /dev/null +++ b/lib/Phrase/models/bitbucket_sync_import.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class BitbucketSyncImport + # Account ID to specify the actual account the project should be created in. Required if the requesting user is a member of multiple accounts. + attr_accessor :account_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_id' => :'account_id' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_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::BitbucketSyncImport` 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::BitbucketSyncImport`. 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?(:'account_id') + self.account_id = attributes[:'account_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 && + account_id == o.account_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 + [account_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 :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/bitbucket_syncs_list.rb b/lib/Phrase/models/bitbucket_syncs_list.rb new file mode 100644 index 0000000..fd5df57 --- /dev/null +++ b/lib/Phrase/models/bitbucket_syncs_list.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class BitbucketSyncsList + # Account ID to specify the actual account the project should be created in. Required if the requesting user is a member of multiple accounts. + attr_accessor :account_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_id' => :'account_id' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_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::BitbucketSyncsList` 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::BitbucketSyncsList`. 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?(:'account_id') + self.account_id = attributes[:'account_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 && + account_id == o.account_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 + [account_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 :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/blacklisted_key.rb b/lib/Phrase/models/blacklisted_key.rb new file mode 100644 index 0000000..4b6fbc4 --- /dev/null +++ b/lib/Phrase/models/blacklisted_key.rb @@ -0,0 +1,221 @@ +require 'date' + +module Phrase + class BlacklistedKey + attr_accessor :id + + attr_accessor :name + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime' + } + 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::BlacklistedKey` 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::BlacklistedKey`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 && + id == o.id && + name == o.name && + created_at == o.created_at && + updated_at == o.updated_at + 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 + [id, name, created_at, updated_at].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 :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/blacklisted_key_create.rb b/lib/Phrase/models/blacklisted_key_create.rb new file mode 100644 index 0000000..712daa9 --- /dev/null +++ b/lib/Phrase/models/blacklisted_key_create.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class BlacklistedKeyCreate + # Blacklisted key name + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'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::BlacklistedKeyCreate` 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::BlacklistedKeyCreate`. 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?(:'name') + self.name = attributes[:'name'] + 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 && + name == o.name + 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 + [name].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 :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/blacklisted_key_update.rb b/lib/Phrase/models/blacklisted_key_update.rb new file mode 100644 index 0000000..eb9e8dc --- /dev/null +++ b/lib/Phrase/models/blacklisted_key_update.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class BlacklistedKeyUpdate + # Blacklisted key name + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'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::BlacklistedKeyUpdate` 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::BlacklistedKeyUpdate`. 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?(:'name') + self.name = attributes[:'name'] + 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 && + name == o.name + 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 + [name].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 :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/branch.rb b/lib/Phrase/models/branch.rb new file mode 100644 index 0000000..5afa612 --- /dev/null +++ b/lib/Phrase/models/branch.rb @@ -0,0 +1,248 @@ +require 'date' + +module Phrase + class Branch + attr_accessor :name + + attr_accessor :created_at + + attr_accessor :updated_at + + attr_accessor :merged_at + + attr_accessor :merged_by + + attr_accessor :created_by + + attr_accessor :state + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'merged_at' => :'merged_at', + :'merged_by' => :'merged_by', + :'created_by' => :'created_by', + :'state' => :'state' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime', + :'merged_at' => :'DateTime', + :'merged_by' => :'UserPreview', + :'created_by' => :'Object', + :'state' => :'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::Branch` 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::Branch`. 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?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'merged_at') + self.merged_at = attributes[:'merged_at'] + end + + if attributes.key?(:'merged_by') + self.merged_by = attributes[:'merged_by'] + end + + if attributes.key?(:'created_by') + self.created_by = attributes[:'created_by'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + 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 && + name == o.name && + created_at == o.created_at && + updated_at == o.updated_at && + merged_at == o.merged_at && + merged_by == o.merged_by && + created_by == o.created_by && + state == o.state + 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 + [name, created_at, updated_at, merged_at, merged_by, created_by, state].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 :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/branch_compare.rb b/lib/Phrase/models/branch_compare.rb new file mode 100644 index 0000000..74643ed --- /dev/null +++ b/lib/Phrase/models/branch_compare.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class BranchCompare + # Name of the branch + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'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::BranchCompare` 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::BranchCompare`. 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?(:'name') + self.name = attributes[:'name'] + 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 && + name == o.name + 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 + [name].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 :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/branch_create.rb b/lib/Phrase/models/branch_create.rb new file mode 100644 index 0000000..bf85cb1 --- /dev/null +++ b/lib/Phrase/models/branch_create.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class BranchCreate + # Name of the branch + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'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::BranchCreate` 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::BranchCreate`. 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?(:'name') + self.name = attributes[:'name'] + 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 && + name == o.name + 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 + [name].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 :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/branch_merge.rb b/lib/Phrase/models/branch_merge.rb new file mode 100644 index 0000000..bec6c67 --- /dev/null +++ b/lib/Phrase/models/branch_merge.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class BranchMerge + # strategy used for merge blocking, use_master or use_branch + attr_accessor :strategy + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'strategy' => :'strategy' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'strategy' => :'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::BranchMerge` 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::BranchMerge`. 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?(:'strategy') + self.strategy = attributes[:'strategy'] + 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 && + strategy == o.strategy + 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 + [strategy].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 :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/branch_update.rb b/lib/Phrase/models/branch_update.rb new file mode 100644 index 0000000..1c1bb6e --- /dev/null +++ b/lib/Phrase/models/branch_update.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class BranchUpdate + # Name of the branch + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'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::BranchUpdate` 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::BranchUpdate`. 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?(:'name') + self.name = attributes[:'name'] + 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 && + name == o.name + 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 + [name].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 :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/comment.rb b/lib/Phrase/models/comment.rb new file mode 100644 index 0000000..becf7e8 --- /dev/null +++ b/lib/Phrase/models/comment.rb @@ -0,0 +1,230 @@ +require 'date' + +module Phrase + class Comment + attr_accessor :id + + attr_accessor :message + + attr_accessor :user + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'message' => :'message', + :'user' => :'user', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'message' => :'String', + :'user' => :'Object', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime' + } + 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::Comment` 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::Comment`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + + if attributes.key?(:'user') + self.user = attributes[:'user'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 && + id == o.id && + message == o.message && + user == o.user && + created_at == o.created_at && + updated_at == o.updated_at + 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 + [id, message, user, created_at, updated_at].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 :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/comment_create.rb b/lib/Phrase/models/comment_create.rb new file mode 100644 index 0000000..1cd2384 --- /dev/null +++ b/lib/Phrase/models/comment_create.rb @@ -0,0 +1,205 @@ +require 'date' + +module Phrase + class CommentCreate + # specify the branch to use + attr_accessor :branch + + # Comment message + attr_accessor :message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'message' => :'message' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'message' => :'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::CommentCreate` 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::CommentCreate`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + 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 && + branch == o.branch && + message == o.message + 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 + [branch, message].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 :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/comment_delete.rb b/lib/Phrase/models/comment_delete.rb new file mode 100644 index 0000000..e61b0fa --- /dev/null +++ b/lib/Phrase/models/comment_delete.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class CommentDelete + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::CommentDelete` 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::CommentDelete`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/comment_mark_check.rb b/lib/Phrase/models/comment_mark_check.rb new file mode 100644 index 0000000..740bcbb --- /dev/null +++ b/lib/Phrase/models/comment_mark_check.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class CommentMarkCheck + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::CommentMarkCheck` 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::CommentMarkCheck`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/comment_mark_read.rb b/lib/Phrase/models/comment_mark_read.rb new file mode 100644 index 0000000..9c4670d --- /dev/null +++ b/lib/Phrase/models/comment_mark_read.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class CommentMarkRead + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::CommentMarkRead` 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::CommentMarkRead`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/comment_mark_unread.rb b/lib/Phrase/models/comment_mark_unread.rb new file mode 100644 index 0000000..f176943 --- /dev/null +++ b/lib/Phrase/models/comment_mark_unread.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class CommentMarkUnread + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::CommentMarkUnread` 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::CommentMarkUnread`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/comment_show.rb b/lib/Phrase/models/comment_show.rb new file mode 100644 index 0000000..5944f7b --- /dev/null +++ b/lib/Phrase/models/comment_show.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class CommentShow + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::CommentShow` 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::CommentShow`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/comment_update.rb b/lib/Phrase/models/comment_update.rb new file mode 100644 index 0000000..f18c309 --- /dev/null +++ b/lib/Phrase/models/comment_update.rb @@ -0,0 +1,205 @@ +require 'date' + +module Phrase + class CommentUpdate + # specify the branch to use + attr_accessor :branch + + # Comment message + attr_accessor :message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'message' => :'message' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'message' => :'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::CommentUpdate` 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::CommentUpdate`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + 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 && + branch == o.branch && + message == o.message + 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 + [branch, message].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 :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/comments_list.rb b/lib/Phrase/models/comments_list.rb new file mode 100644 index 0000000..9cf0b7e --- /dev/null +++ b/lib/Phrase/models/comments_list.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class CommentsList + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::CommentsList` 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::CommentsList`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/distribution.rb b/lib/Phrase/models/distribution.rb new file mode 100644 index 0000000..e839c35 --- /dev/null +++ b/lib/Phrase/models/distribution.rb @@ -0,0 +1,252 @@ +require 'date' + +module Phrase + class Distribution + attr_accessor :id + + attr_accessor :name + + attr_accessor :project + + attr_accessor :platforms + + attr_accessor :releases + + attr_accessor :created_at + + attr_accessor :deleted_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'project' => :'project', + :'platforms' => :'platforms', + :'releases' => :'releases', + :'created_at' => :'created_at', + :'deleted_at' => :'deleted_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'project' => :'ProjectShort', + :'platforms' => :'Array', + :'releases' => :'Array', + :'created_at' => :'DateTime', + :'deleted_at' => :'DateTime' + } + 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::Distribution` 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::Distribution`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'project') + self.project = attributes[:'project'] + end + + if attributes.key?(:'platforms') + if (value = attributes[:'platforms']).is_a?(Array) + self.platforms = value + end + end + + if attributes.key?(:'releases') + if (value = attributes[:'releases']).is_a?(Array) + self.releases = value + end + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'deleted_at') + self.deleted_at = attributes[:'deleted_at'] + 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 && + id == o.id && + name == o.name && + project == o.project && + platforms == o.platforms && + releases == o.releases && + created_at == o.created_at && + deleted_at == o.deleted_at + 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 + [id, name, project, platforms, releases, created_at, deleted_at].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 :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/distribution_create.rb b/lib/Phrase/models/distribution_create.rb new file mode 100644 index 0000000..28199cc --- /dev/null +++ b/lib/Phrase/models/distribution_create.rb @@ -0,0 +1,255 @@ +require 'date' + +module Phrase + class DistributionCreate + # Name of the distribution + attr_accessor :name + + # Project id the distribution should be assigned to. + attr_accessor :project_id + + # List of platforms the distribution should support. + attr_accessor :platforms + + # Additional formatting and render options. Only enclose_in_cdata is available for platform android. + attr_accessor :format_options + + # Indicates whether to fallback to non regional locale when locale can not be found + attr_accessor :fallback_to_non_regional_locale + + # Indicates whether to fallback to projects default locale when locale can not be found + attr_accessor :fallback_to_default_locale + + # Use last reviewed instead of latest translation in a project + attr_accessor :use_last_reviewed_version + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'project_id' => :'project_id', + :'platforms' => :'platforms', + :'format_options' => :'format_options', + :'fallback_to_non_regional_locale' => :'fallback_to_non_regional_locale', + :'fallback_to_default_locale' => :'fallback_to_default_locale', + :'use_last_reviewed_version' => :'use_last_reviewed_version' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'project_id' => :'String', + :'platforms' => :'String', + :'format_options' => :'String', + :'fallback_to_non_regional_locale' => :'String', + :'fallback_to_default_locale' => :'String', + :'use_last_reviewed_version' => :'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::DistributionCreate` 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::DistributionCreate`. 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?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'project_id') + self.project_id = attributes[:'project_id'] + end + + if attributes.key?(:'platforms') + self.platforms = attributes[:'platforms'] + end + + if attributes.key?(:'format_options') + self.format_options = attributes[:'format_options'] + end + + if attributes.key?(:'fallback_to_non_regional_locale') + self.fallback_to_non_regional_locale = attributes[:'fallback_to_non_regional_locale'] + end + + if attributes.key?(:'fallback_to_default_locale') + self.fallback_to_default_locale = attributes[:'fallback_to_default_locale'] + end + + if attributes.key?(:'use_last_reviewed_version') + self.use_last_reviewed_version = attributes[:'use_last_reviewed_version'] + 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 && + name == o.name && + project_id == o.project_id && + platforms == o.platforms && + format_options == o.format_options && + fallback_to_non_regional_locale == o.fallback_to_non_regional_locale && + fallback_to_default_locale == o.fallback_to_default_locale && + use_last_reviewed_version == o.use_last_reviewed_version + 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 + [name, project_id, platforms, format_options, fallback_to_non_regional_locale, fallback_to_default_locale, use_last_reviewed_version].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 :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/distribution_preview.rb b/lib/Phrase/models/distribution_preview.rb new file mode 100644 index 0000000..7c0501e --- /dev/null +++ b/lib/Phrase/models/distribution_preview.rb @@ -0,0 +1,250 @@ +require 'date' + +module Phrase + class DistributionPreview + attr_accessor :id + + attr_accessor :name + + attr_accessor :project + + attr_accessor :platforms + + attr_accessor :release_count + + attr_accessor :created_at + + attr_accessor :deleted_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'project' => :'project', + :'platforms' => :'platforms', + :'release_count' => :'release_count', + :'created_at' => :'created_at', + :'deleted_at' => :'deleted_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'project' => :'Object', + :'platforms' => :'Array', + :'release_count' => :'Integer', + :'created_at' => :'DateTime', + :'deleted_at' => :'DateTime' + } + 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::DistributionPreview` 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::DistributionPreview`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'project') + self.project = attributes[:'project'] + end + + if attributes.key?(:'platforms') + if (value = attributes[:'platforms']).is_a?(Array) + self.platforms = value + end + end + + if attributes.key?(:'release_count') + self.release_count = attributes[:'release_count'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'deleted_at') + self.deleted_at = attributes[:'deleted_at'] + 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 && + id == o.id && + name == o.name && + project == o.project && + platforms == o.platforms && + release_count == o.release_count && + created_at == o.created_at && + deleted_at == o.deleted_at + 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 + [id, name, project, platforms, release_count, created_at, deleted_at].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 :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/distribution_update.rb b/lib/Phrase/models/distribution_update.rb new file mode 100644 index 0000000..c6ffdad --- /dev/null +++ b/lib/Phrase/models/distribution_update.rb @@ -0,0 +1,255 @@ +require 'date' + +module Phrase + class DistributionUpdate + # Name of the distribution + attr_accessor :name + + # Project id the distribution should be assigned to. + attr_accessor :project_id + + # List of platforms the distribution should support. + attr_accessor :platforms + + # Additional formatting and render options. Only enclose_in_cdata is available for platform android. + attr_accessor :format_options + + # Indicates whether to fallback to non regional locale when locale can not be found + attr_accessor :fallback_to_non_regional_locale + + # Indicates whether to fallback to projects default locale when locale can not be found + attr_accessor :fallback_to_default_locale + + # Use last reviewed instead of latest translation in a project + attr_accessor :use_last_reviewed_version + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'project_id' => :'project_id', + :'platforms' => :'platforms', + :'format_options' => :'format_options', + :'fallback_to_non_regional_locale' => :'fallback_to_non_regional_locale', + :'fallback_to_default_locale' => :'fallback_to_default_locale', + :'use_last_reviewed_version' => :'use_last_reviewed_version' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'project_id' => :'String', + :'platforms' => :'String', + :'format_options' => :'String', + :'fallback_to_non_regional_locale' => :'String', + :'fallback_to_default_locale' => :'String', + :'use_last_reviewed_version' => :'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::DistributionUpdate` 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::DistributionUpdate`. 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?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'project_id') + self.project_id = attributes[:'project_id'] + end + + if attributes.key?(:'platforms') + self.platforms = attributes[:'platforms'] + end + + if attributes.key?(:'format_options') + self.format_options = attributes[:'format_options'] + end + + if attributes.key?(:'fallback_to_non_regional_locale') + self.fallback_to_non_regional_locale = attributes[:'fallback_to_non_regional_locale'] + end + + if attributes.key?(:'fallback_to_default_locale') + self.fallback_to_default_locale = attributes[:'fallback_to_default_locale'] + end + + if attributes.key?(:'use_last_reviewed_version') + self.use_last_reviewed_version = attributes[:'use_last_reviewed_version'] + 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 && + name == o.name && + project_id == o.project_id && + platforms == o.platforms && + format_options == o.format_options && + fallback_to_non_regional_locale == o.fallback_to_non_regional_locale && + fallback_to_default_locale == o.fallback_to_default_locale && + use_last_reviewed_version == o.use_last_reviewed_version + 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 + [name, project_id, platforms, format_options, fallback_to_non_regional_locale, fallback_to_default_locale, use_last_reviewed_version].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 :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/errors.rb b/lib/Phrase/models/errors.rb new file mode 100644 index 0000000..60c9401 --- /dev/null +++ b/lib/Phrase/models/errors.rb @@ -0,0 +1,205 @@ +require 'date' + +module Phrase + class Errors + attr_accessor :message + + attr_accessor :errors + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'message' => :'message', + :'errors' => :'errors' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'message' => :'String', + :'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::Errors` 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::Errors`. 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?(:'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 && + message == o.message && + 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 + [message, 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 :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/errors_errors.rb b/lib/Phrase/models/errors_errors.rb new file mode 100644 index 0000000..c4d2dba --- /dev/null +++ b/lib/Phrase/models/errors_errors.rb @@ -0,0 +1,212 @@ +require 'date' + +module Phrase + class ErrorsErrors + attr_accessor :resource + + attr_accessor :field + + attr_accessor :message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'resource' => :'resource', + :'field' => :'field', + :'message' => :'message' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'resource' => :'String', + :'field' => :'String', + :'message' => :'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::ErrorsErrors` 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::ErrorsErrors`. 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?(:'resource') + self.resource = attributes[:'resource'] + end + + if attributes.key?(:'field') + self.field = attributes[:'field'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + 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 && + resource == o.resource && + field == o.field && + message == o.message + 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 + [resource, field, message].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 :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/format.rb b/lib/Phrase/models/format.rb new file mode 100644 index 0000000..96d3628 --- /dev/null +++ b/lib/Phrase/models/format.rb @@ -0,0 +1,275 @@ +require 'date' + +module Phrase + class Format + attr_accessor :name + + attr_accessor :api_name + + attr_accessor :description + + attr_accessor :extension + + attr_accessor :default_encoding + + attr_accessor :importable + + attr_accessor :exportable + + attr_accessor :default_file + + attr_accessor :renders_default_locale + + attr_accessor :includes_locale_information + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'api_name' => :'api_name', + :'description' => :'description', + :'extension' => :'extension', + :'default_encoding' => :'default_encoding', + :'importable' => :'importable', + :'exportable' => :'exportable', + :'default_file' => :'default_file', + :'renders_default_locale' => :'renders_default_locale', + :'includes_locale_information' => :'includes_locale_information' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'api_name' => :'String', + :'description' => :'String', + :'extension' => :'String', + :'default_encoding' => :'String', + :'importable' => :'Boolean', + :'exportable' => :'Boolean', + :'default_file' => :'String', + :'renders_default_locale' => :'Boolean', + :'includes_locale_information' => :'Boolean' + } + 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::Format` 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::Format`. 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?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'api_name') + self.api_name = attributes[:'api_name'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'extension') + self.extension = attributes[:'extension'] + end + + if attributes.key?(:'default_encoding') + self.default_encoding = attributes[:'default_encoding'] + end + + if attributes.key?(:'importable') + self.importable = attributes[:'importable'] + end + + if attributes.key?(:'exportable') + self.exportable = attributes[:'exportable'] + end + + if attributes.key?(:'default_file') + self.default_file = attributes[:'default_file'] + end + + if attributes.key?(:'renders_default_locale') + self.renders_default_locale = attributes[:'renders_default_locale'] + end + + if attributes.key?(:'includes_locale_information') + self.includes_locale_information = attributes[:'includes_locale_information'] + 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 && + name == o.name && + api_name == o.api_name && + description == o.description && + extension == o.extension && + default_encoding == o.default_encoding && + importable == o.importable && + exportable == o.exportable && + default_file == o.default_file && + renders_default_locale == o.renders_default_locale && + includes_locale_information == o.includes_locale_information + 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 + [name, api_name, description, extension, default_encoding, importable, exportable, default_file, renders_default_locale, includes_locale_information].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 :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/gitlab_sync.rb b/lib/Phrase/models/gitlab_sync.rb new file mode 100644 index 0000000..f7071e3 --- /dev/null +++ b/lib/Phrase/models/gitlab_sync.rb @@ -0,0 +1,284 @@ +require 'date' + +module Phrase + class GitlabSync + attr_accessor :id + + attr_accessor :project_id + + attr_accessor :gitlab_project_id + + attr_accessor :gitlab_branch_name + + attr_accessor :auto_import + + attr_accessor :auto_import_secret + + attr_accessor :auto_import_url + + attr_accessor :self_hosted_api_url + + attr_accessor :last_exported_at + + attr_accessor :last_imported_at + + attr_accessor :last_status + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'project_id' => :'project_id', + :'gitlab_project_id' => :'gitlab_project_id', + :'gitlab_branch_name' => :'gitlab_branch_name', + :'auto_import' => :'auto_import', + :'auto_import_secret' => :'auto_import_secret', + :'auto_import_url' => :'auto_import_url', + :'self_hosted_api_url' => :'self_hosted_api_url', + :'last_exported_at' => :'last_exported_at', + :'last_imported_at' => :'last_imported_at', + :'last_status' => :'last_status' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'project_id' => :'String', + :'gitlab_project_id' => :'Integer', + :'gitlab_branch_name' => :'String', + :'auto_import' => :'Boolean', + :'auto_import_secret' => :'String', + :'auto_import_url' => :'String', + :'self_hosted_api_url' => :'String', + :'last_exported_at' => :'DateTime', + :'last_imported_at' => :'DateTime', + :'last_status' => :'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::GitlabSync` 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::GitlabSync`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'project_id') + self.project_id = attributes[:'project_id'] + end + + if attributes.key?(:'gitlab_project_id') + self.gitlab_project_id = attributes[:'gitlab_project_id'] + end + + if attributes.key?(:'gitlab_branch_name') + self.gitlab_branch_name = attributes[:'gitlab_branch_name'] + end + + if attributes.key?(:'auto_import') + self.auto_import = attributes[:'auto_import'] + end + + if attributes.key?(:'auto_import_secret') + self.auto_import_secret = attributes[:'auto_import_secret'] + end + + if attributes.key?(:'auto_import_url') + self.auto_import_url = attributes[:'auto_import_url'] + end + + if attributes.key?(:'self_hosted_api_url') + self.self_hosted_api_url = attributes[:'self_hosted_api_url'] + end + + if attributes.key?(:'last_exported_at') + self.last_exported_at = attributes[:'last_exported_at'] + end + + if attributes.key?(:'last_imported_at') + self.last_imported_at = attributes[:'last_imported_at'] + end + + if attributes.key?(:'last_status') + self.last_status = attributes[:'last_status'] + 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 && + id == o.id && + project_id == o.project_id && + gitlab_project_id == o.gitlab_project_id && + gitlab_branch_name == o.gitlab_branch_name && + auto_import == o.auto_import && + auto_import_secret == o.auto_import_secret && + auto_import_url == o.auto_import_url && + self_hosted_api_url == o.self_hosted_api_url && + last_exported_at == o.last_exported_at && + last_imported_at == o.last_imported_at && + last_status == o.last_status + 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 + [id, project_id, gitlab_project_id, gitlab_branch_name, auto_import, auto_import_secret, auto_import_url, self_hosted_api_url, last_exported_at, last_imported_at, last_status].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 :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/gitlab_sync_delete.rb b/lib/Phrase/models/gitlab_sync_delete.rb new file mode 100644 index 0000000..6a838d4 --- /dev/null +++ b/lib/Phrase/models/gitlab_sync_delete.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class GitlabSyncDelete + # Account ID to specify the actual account the GitLab Sync should be created in. Required if the requesting user is a member of multiple accounts. + attr_accessor :account_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_id' => :'account_id' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_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::GitlabSyncDelete` 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::GitlabSyncDelete`. 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?(:'account_id') + self.account_id = attributes[:'account_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 && + account_id == o.account_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 + [account_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 :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/gitlab_sync_export.rb b/lib/Phrase/models/gitlab_sync_export.rb new file mode 100644 index 0000000..45655a4 --- /dev/null +++ b/lib/Phrase/models/gitlab_sync_export.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class GitlabSyncExport + # Account ID to specify the actual account the GitLab Sync should be created in. Required if the requesting user is a member of multiple accounts. + attr_accessor :account_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_id' => :'account_id' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_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::GitlabSyncExport` 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::GitlabSyncExport`. 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?(:'account_id') + self.account_id = attributes[:'account_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 && + account_id == o.account_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 + [account_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 :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/gitlab_sync_export1.rb b/lib/Phrase/models/gitlab_sync_export1.rb new file mode 100644 index 0000000..ce616fb --- /dev/null +++ b/lib/Phrase/models/gitlab_sync_export1.rb @@ -0,0 +1,203 @@ +require 'date' + +module Phrase + class GitlabSyncExport1 + attr_accessor :merge_request_id + + attr_accessor :merge_request_web_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'merge_request_id' => :'merge_request_id', + :'merge_request_web_url' => :'merge_request_web_url' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'merge_request_id' => :'Integer', + :'merge_request_web_url' => :'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::GitlabSyncExport1` 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::GitlabSyncExport1`. 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?(:'merge_request_id') + self.merge_request_id = attributes[:'merge_request_id'] + end + + if attributes.key?(:'merge_request_web_url') + self.merge_request_web_url = attributes[:'merge_request_web_url'] + 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 && + merge_request_id == o.merge_request_id && + merge_request_web_url == o.merge_request_web_url + 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 + [merge_request_id, merge_request_web_url].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 :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/gitlab_sync_history.rb b/lib/Phrase/models/gitlab_sync_history.rb new file mode 100644 index 0000000..3ee0f1d --- /dev/null +++ b/lib/Phrase/models/gitlab_sync_history.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class GitlabSyncHistory + # Account ID to specify the actual account the GitLab Sync should be created in. Required if the requesting user is a member of multiple accounts. + attr_accessor :account_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_id' => :'account_id' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_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::GitlabSyncHistory` 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::GitlabSyncHistory`. 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?(:'account_id') + self.account_id = attributes[:'account_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 && + account_id == o.account_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 + [account_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 :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/gitlab_sync_history1.rb b/lib/Phrase/models/gitlab_sync_history1.rb new file mode 100644 index 0000000..2b6af9d --- /dev/null +++ b/lib/Phrase/models/gitlab_sync_history1.rb @@ -0,0 +1,232 @@ +require 'date' + +module Phrase + class GitlabSyncHistory1 + attr_accessor :status + + attr_accessor :action + + attr_accessor :errors + + attr_accessor :date + + attr_accessor :details + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'status' => :'status', + :'action' => :'action', + :'errors' => :'errors', + :'date' => :'date', + :'details' => :'details' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'status' => :'Integer', + :'action' => :'String', + :'errors' => :'Array', + :'date' => :'DateTime', + :'details' => :'Object' + } + 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::GitlabSyncHistory1` 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::GitlabSyncHistory1`. 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?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'errors') + if (value = attributes[:'errors']).is_a?(Array) + self.errors = value + end + end + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + + if attributes.key?(:'details') + self.details = attributes[:'details'] + 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 && + status == o.status && + action == o.action && + errors == o.errors && + date == o.date && + details == o.details + 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 + [status, action, errors, date, details].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 :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/gitlab_sync_import.rb b/lib/Phrase/models/gitlab_sync_import.rb new file mode 100644 index 0000000..50d9651 --- /dev/null +++ b/lib/Phrase/models/gitlab_sync_import.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class GitlabSyncImport + # Account ID to specify the actual account the GitLab Sync should be created in. Required if the requesting user is a member of multiple accounts. + attr_accessor :account_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_id' => :'account_id' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_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::GitlabSyncImport` 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::GitlabSyncImport`. 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?(:'account_id') + self.account_id = attributes[:'account_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 && + account_id == o.account_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 + [account_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 :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/gitlab_sync_list.rb b/lib/Phrase/models/gitlab_sync_list.rb new file mode 100644 index 0000000..51d5323 --- /dev/null +++ b/lib/Phrase/models/gitlab_sync_list.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class GitlabSyncList + # Account ID to specify the actual account the GitLab Sync should be created in. Required if the requesting user is a member of multiple accounts. + attr_accessor :account_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_id' => :'account_id' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_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::GitlabSyncList` 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::GitlabSyncList`. 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?(:'account_id') + self.account_id = attributes[:'account_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 && + account_id == o.account_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 + [account_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 :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/gitlab_sync_show.rb b/lib/Phrase/models/gitlab_sync_show.rb new file mode 100644 index 0000000..e77b403 --- /dev/null +++ b/lib/Phrase/models/gitlab_sync_show.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class GitlabSyncShow + # Account ID to specify the actual account the GitLab Sync should be created in. Required if the requesting user is a member of multiple accounts. + attr_accessor :account_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_id' => :'account_id' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_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::GitlabSyncShow` 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::GitlabSyncShow`. 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?(:'account_id') + self.account_id = attributes[:'account_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 && + account_id == o.account_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 + [account_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 :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/gitlab_sync_update.rb b/lib/Phrase/models/gitlab_sync_update.rb new file mode 100644 index 0000000..9226e8d --- /dev/null +++ b/lib/Phrase/models/gitlab_sync_update.rb @@ -0,0 +1,225 @@ +require 'date' + +module Phrase + class GitlabSyncUpdate + # Account ID to specify the actual account the GitLab Sync should be created in. Required if the requesting user is a member of multiple accounts. + attr_accessor :account_id + + # Code of the related Phrase Project. + attr_accessor :phrase_project_code + + # ID of the related GitLab Project. + attr_accessor :gitlab_project_id + + # Name of the GitLab Branch. + attr_accessor :gitlab_branch_name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_id' => :'account_id', + :'phrase_project_code' => :'phrase_project_code', + :'gitlab_project_id' => :'gitlab_project_id', + :'gitlab_branch_name' => :'gitlab_branch_name' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_id' => :'String', + :'phrase_project_code' => :'String', + :'gitlab_project_id' => :'String', + :'gitlab_branch_name' => :'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::GitlabSyncUpdate` 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::GitlabSyncUpdate`. 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?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'phrase_project_code') + self.phrase_project_code = attributes[:'phrase_project_code'] + end + + if attributes.key?(:'gitlab_project_id') + self.gitlab_project_id = attributes[:'gitlab_project_id'] + end + + if attributes.key?(:'gitlab_branch_name') + self.gitlab_branch_name = attributes[:'gitlab_branch_name'] + 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 && + account_id == o.account_id && + phrase_project_code == o.phrase_project_code && + gitlab_project_id == o.gitlab_project_id && + gitlab_branch_name == o.gitlab_branch_name + 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 + [account_id, phrase_project_code, gitlab_project_id, gitlab_branch_name].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 :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/glossary.rb b/lib/Phrase/models/glossary.rb new file mode 100644 index 0000000..626d2e7 --- /dev/null +++ b/lib/Phrase/models/glossary.rb @@ -0,0 +1,232 @@ +require 'date' + +module Phrase + class Glossary + attr_accessor :id + + attr_accessor :name + + attr_accessor :projects + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'projects' => :'projects', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'projects' => :'Array', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime' + } + 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::Glossary` 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::Glossary`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'projects') + if (value = attributes[:'projects']).is_a?(Array) + self.projects = value + end + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 && + id == o.id && + name == o.name && + projects == o.projects && + created_at == o.created_at && + updated_at == o.updated_at + 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 + [id, name, projects, created_at, updated_at].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 :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/glossary_create.rb b/lib/Phrase/models/glossary_create.rb new file mode 100644 index 0000000..3e0e257 --- /dev/null +++ b/lib/Phrase/models/glossary_create.rb @@ -0,0 +1,215 @@ +require 'date' + +module Phrase + class GlossaryCreate + # Name of the glossary + attr_accessor :name + + # List of project ids the glossary should be assigned to. + attr_accessor :project_ids + + # List of space ids the glossary should be assigned to. + attr_accessor :space_ids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'project_ids' => :'project_ids', + :'space_ids' => :'space_ids' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'project_ids' => :'String', + :'space_ids' => :'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::GlossaryCreate` 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::GlossaryCreate`. 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?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'project_ids') + self.project_ids = attributes[:'project_ids'] + end + + if attributes.key?(:'space_ids') + self.space_ids = attributes[:'space_ids'] + 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 && + name == o.name && + project_ids == o.project_ids && + space_ids == o.space_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 + [name, project_ids, space_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 :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/glossary_term.rb b/lib/Phrase/models/glossary_term.rb new file mode 100644 index 0000000..3be2808 --- /dev/null +++ b/lib/Phrase/models/glossary_term.rb @@ -0,0 +1,259 @@ +require 'date' + +module Phrase + class GlossaryTerm + attr_accessor :id + + attr_accessor :term + + attr_accessor :description + + attr_accessor :translatable + + attr_accessor :case_sensitive + + attr_accessor :translations + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'term' => :'term', + :'description' => :'description', + :'translatable' => :'translatable', + :'case_sensitive' => :'case_sensitive', + :'translations' => :'translations', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'term' => :'String', + :'description' => :'String', + :'translatable' => :'Boolean', + :'case_sensitive' => :'Boolean', + :'translations' => :'Array', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime' + } + 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::GlossaryTerm` 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::GlossaryTerm`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'term') + self.term = attributes[:'term'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'translatable') + self.translatable = attributes[:'translatable'] + end + + if attributes.key?(:'case_sensitive') + self.case_sensitive = attributes[:'case_sensitive'] + end + + if attributes.key?(:'translations') + if (value = attributes[:'translations']).is_a?(Array) + self.translations = value + end + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 && + id == o.id && + term == o.term && + description == o.description && + translatable == o.translatable && + case_sensitive == o.case_sensitive && + translations == o.translations && + created_at == o.created_at && + updated_at == o.updated_at + 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 + [id, term, description, translatable, case_sensitive, translations, created_at, updated_at].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 :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/glossary_term_create.rb b/lib/Phrase/models/glossary_term_create.rb new file mode 100644 index 0000000..7199b94 --- /dev/null +++ b/lib/Phrase/models/glossary_term_create.rb @@ -0,0 +1,225 @@ +require 'date' + +module Phrase + class GlossaryTermCreate + # Glossary term + attr_accessor :term + + # Description of term + attr_accessor :description + + # Indicates whether the term should be used for all languages or can be translated + attr_accessor :translatable + + # Indicates whether the term is case sensitive + attr_accessor :case_sensitive + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'term' => :'term', + :'description' => :'description', + :'translatable' => :'translatable', + :'case_sensitive' => :'case_sensitive' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'term' => :'String', + :'description' => :'String', + :'translatable' => :'String', + :'case_sensitive' => :'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::GlossaryTermCreate` 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::GlossaryTermCreate`. 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?(:'term') + self.term = attributes[:'term'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'translatable') + self.translatable = attributes[:'translatable'] + end + + if attributes.key?(:'case_sensitive') + self.case_sensitive = attributes[:'case_sensitive'] + 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 && + term == o.term && + description == o.description && + translatable == o.translatable && + case_sensitive == o.case_sensitive + 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 + [term, description, translatable, case_sensitive].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 :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/glossary_term_translation.rb b/lib/Phrase/models/glossary_term_translation.rb new file mode 100644 index 0000000..2571c65 --- /dev/null +++ b/lib/Phrase/models/glossary_term_translation.rb @@ -0,0 +1,230 @@ +require 'date' + +module Phrase + class GlossaryTermTranslation + attr_accessor :id + + attr_accessor :locale_code + + attr_accessor :content + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'locale_code' => :'locale_code', + :'content' => :'content', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'locale_code' => :'String', + :'content' => :'String', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime' + } + 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::GlossaryTermTranslation` 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::GlossaryTermTranslation`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'locale_code') + self.locale_code = attributes[:'locale_code'] + end + + if attributes.key?(:'content') + self.content = attributes[:'content'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 && + id == o.id && + locale_code == o.locale_code && + content == o.content && + created_at == o.created_at && + updated_at == o.updated_at + 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 + [id, locale_code, content, created_at, updated_at].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 :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/glossary_term_translation_create.rb b/lib/Phrase/models/glossary_term_translation_create.rb new file mode 100644 index 0000000..e851ff2 --- /dev/null +++ b/lib/Phrase/models/glossary_term_translation_create.rb @@ -0,0 +1,205 @@ +require 'date' + +module Phrase + class GlossaryTermTranslationCreate + # Identifies the language for this translation + attr_accessor :locale_code + + # The content of the translation + attr_accessor :content + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'locale_code' => :'locale_code', + :'content' => :'content' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'locale_code' => :'String', + :'content' => :'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::GlossaryTermTranslationCreate` 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::GlossaryTermTranslationCreate`. 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?(:'locale_code') + self.locale_code = attributes[:'locale_code'] + end + + if attributes.key?(:'content') + self.content = attributes[:'content'] + 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 && + locale_code == o.locale_code && + content == o.content + 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 + [locale_code, content].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 :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/glossary_term_translation_update.rb b/lib/Phrase/models/glossary_term_translation_update.rb new file mode 100644 index 0000000..1b7f436 --- /dev/null +++ b/lib/Phrase/models/glossary_term_translation_update.rb @@ -0,0 +1,205 @@ +require 'date' + +module Phrase + class GlossaryTermTranslationUpdate + # Identifies the language for this translation + attr_accessor :locale_code + + # The content of the translation + attr_accessor :content + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'locale_code' => :'locale_code', + :'content' => :'content' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'locale_code' => :'String', + :'content' => :'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::GlossaryTermTranslationUpdate` 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::GlossaryTermTranslationUpdate`. 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?(:'locale_code') + self.locale_code = attributes[:'locale_code'] + end + + if attributes.key?(:'content') + self.content = attributes[:'content'] + 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 && + locale_code == o.locale_code && + content == o.content + 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 + [locale_code, content].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 :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/glossary_term_update.rb b/lib/Phrase/models/glossary_term_update.rb new file mode 100644 index 0000000..5067f71 --- /dev/null +++ b/lib/Phrase/models/glossary_term_update.rb @@ -0,0 +1,225 @@ +require 'date' + +module Phrase + class GlossaryTermUpdate + # Glossary term + attr_accessor :term + + # Description of term + attr_accessor :description + + # Indicates whether the term should be used for all languages or can be translated + attr_accessor :translatable + + # Indicates whether the term is case sensitive + attr_accessor :case_sensitive + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'term' => :'term', + :'description' => :'description', + :'translatable' => :'translatable', + :'case_sensitive' => :'case_sensitive' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'term' => :'String', + :'description' => :'String', + :'translatable' => :'String', + :'case_sensitive' => :'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::GlossaryTermUpdate` 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::GlossaryTermUpdate`. 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?(:'term') + self.term = attributes[:'term'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'translatable') + self.translatable = attributes[:'translatable'] + end + + if attributes.key?(:'case_sensitive') + self.case_sensitive = attributes[:'case_sensitive'] + 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 && + term == o.term && + description == o.description && + translatable == o.translatable && + case_sensitive == o.case_sensitive + 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 + [term, description, translatable, case_sensitive].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 :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/glossary_update.rb b/lib/Phrase/models/glossary_update.rb new file mode 100644 index 0000000..b8981b6 --- /dev/null +++ b/lib/Phrase/models/glossary_update.rb @@ -0,0 +1,215 @@ +require 'date' + +module Phrase + class GlossaryUpdate + # Name of the glossary + attr_accessor :name + + # List of project ids the glossary should be assigned to. + attr_accessor :project_ids + + # List of space ids the glossary should be assigned to. + attr_accessor :space_ids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'project_ids' => :'project_ids', + :'space_ids' => :'space_ids' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'project_ids' => :'String', + :'space_ids' => :'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::GlossaryUpdate` 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::GlossaryUpdate`. 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?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'project_ids') + self.project_ids = attributes[:'project_ids'] + end + + if attributes.key?(:'space_ids') + self.space_ids = attributes[:'space_ids'] + 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 && + name == o.name && + project_ids == o.project_ids && + space_ids == o.space_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 + [name, project_ids, space_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 :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/invitation.rb b/lib/Phrase/models/invitation.rb new file mode 100644 index 0000000..bffaf70 --- /dev/null +++ b/lib/Phrase/models/invitation.rb @@ -0,0 +1,279 @@ +require 'date' + +module Phrase + class Invitation + attr_accessor :id + + attr_accessor :email + + attr_accessor :role + + attr_accessor :state + + attr_accessor :projects + + attr_accessor :locales + + attr_accessor :permissions + + attr_accessor :created_at + + attr_accessor :updated_at + + attr_accessor :accepted_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'email' => :'email', + :'role' => :'role', + :'state' => :'state', + :'projects' => :'projects', + :'locales' => :'locales', + :'permissions' => :'permissions', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'accepted_at' => :'accepted_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'email' => :'String', + :'role' => :'String', + :'state' => :'String', + :'projects' => :'Array', + :'locales' => :'Array', + :'permissions' => :'Object', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime', + :'accepted_at' => :'DateTime' + } + 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::Invitation` 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::Invitation`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'role') + self.role = attributes[:'role'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'projects') + if (value = attributes[:'projects']).is_a?(Array) + self.projects = value + end + end + + if attributes.key?(:'locales') + if (value = attributes[:'locales']).is_a?(Array) + self.locales = value + end + end + + if attributes.key?(:'permissions') + self.permissions = attributes[:'permissions'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'accepted_at') + self.accepted_at = attributes[:'accepted_at'] + 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 && + id == o.id && + email == o.email && + role == o.role && + state == o.state && + projects == o.projects && + locales == o.locales && + permissions == o.permissions && + created_at == o.created_at && + updated_at == o.updated_at && + accepted_at == o.accepted_at + 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 + [id, email, role, state, projects, locales, permissions, created_at, updated_at, accepted_at].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 :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/invitation_create.rb b/lib/Phrase/models/invitation_create.rb new file mode 100644 index 0000000..8bc8edb --- /dev/null +++ b/lib/Phrase/models/invitation_create.rb @@ -0,0 +1,235 @@ +require 'date' + +module Phrase + class InvitationCreate + # The email of the invited user. The email can not be updated once created. Create a new invitation for each unique email. + attr_accessor :email + + # Invitiation role, can be any of Manager, Developer, Translator. + attr_accessor :role + + # List of project ids the invited user has access to. + attr_accessor :project_ids + + # List of locale ids the invited user has access to. + attr_accessor :locale_ids + + # Additional permissions depending on invitation role. Available permissions are create_upload and review_translations + attr_accessor :permissions + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'email' => :'email', + :'role' => :'role', + :'project_ids' => :'project_ids', + :'locale_ids' => :'locale_ids', + :'permissions' => :'permissions' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'email' => :'String', + :'role' => :'String', + :'project_ids' => :'String', + :'locale_ids' => :'String', + :'permissions' => :'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::InvitationCreate` 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::InvitationCreate`. 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?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'role') + self.role = attributes[:'role'] + end + + if attributes.key?(:'project_ids') + self.project_ids = attributes[:'project_ids'] + end + + if attributes.key?(:'locale_ids') + self.locale_ids = attributes[:'locale_ids'] + end + + if attributes.key?(:'permissions') + self.permissions = attributes[:'permissions'] + 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 && + email == o.email && + role == o.role && + project_ids == o.project_ids && + locale_ids == o.locale_ids && + permissions == o.permissions + 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 + [email, role, project_ids, locale_ids, permissions].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 :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/invitation_update.rb b/lib/Phrase/models/invitation_update.rb new file mode 100644 index 0000000..acda92f --- /dev/null +++ b/lib/Phrase/models/invitation_update.rb @@ -0,0 +1,225 @@ +require 'date' + +module Phrase + class InvitationUpdate + # Invitiation role, can be any of Manager, Developer, Translator + attr_accessor :role + + # List of project ids the invited user has access to + attr_accessor :project_ids + + # List of locale ids the invited user has access to + attr_accessor :locale_ids + + # Additional permissions depending on invitation role. + attr_accessor :permissions + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'role' => :'role', + :'project_ids' => :'project_ids', + :'locale_ids' => :'locale_ids', + :'permissions' => :'permissions' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'role' => :'String', + :'project_ids' => :'String', + :'locale_ids' => :'String', + :'permissions' => :'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::InvitationUpdate` 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::InvitationUpdate`. 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?(:'role') + self.role = attributes[:'role'] + end + + if attributes.key?(:'project_ids') + self.project_ids = attributes[:'project_ids'] + end + + if attributes.key?(:'locale_ids') + self.locale_ids = attributes[:'locale_ids'] + end + + if attributes.key?(:'permissions') + self.permissions = attributes[:'permissions'] + 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 && + role == o.role && + project_ids == o.project_ids && + locale_ids == o.locale_ids && + permissions == o.permissions + 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 + [role, project_ids, locale_ids, permissions].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 :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/job.rb b/lib/Phrase/models/job.rb new file mode 100644 index 0000000..3862ae2 --- /dev/null +++ b/lib/Phrase/models/job.rb @@ -0,0 +1,248 @@ +require 'date' + +module Phrase + class Job + attr_accessor :id + + attr_accessor :name + + attr_accessor :briefing + + attr_accessor :due_date + + attr_accessor :state + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'briefing' => :'briefing', + :'due_date' => :'due_date', + :'state' => :'state', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'briefing' => :'String', + :'due_date' => :'DateTime', + :'state' => :'String', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime' + } + 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::Job` 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::Job`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'briefing') + self.briefing = attributes[:'briefing'] + end + + if attributes.key?(:'due_date') + self.due_date = attributes[:'due_date'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 && + id == o.id && + name == o.name && + briefing == o.briefing && + due_date == o.due_date && + state == o.state && + created_at == o.created_at && + updated_at == o.updated_at + 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 + [id, name, briefing, due_date, state, created_at, updated_at].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 :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/job_complete.rb b/lib/Phrase/models/job_complete.rb new file mode 100644 index 0000000..c9faa71 --- /dev/null +++ b/lib/Phrase/models/job_complete.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class JobComplete + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::JobComplete` 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::JobComplete`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/job_create.rb b/lib/Phrase/models/job_create.rb new file mode 100644 index 0000000..794cc63 --- /dev/null +++ b/lib/Phrase/models/job_create.rb @@ -0,0 +1,245 @@ +require 'date' + +module Phrase + class JobCreate + # specify the branch to use + attr_accessor :branch + + # Job name + attr_accessor :name + + # Briefing for the translators + attr_accessor :briefing + + # Date the job should be finished + attr_accessor :due_date + + # tags of keys that should be included within the job + attr_accessor :tags + + # ids of keys that should be included within the job + attr_accessor :translation_key_ids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'name' => :'name', + :'briefing' => :'briefing', + :'due_date' => :'due_date', + :'tags' => :'tags', + :'translation_key_ids' => :'translation_key_ids' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'name' => :'String', + :'briefing' => :'String', + :'due_date' => :'String', + :'tags' => :'String', + :'translation_key_ids' => :'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::JobCreate` 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::JobCreate`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'briefing') + self.briefing = attributes[:'briefing'] + end + + if attributes.key?(:'due_date') + self.due_date = attributes[:'due_date'] + end + + if attributes.key?(:'tags') + self.tags = attributes[:'tags'] + end + + if attributes.key?(:'translation_key_ids') + self.translation_key_ids = attributes[:'translation_key_ids'] + 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 && + branch == o.branch && + name == o.name && + briefing == o.briefing && + due_date == o.due_date && + tags == o.tags && + translation_key_ids == o.translation_key_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 + [branch, name, briefing, due_date, tags, translation_key_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 :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/job_delete.rb b/lib/Phrase/models/job_delete.rb new file mode 100644 index 0000000..ceb5f18 --- /dev/null +++ b/lib/Phrase/models/job_delete.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class JobDelete + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::JobDelete` 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::JobDelete`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/job_keys_create.rb b/lib/Phrase/models/job_keys_create.rb new file mode 100644 index 0000000..1b9a139 --- /dev/null +++ b/lib/Phrase/models/job_keys_create.rb @@ -0,0 +1,205 @@ +require 'date' + +module Phrase + class JobKeysCreate + # specify the branch to use + attr_accessor :branch + + # ids of keys that should added to the job + attr_accessor :translation_key_ids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'translation_key_ids' => :'translation_key_ids' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'translation_key_ids' => :'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::JobKeysCreate` 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::JobKeysCreate`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'translation_key_ids') + self.translation_key_ids = attributes[:'translation_key_ids'] + 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 && + branch == o.branch && + translation_key_ids == o.translation_key_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 + [branch, translation_key_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 :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/job_keys_delete.rb b/lib/Phrase/models/job_keys_delete.rb new file mode 100644 index 0000000..112bbbd --- /dev/null +++ b/lib/Phrase/models/job_keys_delete.rb @@ -0,0 +1,205 @@ +require 'date' + +module Phrase + class JobKeysDelete + # specify the branch to use + attr_accessor :branch + + # ids of keys that should added to the job + attr_accessor :translation_key_ids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'translation_key_ids' => :'translation_key_ids' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'translation_key_ids' => :'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::JobKeysDelete` 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::JobKeysDelete`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'translation_key_ids') + self.translation_key_ids = attributes[:'translation_key_ids'] + 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 && + branch == o.branch && + translation_key_ids == o.translation_key_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 + [branch, translation_key_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 :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/job_locale.rb b/lib/Phrase/models/job_locale.rb new file mode 100644 index 0000000..6abc36f --- /dev/null +++ b/lib/Phrase/models/job_locale.rb @@ -0,0 +1,223 @@ +require 'date' + +module Phrase + class JobLocale + attr_accessor :id + + attr_accessor :job + + attr_accessor :locale + + attr_accessor :users + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'job' => :'job', + :'locale' => :'locale', + :'users' => :'users' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'job' => :'JobPreview', + :'locale' => :'Object', + :'users' => :'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::JobLocale` 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::JobLocale`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'job') + self.job = attributes[:'job'] + end + + if attributes.key?(:'locale') + self.locale = attributes[:'locale'] + end + + if attributes.key?(:'users') + if (value = attributes[:'users']).is_a?(Array) + self.users = 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 && + id == o.id && + job == o.job && + locale == o.locale && + users == o.users + 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 + [id, job, locale, users].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 :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/job_locale_complete.rb b/lib/Phrase/models/job_locale_complete.rb new file mode 100644 index 0000000..7edf119 --- /dev/null +++ b/lib/Phrase/models/job_locale_complete.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class JobLocaleComplete + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::JobLocaleComplete` 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::JobLocaleComplete`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/job_locale_delete.rb b/lib/Phrase/models/job_locale_delete.rb new file mode 100644 index 0000000..e90a075 --- /dev/null +++ b/lib/Phrase/models/job_locale_delete.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class JobLocaleDelete + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::JobLocaleDelete` 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::JobLocaleDelete`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/job_locale_reopen.rb b/lib/Phrase/models/job_locale_reopen.rb new file mode 100644 index 0000000..1bbb760 --- /dev/null +++ b/lib/Phrase/models/job_locale_reopen.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class JobLocaleReopen + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::JobLocaleReopen` 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::JobLocaleReopen`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/job_locale_show.rb b/lib/Phrase/models/job_locale_show.rb new file mode 100644 index 0000000..748ce79 --- /dev/null +++ b/lib/Phrase/models/job_locale_show.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class JobLocaleShow + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::JobLocaleShow` 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::JobLocaleShow`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/job_locale_update.rb b/lib/Phrase/models/job_locale_update.rb new file mode 100644 index 0000000..ea41cc5 --- /dev/null +++ b/lib/Phrase/models/job_locale_update.rb @@ -0,0 +1,215 @@ +require 'date' + +module Phrase + class JobLocaleUpdate + # specify the branch to use + attr_accessor :branch + + # locale id + attr_accessor :locale_id + + # Array of user ids to be assigned to the job locale + attr_accessor :user_ids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'locale_id' => :'locale_id', + :'user_ids' => :'user_ids' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'locale_id' => :'String', + :'user_ids' => :'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::JobLocaleUpdate` 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::JobLocaleUpdate`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'locale_id') + self.locale_id = attributes[:'locale_id'] + end + + if attributes.key?(:'user_ids') + self.user_ids = attributes[:'user_ids'] + 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 && + branch == o.branch && + locale_id == o.locale_id && + user_ids == o.user_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 + [branch, locale_id, user_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 :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/job_locales_create.rb b/lib/Phrase/models/job_locales_create.rb new file mode 100644 index 0000000..38c750a --- /dev/null +++ b/lib/Phrase/models/job_locales_create.rb @@ -0,0 +1,215 @@ +require 'date' + +module Phrase + class JobLocalesCreate + # specify the branch to use + attr_accessor :branch + + # locale id + attr_accessor :locale_id + + # Array of user ids to be assigned to the job locale + attr_accessor :user_ids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'locale_id' => :'locale_id', + :'user_ids' => :'user_ids' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'locale_id' => :'String', + :'user_ids' => :'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::JobLocalesCreate` 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::JobLocalesCreate`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'locale_id') + self.locale_id = attributes[:'locale_id'] + end + + if attributes.key?(:'user_ids') + self.user_ids = attributes[:'user_ids'] + 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 && + branch == o.branch && + locale_id == o.locale_id && + user_ids == o.user_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 + [branch, locale_id, user_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 :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/job_locales_list.rb b/lib/Phrase/models/job_locales_list.rb new file mode 100644 index 0000000..174e33d --- /dev/null +++ b/lib/Phrase/models/job_locales_list.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class JobLocalesList + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::JobLocalesList` 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::JobLocalesList`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/job_preview.rb b/lib/Phrase/models/job_preview.rb new file mode 100644 index 0000000..b44a661 --- /dev/null +++ b/lib/Phrase/models/job_preview.rb @@ -0,0 +1,212 @@ +require 'date' + +module Phrase + class JobPreview + attr_accessor :id + + attr_accessor :name + + attr_accessor :state + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'state' => :'state' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'state' => :'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::JobPreview` 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::JobPreview`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + 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 && + id == o.id && + name == o.name && + state == o.state + 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 + [id, name, state].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 :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/job_reopen.rb b/lib/Phrase/models/job_reopen.rb new file mode 100644 index 0000000..e2d9623 --- /dev/null +++ b/lib/Phrase/models/job_reopen.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class JobReopen + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::JobReopen` 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::JobReopen`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/job_show.rb b/lib/Phrase/models/job_show.rb new file mode 100644 index 0000000..c4cf4c2 --- /dev/null +++ b/lib/Phrase/models/job_show.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class JobShow + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::JobShow` 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::JobShow`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/job_start.rb b/lib/Phrase/models/job_start.rb new file mode 100644 index 0000000..0ee30ce --- /dev/null +++ b/lib/Phrase/models/job_start.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class JobStart + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::JobStart` 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::JobStart`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/job_update.rb b/lib/Phrase/models/job_update.rb new file mode 100644 index 0000000..7eb4363 --- /dev/null +++ b/lib/Phrase/models/job_update.rb @@ -0,0 +1,225 @@ +require 'date' + +module Phrase + class JobUpdate + # specify the branch to use + attr_accessor :branch + + # Job name + attr_accessor :name + + # Briefing for the translators + attr_accessor :briefing + + # Date the job should be finished + attr_accessor :due_date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'name' => :'name', + :'briefing' => :'briefing', + :'due_date' => :'due_date' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'name' => :'String', + :'briefing' => :'String', + :'due_date' => :'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::JobUpdate` 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::JobUpdate`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'briefing') + self.briefing = attributes[:'briefing'] + end + + if attributes.key?(:'due_date') + self.due_date = attributes[:'due_date'] + 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 && + branch == o.branch && + name == o.name && + briefing == o.briefing && + due_date == o.due_date + 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 + [branch, name, briefing, due_date].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 :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/jobs_list.rb b/lib/Phrase/models/jobs_list.rb new file mode 100644 index 0000000..7933160 --- /dev/null +++ b/lib/Phrase/models/jobs_list.rb @@ -0,0 +1,225 @@ +require 'date' + +module Phrase + class JobsList + # specify the branch to use + attr_accessor :branch + + # filter by user owning job + attr_accessor :owned_by + + # filter by user assigned to job + attr_accessor :assigned_to + + # filter by state of job Valid states are draft, in_progress, completed + attr_accessor :state + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'owned_by' => :'owned_by', + :'assigned_to' => :'assigned_to', + :'state' => :'state' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'owned_by' => :'String', + :'assigned_to' => :'String', + :'state' => :'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::JobsList` 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::JobsList`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'owned_by') + self.owned_by = attributes[:'owned_by'] + end + + if attributes.key?(:'assigned_to') + self.assigned_to = attributes[:'assigned_to'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + 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 && + branch == o.branch && + owned_by == o.owned_by && + assigned_to == o.assigned_to && + state == o.state + 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 + [branch, owned_by, assigned_to, state].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 :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/key_create.rb b/lib/Phrase/models/key_create.rb new file mode 100644 index 0000000..153e026 --- /dev/null +++ b/lib/Phrase/models/key_create.rb @@ -0,0 +1,335 @@ +require 'date' + +module Phrase + class KeyCreate + # specify the branch to use + attr_accessor :branch + + # Key name + attr_accessor :name + + # Key description (usually includes contextual information for translators) + attr_accessor :description + + # Indicates whether key supports pluralization + attr_accessor :plural + + # Plural name for the key (used in some file formats, e.g. Gettext) + attr_accessor :name_plural + + # Type of the key. Can be one of the following: string, number, boolean, array, markdown. + attr_accessor :data_type + + # List of tags separated by comma to be associated with the key. + attr_accessor :tags + + # Max. number of characters translations for this key can have. + attr_accessor :max_characters_allowed + + # Screenshot/image for the key. This parameter is deprecated. Please use the Screenshots endpoint instead. + attr_accessor :screenshot + + # Indicates whether the screenshot will be deleted. This parameter is deprecated. Please use the Screenshots endpoint instead. + attr_accessor :remove_screenshot + + # Indicates whether the key should be exported as \"unformatted\". Supported by Android XML and other formats. + attr_accessor :unformatted + + # Indicates whether the key should be exported with \"xml:space=preserve\". Supported by several XML-based formats. + attr_accessor :xml_space_preserve + + # Original file attribute. Used in some formats, e.g. XLIFF. + attr_accessor :original_file + + # NSStringLocalizedFormatKey attribute. Used in .stringsdict format. + attr_accessor :localized_format_string + + # NSStringLocalizedFormatKey attribute. Used in .stringsdict format. + attr_accessor :localized_format_key + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'name' => :'name', + :'description' => :'description', + :'plural' => :'plural', + :'name_plural' => :'name_plural', + :'data_type' => :'data_type', + :'tags' => :'tags', + :'max_characters_allowed' => :'max_characters_allowed', + :'screenshot' => :'screenshot', + :'remove_screenshot' => :'remove_screenshot', + :'unformatted' => :'unformatted', + :'xml_space_preserve' => :'xml_space_preserve', + :'original_file' => :'original_file', + :'localized_format_string' => :'localized_format_string', + :'localized_format_key' => :'localized_format_key' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'name' => :'String', + :'description' => :'String', + :'plural' => :'String', + :'name_plural' => :'String', + :'data_type' => :'String', + :'tags' => :'String', + :'max_characters_allowed' => :'String', + :'screenshot' => :'String', + :'remove_screenshot' => :'String', + :'unformatted' => :'String', + :'xml_space_preserve' => :'String', + :'original_file' => :'String', + :'localized_format_string' => :'String', + :'localized_format_key' => :'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::KeyCreate` 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::KeyCreate`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'plural') + self.plural = attributes[:'plural'] + end + + if attributes.key?(:'name_plural') + self.name_plural = attributes[:'name_plural'] + end + + if attributes.key?(:'data_type') + self.data_type = attributes[:'data_type'] + end + + if attributes.key?(:'tags') + self.tags = attributes[:'tags'] + end + + if attributes.key?(:'max_characters_allowed') + self.max_characters_allowed = attributes[:'max_characters_allowed'] + end + + if attributes.key?(:'screenshot') + self.screenshot = attributes[:'screenshot'] + end + + if attributes.key?(:'remove_screenshot') + self.remove_screenshot = attributes[:'remove_screenshot'] + end + + if attributes.key?(:'unformatted') + self.unformatted = attributes[:'unformatted'] + end + + if attributes.key?(:'xml_space_preserve') + self.xml_space_preserve = attributes[:'xml_space_preserve'] + end + + if attributes.key?(:'original_file') + self.original_file = attributes[:'original_file'] + end + + if attributes.key?(:'localized_format_string') + self.localized_format_string = attributes[:'localized_format_string'] + end + + if attributes.key?(:'localized_format_key') + self.localized_format_key = attributes[:'localized_format_key'] + 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 && + branch == o.branch && + name == o.name && + description == o.description && + plural == o.plural && + name_plural == o.name_plural && + data_type == o.data_type && + tags == o.tags && + max_characters_allowed == o.max_characters_allowed && + screenshot == o.screenshot && + remove_screenshot == o.remove_screenshot && + unformatted == o.unformatted && + xml_space_preserve == o.xml_space_preserve && + original_file == o.original_file && + localized_format_string == o.localized_format_string && + localized_format_key == o.localized_format_key + 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 + [branch, name, description, plural, name_plural, data_type, tags, max_characters_allowed, screenshot, remove_screenshot, unformatted, xml_space_preserve, original_file, localized_format_string, localized_format_key].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 :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/key_delete.rb b/lib/Phrase/models/key_delete.rb new file mode 100644 index 0000000..21f22c0 --- /dev/null +++ b/lib/Phrase/models/key_delete.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class KeyDelete + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::KeyDelete` 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::KeyDelete`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/key_preview.rb b/lib/Phrase/models/key_preview.rb new file mode 100644 index 0000000..50e080f --- /dev/null +++ b/lib/Phrase/models/key_preview.rb @@ -0,0 +1,212 @@ +require 'date' + +module Phrase + class KeyPreview + attr_accessor :id + + attr_accessor :name + + attr_accessor :plural + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'plural' => :'plural' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'plural' => :'Boolean' + } + 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::KeyPreview` 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::KeyPreview`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'plural') + self.plural = attributes[:'plural'] + 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 && + id == o.id && + name == o.name && + plural == o.plural + 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 + [id, name, plural].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 :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/key_show.rb b/lib/Phrase/models/key_show.rb new file mode 100644 index 0000000..139a86a --- /dev/null +++ b/lib/Phrase/models/key_show.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class KeyShow + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::KeyShow` 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::KeyShow`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/key_update.rb b/lib/Phrase/models/key_update.rb new file mode 100644 index 0000000..88d4f0f --- /dev/null +++ b/lib/Phrase/models/key_update.rb @@ -0,0 +1,335 @@ +require 'date' + +module Phrase + class KeyUpdate + # specify the branch to use + attr_accessor :branch + + # Key name + attr_accessor :name + + # Key description (usually includes contextual information for translators) + attr_accessor :description + + # Indicates whether key supports pluralization + attr_accessor :plural + + # Plural name for the key (used in some file formats, e.g. Gettext) + attr_accessor :name_plural + + # Type of the key. Can be one of the following: string, number, boolean, array, markdown. + attr_accessor :data_type + + # List of tags separated by comma to be associated with the key. + attr_accessor :tags + + # Max. number of characters translations for this key can have. + attr_accessor :max_characters_allowed + + # Screenshot/image for the key. This parameter is deprecated. Please use the Screenshots endpoint instead. + attr_accessor :screenshot + + # Indicates whether the screenshot will be deleted. This parameter is deprecated. Please use the Screenshots endpoint instead. + attr_accessor :remove_screenshot + + # Indicates whether the key should be exported as \"unformatted\". Supported by Android XML and other formats. + attr_accessor :unformatted + + # Indicates whether the key should be exported with \"xml:space=preserve\". Supported by several XML-based formats. + attr_accessor :xml_space_preserve + + # Original file attribute. Used in some formats, e.g. XLIFF. + attr_accessor :original_file + + # NSStringLocalizedFormatKey attribute. Used in .stringsdict format. + attr_accessor :localized_format_string + + # NSStringLocalizedFormatKey attribute. Used in .stringsdict format. + attr_accessor :localized_format_key + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'name' => :'name', + :'description' => :'description', + :'plural' => :'plural', + :'name_plural' => :'name_plural', + :'data_type' => :'data_type', + :'tags' => :'tags', + :'max_characters_allowed' => :'max_characters_allowed', + :'screenshot' => :'screenshot', + :'remove_screenshot' => :'remove_screenshot', + :'unformatted' => :'unformatted', + :'xml_space_preserve' => :'xml_space_preserve', + :'original_file' => :'original_file', + :'localized_format_string' => :'localized_format_string', + :'localized_format_key' => :'localized_format_key' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'name' => :'String', + :'description' => :'String', + :'plural' => :'String', + :'name_plural' => :'String', + :'data_type' => :'String', + :'tags' => :'String', + :'max_characters_allowed' => :'String', + :'screenshot' => :'String', + :'remove_screenshot' => :'String', + :'unformatted' => :'String', + :'xml_space_preserve' => :'String', + :'original_file' => :'String', + :'localized_format_string' => :'String', + :'localized_format_key' => :'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::KeyUpdate` 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::KeyUpdate`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'plural') + self.plural = attributes[:'plural'] + end + + if attributes.key?(:'name_plural') + self.name_plural = attributes[:'name_plural'] + end + + if attributes.key?(:'data_type') + self.data_type = attributes[:'data_type'] + end + + if attributes.key?(:'tags') + self.tags = attributes[:'tags'] + end + + if attributes.key?(:'max_characters_allowed') + self.max_characters_allowed = attributes[:'max_characters_allowed'] + end + + if attributes.key?(:'screenshot') + self.screenshot = attributes[:'screenshot'] + end + + if attributes.key?(:'remove_screenshot') + self.remove_screenshot = attributes[:'remove_screenshot'] + end + + if attributes.key?(:'unformatted') + self.unformatted = attributes[:'unformatted'] + end + + if attributes.key?(:'xml_space_preserve') + self.xml_space_preserve = attributes[:'xml_space_preserve'] + end + + if attributes.key?(:'original_file') + self.original_file = attributes[:'original_file'] + end + + if attributes.key?(:'localized_format_string') + self.localized_format_string = attributes[:'localized_format_string'] + end + + if attributes.key?(:'localized_format_key') + self.localized_format_key = attributes[:'localized_format_key'] + 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 && + branch == o.branch && + name == o.name && + description == o.description && + plural == o.plural && + name_plural == o.name_plural && + data_type == o.data_type && + tags == o.tags && + max_characters_allowed == o.max_characters_allowed && + screenshot == o.screenshot && + remove_screenshot == o.remove_screenshot && + unformatted == o.unformatted && + xml_space_preserve == o.xml_space_preserve && + original_file == o.original_file && + localized_format_string == o.localized_format_string && + localized_format_key == o.localized_format_key + 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 + [branch, name, description, plural, name_plural, data_type, tags, max_characters_allowed, screenshot, remove_screenshot, unformatted, xml_space_preserve, original_file, localized_format_string, localized_format_key].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 :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/keys_delete.rb b/lib/Phrase/models/keys_delete.rb new file mode 100644 index 0000000..bb53733 --- /dev/null +++ b/lib/Phrase/models/keys_delete.rb @@ -0,0 +1,215 @@ +require 'date' + +module Phrase + class KeysDelete + # specify the branch to use + attr_accessor :branch + + # q_description_placeholder + attr_accessor :q + + # Locale used to determine the translation state of a key when filtering for untranslated or translated keys. + attr_accessor :locale_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'q' => :'q', + :'locale_id' => :'locale_id' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'q' => :'String', + :'locale_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::KeysDelete` 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::KeysDelete`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'q') + self.q = attributes[:'q'] + end + + if attributes.key?(:'locale_id') + self.locale_id = attributes[:'locale_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 && + branch == o.branch && + q == o.q && + locale_id == o.locale_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 + [branch, q, locale_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 :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/keys_list.rb b/lib/Phrase/models/keys_list.rb new file mode 100644 index 0000000..b1ca1bd --- /dev/null +++ b/lib/Phrase/models/keys_list.rb @@ -0,0 +1,235 @@ +require 'date' + +module Phrase + class KeysList + # specify the branch to use + attr_accessor :branch + + # Sort by field. Can be one of: name, created_at, updated_at. + attr_accessor :sort + + # Order direction. Can be one of: asc, desc. + attr_accessor :order + + # q_description_placeholder + attr_accessor :q + + # Locale used to determine the translation state of a key when filtering for untranslated or translated keys. + attr_accessor :locale_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'sort' => :'sort', + :'order' => :'order', + :'q' => :'q', + :'locale_id' => :'locale_id' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'sort' => :'String', + :'order' => :'String', + :'q' => :'String', + :'locale_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::KeysList` 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::KeysList`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'q') + self.q = attributes[:'q'] + end + + if attributes.key?(:'locale_id') + self.locale_id = attributes[:'locale_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 && + branch == o.branch && + sort == o.sort && + order == o.order && + q == o.q && + locale_id == o.locale_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 + [branch, sort, order, q, locale_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 :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/keys_search.rb b/lib/Phrase/models/keys_search.rb new file mode 100644 index 0000000..a2fb1a9 --- /dev/null +++ b/lib/Phrase/models/keys_search.rb @@ -0,0 +1,235 @@ +require 'date' + +module Phrase + class KeysSearch + # specify the branch to use + attr_accessor :branch + + # Sort by field. Can be one of: name, created_at, updated_at. + attr_accessor :sort + + # Order direction. Can be one of: asc, desc. + attr_accessor :order + + # q_description_placeholder + attr_accessor :q + + # Locale used to determine the translation state of a key when filtering for untranslated or translated keys. + attr_accessor :locale_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'sort' => :'sort', + :'order' => :'order', + :'q' => :'q', + :'locale_id' => :'locale_id' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'sort' => :'String', + :'order' => :'String', + :'q' => :'String', + :'locale_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::KeysSearch` 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::KeysSearch`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'q') + self.q = attributes[:'q'] + end + + if attributes.key?(:'locale_id') + self.locale_id = attributes[:'locale_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 && + branch == o.branch && + sort == o.sort && + order == o.order && + q == o.q && + locale_id == o.locale_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 + [branch, sort, order, q, locale_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 :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/keys_tag.rb b/lib/Phrase/models/keys_tag.rb new file mode 100644 index 0000000..c9268cf --- /dev/null +++ b/lib/Phrase/models/keys_tag.rb @@ -0,0 +1,225 @@ +require 'date' + +module Phrase + class KeysTag + # specify the branch to use + attr_accessor :branch + + # q_description_placeholder + attr_accessor :q + + # Locale used to determine the translation state of a key when filtering for untranslated or translated keys. + attr_accessor :locale_id + + # Tag or comma-separated list of tags to add to the matching collection of keys + attr_accessor :tags + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'q' => :'q', + :'locale_id' => :'locale_id', + :'tags' => :'tags' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'q' => :'String', + :'locale_id' => :'String', + :'tags' => :'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::KeysTag` 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::KeysTag`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'q') + self.q = attributes[:'q'] + end + + if attributes.key?(:'locale_id') + self.locale_id = attributes[:'locale_id'] + end + + if attributes.key?(:'tags') + self.tags = attributes[:'tags'] + 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 && + branch == o.branch && + q == o.q && + locale_id == o.locale_id && + tags == o.tags + 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 + [branch, q, locale_id, tags].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 :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/keys_untag.rb b/lib/Phrase/models/keys_untag.rb new file mode 100644 index 0000000..7d63d23 --- /dev/null +++ b/lib/Phrase/models/keys_untag.rb @@ -0,0 +1,225 @@ +require 'date' + +module Phrase + class KeysUntag + # specify the branch to use + attr_accessor :branch + + # q_description_placeholder + attr_accessor :q + + # Locale used to determine the translation state of a key when filtering for untranslated or translated keys. + attr_accessor :locale_id + + # Tag or comma-separated list of tags to remove from the matching collection of keys + attr_accessor :tags + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'q' => :'q', + :'locale_id' => :'locale_id', + :'tags' => :'tags' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'q' => :'String', + :'locale_id' => :'String', + :'tags' => :'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::KeysUntag` 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::KeysUntag`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'q') + self.q = attributes[:'q'] + end + + if attributes.key?(:'locale_id') + self.locale_id = attributes[:'locale_id'] + end + + if attributes.key?(:'tags') + self.tags = attributes[:'tags'] + 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 && + branch == o.branch && + q == o.q && + locale_id == o.locale_id && + tags == o.tags + 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 + [branch, q, locale_id, tags].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 :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/locale.rb b/lib/Phrase/models/locale.rb new file mode 100644 index 0000000..58fed1c --- /dev/null +++ b/lib/Phrase/models/locale.rb @@ -0,0 +1,277 @@ +require 'date' + +module Phrase + class Locale + attr_accessor :id + + attr_accessor :name + + attr_accessor :code + + attr_accessor :default + + attr_accessor :main + + attr_accessor :rtl + + attr_accessor :plural_forms + + attr_accessor :source_locale + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'code' => :'code', + :'default' => :'default', + :'main' => :'main', + :'rtl' => :'rtl', + :'plural_forms' => :'plural_forms', + :'source_locale' => :'source_locale', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'code' => :'String', + :'default' => :'Boolean', + :'main' => :'Boolean', + :'rtl' => :'Boolean', + :'plural_forms' => :'Array', + :'source_locale' => :'Object', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime' + } + 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::Locale` 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::Locale`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'default') + self.default = attributes[:'default'] + end + + if attributes.key?(:'main') + self.main = attributes[:'main'] + end + + if attributes.key?(:'rtl') + self.rtl = attributes[:'rtl'] + end + + if attributes.key?(:'plural_forms') + if (value = attributes[:'plural_forms']).is_a?(Array) + self.plural_forms = value + end + end + + if attributes.key?(:'source_locale') + self.source_locale = attributes[:'source_locale'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 && + id == o.id && + name == o.name && + code == o.code && + default == o.default && + main == o.main && + rtl == o.rtl && + plural_forms == o.plural_forms && + source_locale == o.source_locale && + created_at == o.created_at && + updated_at == o.updated_at + 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 + [id, name, code, default, main, rtl, plural_forms, source_locale, created_at, updated_at].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 :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/locale_create.rb b/lib/Phrase/models/locale_create.rb new file mode 100644 index 0000000..73c0340 --- /dev/null +++ b/lib/Phrase/models/locale_create.rb @@ -0,0 +1,285 @@ +require 'date' + +module Phrase + class LocaleCreate + # specify the branch to use + attr_accessor :branch + + # Locale name + attr_accessor :name + + # Locale ISO code + attr_accessor :code + + # Indicates whether locale is the default locale. If set to true, the previous default locale the project is no longer the default locale. + attr_accessor :default + + # Indicates whether locale is a main locale. Main locales are part of the Verification System feature. + attr_accessor :main + + # Indicates whether locale is a RTL (Right-to-Left) locale. + attr_accessor :rtl + + # Source locale. Can be the name or public id of the locale. Preferred is the public id. + attr_accessor :source_locale_id + + # Indicates that new translations for this locale should be marked as unverified. Part of the Advanced Workflows feature. + attr_accessor :unverify_new_translations + + # Indicates that updated translations for this locale should be marked as unverified. Part of the Advanced Workflows feature. + attr_accessor :unverify_updated_translations + + # If set, translations for this locale will be fetched automatically, right after creation. + attr_accessor :autotranslate + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'name' => :'name', + :'code' => :'code', + :'default' => :'default', + :'main' => :'main', + :'rtl' => :'rtl', + :'source_locale_id' => :'source_locale_id', + :'unverify_new_translations' => :'unverify_new_translations', + :'unverify_updated_translations' => :'unverify_updated_translations', + :'autotranslate' => :'autotranslate' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'name' => :'String', + :'code' => :'String', + :'default' => :'String', + :'main' => :'String', + :'rtl' => :'String', + :'source_locale_id' => :'String', + :'unverify_new_translations' => :'String', + :'unverify_updated_translations' => :'String', + :'autotranslate' => :'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::LocaleCreate` 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::LocaleCreate`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'default') + self.default = attributes[:'default'] + end + + if attributes.key?(:'main') + self.main = attributes[:'main'] + end + + if attributes.key?(:'rtl') + self.rtl = attributes[:'rtl'] + end + + if attributes.key?(:'source_locale_id') + self.source_locale_id = attributes[:'source_locale_id'] + end + + if attributes.key?(:'unverify_new_translations') + self.unverify_new_translations = attributes[:'unverify_new_translations'] + end + + if attributes.key?(:'unverify_updated_translations') + self.unverify_updated_translations = attributes[:'unverify_updated_translations'] + end + + if attributes.key?(:'autotranslate') + self.autotranslate = attributes[:'autotranslate'] + 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 && + branch == o.branch && + name == o.name && + code == o.code && + default == o.default && + main == o.main && + rtl == o.rtl && + source_locale_id == o.source_locale_id && + unverify_new_translations == o.unverify_new_translations && + unverify_updated_translations == o.unverify_updated_translations && + autotranslate == o.autotranslate + 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 + [branch, name, code, default, main, rtl, source_locale_id, unverify_new_translations, unverify_updated_translations, autotranslate].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 :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/locale_delete.rb b/lib/Phrase/models/locale_delete.rb new file mode 100644 index 0000000..fdae875 --- /dev/null +++ b/lib/Phrase/models/locale_delete.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class LocaleDelete + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::LocaleDelete` 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::LocaleDelete`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/locale_download.rb b/lib/Phrase/models/locale_download.rb new file mode 100644 index 0000000..2237d68 --- /dev/null +++ b/lib/Phrase/models/locale_download.rb @@ -0,0 +1,325 @@ +require 'date' + +module Phrase + class LocaleDownload + # specify the branch to use + attr_accessor :branch + + # File format name. See the format guide for all supported file formats. + attr_accessor :file_format + + # Limit results to keys tagged with a list of comma separated tag names. + attr_accessor :tags + + # Limit download to tagged keys. This parameter is deprecated. Please use the \"tags\" parameter instead + attr_accessor :tag + + # Indicates whether keys without translations should be included in the output as well. + attr_accessor :include_empty_translations + + # Include translated keys in the locale file. Use in combination with include_empty_translations to obtain only untranslated keys. + attr_accessor :include_translated_keys + + # Indicates whether [NOTRANSLATE] tags should be kept. + attr_accessor :keep_notranslate_tags + + # This option is obsolete. Projects that were created on or after Nov 29th 2019 or that did not contain emoji by then will not require this flag any longer since emoji are now supported natively. + attr_accessor :convert_emoji + + # Additional formatting and render options. See the format guide for a list of options available for each format. Specify format options like this: ...&format_options[foo]=bar + attr_accessor :format_options + + # Enforces a specific encoding on the file contents. Valid options are \"UTF-8\", \"UTF-16\" and \"ISO-8859-1\". + attr_accessor :encoding + + # Indicates whether the locale file should skip all unverified translations. This parameter is deprecated and should be replaced with include_unverified_translations. + attr_accessor :skip_unverified_translations + + # if set to false unverified translations are excluded + attr_accessor :include_unverified_translations + + # If set to true the last reviewed version of a translation is used. This is only available if the review workflow (currently in beta) is enabled for the project. + attr_accessor :use_last_reviewed_version + + # If a key has no translation in the locale being downloaded the translation in the fallback locale will be used. Provide the public ID of the locale that should be used as the fallback. Requires include_empty_translations to be set to true. + attr_accessor :fallback_locale_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'file_format' => :'file_format', + :'tags' => :'tags', + :'tag' => :'tag', + :'include_empty_translations' => :'include_empty_translations', + :'include_translated_keys' => :'include_translated_keys', + :'keep_notranslate_tags' => :'keep_notranslate_tags', + :'convert_emoji' => :'convert_emoji', + :'format_options' => :'format_options', + :'encoding' => :'encoding', + :'skip_unverified_translations' => :'skip_unverified_translations', + :'include_unverified_translations' => :'include_unverified_translations', + :'use_last_reviewed_version' => :'use_last_reviewed_version', + :'fallback_locale_id' => :'fallback_locale_id' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'file_format' => :'String', + :'tags' => :'String', + :'tag' => :'String', + :'include_empty_translations' => :'String', + :'include_translated_keys' => :'String', + :'keep_notranslate_tags' => :'String', + :'convert_emoji' => :'String', + :'format_options' => :'String', + :'encoding' => :'String', + :'skip_unverified_translations' => :'String', + :'include_unverified_translations' => :'String', + :'use_last_reviewed_version' => :'String', + :'fallback_locale_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::LocaleDownload` 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::LocaleDownload`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'file_format') + self.file_format = attributes[:'file_format'] + end + + if attributes.key?(:'tags') + self.tags = attributes[:'tags'] + end + + if attributes.key?(:'tag') + self.tag = attributes[:'tag'] + end + + if attributes.key?(:'include_empty_translations') + self.include_empty_translations = attributes[:'include_empty_translations'] + end + + if attributes.key?(:'include_translated_keys') + self.include_translated_keys = attributes[:'include_translated_keys'] + end + + if attributes.key?(:'keep_notranslate_tags') + self.keep_notranslate_tags = attributes[:'keep_notranslate_tags'] + end + + if attributes.key?(:'convert_emoji') + self.convert_emoji = attributes[:'convert_emoji'] + end + + if attributes.key?(:'format_options') + self.format_options = attributes[:'format_options'] + end + + if attributes.key?(:'encoding') + self.encoding = attributes[:'encoding'] + end + + if attributes.key?(:'skip_unverified_translations') + self.skip_unverified_translations = attributes[:'skip_unverified_translations'] + end + + if attributes.key?(:'include_unverified_translations') + self.include_unverified_translations = attributes[:'include_unverified_translations'] + end + + if attributes.key?(:'use_last_reviewed_version') + self.use_last_reviewed_version = attributes[:'use_last_reviewed_version'] + end + + if attributes.key?(:'fallback_locale_id') + self.fallback_locale_id = attributes[:'fallback_locale_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 && + branch == o.branch && + file_format == o.file_format && + tags == o.tags && + tag == o.tag && + include_empty_translations == o.include_empty_translations && + include_translated_keys == o.include_translated_keys && + keep_notranslate_tags == o.keep_notranslate_tags && + convert_emoji == o.convert_emoji && + format_options == o.format_options && + encoding == o.encoding && + skip_unverified_translations == o.skip_unverified_translations && + include_unverified_translations == o.include_unverified_translations && + use_last_reviewed_version == o.use_last_reviewed_version && + fallback_locale_id == o.fallback_locale_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 + [branch, file_format, tags, tag, include_empty_translations, include_translated_keys, keep_notranslate_tags, convert_emoji, format_options, encoding, skip_unverified_translations, include_unverified_translations, use_last_reviewed_version, fallback_locale_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 :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/locale_preview.rb b/lib/Phrase/models/locale_preview.rb new file mode 100644 index 0000000..7381e34 --- /dev/null +++ b/lib/Phrase/models/locale_preview.rb @@ -0,0 +1,212 @@ +require 'date' + +module Phrase + class LocalePreview + attr_accessor :id + + attr_accessor :name + + attr_accessor :code + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'code' => :'code' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'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::LocalePreview` 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::LocalePreview`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + 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 && + id == o.id && + name == o.name && + 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 + [id, name, 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 :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/locale_show.rb b/lib/Phrase/models/locale_show.rb new file mode 100644 index 0000000..e6565cd --- /dev/null +++ b/lib/Phrase/models/locale_show.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class LocaleShow + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::LocaleShow` 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::LocaleShow`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/locale_update.rb b/lib/Phrase/models/locale_update.rb new file mode 100644 index 0000000..a4d1b8c --- /dev/null +++ b/lib/Phrase/models/locale_update.rb @@ -0,0 +1,285 @@ +require 'date' + +module Phrase + class LocaleUpdate + # specify the branch to use + attr_accessor :branch + + # Locale name + attr_accessor :name + + # Locale ISO code + attr_accessor :code + + # Indicates whether locale is the default locale. If set to true, the previous default locale the project is no longer the default locale. + attr_accessor :default + + # Indicates whether locale is a main locale. Main locales are part of the Verification System feature. + attr_accessor :main + + # Indicates whether locale is a RTL (Right-to-Left) locale. + attr_accessor :rtl + + # Source locale. Can be the name or public id of the locale. Preferred is the public id. + attr_accessor :source_locale_id + + # Indicates that new translations for this locale should be marked as unverified. Part of the Advanced Workflows feature. + attr_accessor :unverify_new_translations + + # Indicates that updated translations for this locale should be marked as unverified. Part of the Advanced Workflows feature. + attr_accessor :unverify_updated_translations + + # If set, translations for this locale will be fetched automatically, right after creation. + attr_accessor :autotranslate + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'name' => :'name', + :'code' => :'code', + :'default' => :'default', + :'main' => :'main', + :'rtl' => :'rtl', + :'source_locale_id' => :'source_locale_id', + :'unverify_new_translations' => :'unverify_new_translations', + :'unverify_updated_translations' => :'unverify_updated_translations', + :'autotranslate' => :'autotranslate' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'name' => :'String', + :'code' => :'String', + :'default' => :'String', + :'main' => :'String', + :'rtl' => :'String', + :'source_locale_id' => :'String', + :'unverify_new_translations' => :'String', + :'unverify_updated_translations' => :'String', + :'autotranslate' => :'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::LocaleUpdate` 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::LocaleUpdate`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'default') + self.default = attributes[:'default'] + end + + if attributes.key?(:'main') + self.main = attributes[:'main'] + end + + if attributes.key?(:'rtl') + self.rtl = attributes[:'rtl'] + end + + if attributes.key?(:'source_locale_id') + self.source_locale_id = attributes[:'source_locale_id'] + end + + if attributes.key?(:'unverify_new_translations') + self.unverify_new_translations = attributes[:'unverify_new_translations'] + end + + if attributes.key?(:'unverify_updated_translations') + self.unverify_updated_translations = attributes[:'unverify_updated_translations'] + end + + if attributes.key?(:'autotranslate') + self.autotranslate = attributes[:'autotranslate'] + 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 && + branch == o.branch && + name == o.name && + code == o.code && + default == o.default && + main == o.main && + rtl == o.rtl && + source_locale_id == o.source_locale_id && + unverify_new_translations == o.unverify_new_translations && + unverify_updated_translations == o.unverify_updated_translations && + autotranslate == o.autotranslate + 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 + [branch, name, code, default, main, rtl, source_locale_id, unverify_new_translations, unverify_updated_translations, autotranslate].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 :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/locales_list.rb b/lib/Phrase/models/locales_list.rb new file mode 100644 index 0000000..bca3254 --- /dev/null +++ b/lib/Phrase/models/locales_list.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class LocalesList + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::LocalesList` 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::LocalesList`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/member.rb b/lib/Phrase/models/member.rb new file mode 100644 index 0000000..fd5988f --- /dev/null +++ b/lib/Phrase/models/member.rb @@ -0,0 +1,232 @@ +require 'date' + +module Phrase + class Member + attr_accessor :id + + attr_accessor :email + + attr_accessor :username + + attr_accessor :role + + attr_accessor :projects + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'email' => :'email', + :'username' => :'username', + :'role' => :'role', + :'projects' => :'projects' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'email' => :'String', + :'username' => :'String', + :'role' => :'String', + :'projects' => :'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::Member` 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::Member`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'username') + self.username = attributes[:'username'] + end + + if attributes.key?(:'role') + self.role = attributes[:'role'] + end + + if attributes.key?(:'projects') + if (value = attributes[:'projects']).is_a?(Array) + self.projects = 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 && + id == o.id && + email == o.email && + username == o.username && + role == o.role && + projects == o.projects + 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 + [id, email, username, role, projects].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 :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/member_update.rb b/lib/Phrase/models/member_update.rb new file mode 100644 index 0000000..6213983 --- /dev/null +++ b/lib/Phrase/models/member_update.rb @@ -0,0 +1,225 @@ +require 'date' + +module Phrase + class MemberUpdate + # Member role, can be any of of Manager, Developer, Translator + attr_accessor :role + + # List of project ids the user has access to. + attr_accessor :project_ids + + # List of locale ids the user has access to. + attr_accessor :locale_ids + + # Additional permissions depending on member role. Available permissions are create_upload and review_translations + attr_accessor :permissions + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'role' => :'role', + :'project_ids' => :'project_ids', + :'locale_ids' => :'locale_ids', + :'permissions' => :'permissions' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'role' => :'String', + :'project_ids' => :'String', + :'locale_ids' => :'String', + :'permissions' => :'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::MemberUpdate` 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::MemberUpdate`. 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?(:'role') + self.role = attributes[:'role'] + end + + if attributes.key?(:'project_ids') + self.project_ids = attributes[:'project_ids'] + end + + if attributes.key?(:'locale_ids') + self.locale_ids = attributes[:'locale_ids'] + end + + if attributes.key?(:'permissions') + self.permissions = attributes[:'permissions'] + 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 && + role == o.role && + project_ids == o.project_ids && + locale_ids == o.locale_ids && + permissions == o.permissions + 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 + [role, project_ids, locale_ids, permissions].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 :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/order_confirm.rb b/lib/Phrase/models/order_confirm.rb new file mode 100644 index 0000000..59aee60 --- /dev/null +++ b/lib/Phrase/models/order_confirm.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class OrderConfirm + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::OrderConfirm` 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::OrderConfirm`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/order_create.rb b/lib/Phrase/models/order_create.rb new file mode 100644 index 0000000..15408e1 --- /dev/null +++ b/lib/Phrase/models/order_create.rb @@ -0,0 +1,325 @@ +require 'date' + +module Phrase + class OrderCreate + # specify the branch to use + attr_accessor :branch + + # Name of the LSP that should process this order. Can be one of gengo, textmaster. + attr_accessor :lsp + + # Source locale for the order. Can be the name or public id of the source locale. Preferred is the public id. + attr_accessor :source_locale_id + + # List of target locales you want the source content translate to. Can be the name or public id of the target locales. Preferred is the public id. + attr_accessor :target_locale_ids + + # Name of the quality level, availability depends on the LSP. Can be one of: standard, pro (for orders processed by Gengo) and one of regular, premium, enterprise (for orders processed by TextMaster) + attr_accessor :translation_type + + # Tag you want to order translations for. + attr_accessor :tag + + # Message that is displayed to the translators for description. + attr_accessor :message + + # Style guide for translators to be sent with the order. + attr_accessor :styleguide_id + + # Unverify translations upon delivery. + attr_accessor :unverify_translations_upon_delivery + + # Order translations for keys with untranslated content in the selected target locales. + attr_accessor :include_untranslated_keys + + # Order translations for keys with unverified content in the selected target locales. + attr_accessor :include_unverified_translations + + # Category to use (required for orders processed by TextMaster). + attr_accessor :category + + # Extra proofreading option to ensure consistency in vocabulary and style. Only available for orders processed by TextMaster. + attr_accessor :quality + + # Indicates whether the priority option should be ordered which decreases turnaround time by 30%. Available only for orders processed by TextMaster. + attr_accessor :priority + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'lsp' => :'lsp', + :'source_locale_id' => :'source_locale_id', + :'target_locale_ids' => :'target_locale_ids', + :'translation_type' => :'translation_type', + :'tag' => :'tag', + :'message' => :'message', + :'styleguide_id' => :'styleguide_id', + :'unverify_translations_upon_delivery' => :'unverify_translations_upon_delivery', + :'include_untranslated_keys' => :'include_untranslated_keys', + :'include_unverified_translations' => :'include_unverified_translations', + :'category' => :'category', + :'quality' => :'quality', + :'priority' => :'priority' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'lsp' => :'String', + :'source_locale_id' => :'String', + :'target_locale_ids' => :'String', + :'translation_type' => :'String', + :'tag' => :'String', + :'message' => :'String', + :'styleguide_id' => :'String', + :'unverify_translations_upon_delivery' => :'String', + :'include_untranslated_keys' => :'String', + :'include_unverified_translations' => :'String', + :'category' => :'String', + :'quality' => :'String', + :'priority' => :'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::OrderCreate` 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::OrderCreate`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'lsp') + self.lsp = attributes[:'lsp'] + end + + if attributes.key?(:'source_locale_id') + self.source_locale_id = attributes[:'source_locale_id'] + end + + if attributes.key?(:'target_locale_ids') + self.target_locale_ids = attributes[:'target_locale_ids'] + end + + if attributes.key?(:'translation_type') + self.translation_type = attributes[:'translation_type'] + end + + if attributes.key?(:'tag') + self.tag = attributes[:'tag'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + + if attributes.key?(:'styleguide_id') + self.styleguide_id = attributes[:'styleguide_id'] + end + + if attributes.key?(:'unverify_translations_upon_delivery') + self.unverify_translations_upon_delivery = attributes[:'unverify_translations_upon_delivery'] + end + + if attributes.key?(:'include_untranslated_keys') + self.include_untranslated_keys = attributes[:'include_untranslated_keys'] + end + + if attributes.key?(:'include_unverified_translations') + self.include_unverified_translations = attributes[:'include_unverified_translations'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'quality') + self.quality = attributes[:'quality'] + end + + if attributes.key?(:'priority') + self.priority = attributes[:'priority'] + 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 && + branch == o.branch && + lsp == o.lsp && + source_locale_id == o.source_locale_id && + target_locale_ids == o.target_locale_ids && + translation_type == o.translation_type && + tag == o.tag && + message == o.message && + styleguide_id == o.styleguide_id && + unverify_translations_upon_delivery == o.unverify_translations_upon_delivery && + include_untranslated_keys == o.include_untranslated_keys && + include_unverified_translations == o.include_unverified_translations && + category == o.category && + quality == o.quality && + priority == o.priority + 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 + [branch, lsp, source_locale_id, target_locale_ids, translation_type, tag, message, styleguide_id, unverify_translations_upon_delivery, include_untranslated_keys, include_unverified_translations, category, quality, priority].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 :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/order_delete.rb b/lib/Phrase/models/order_delete.rb new file mode 100644 index 0000000..626593c --- /dev/null +++ b/lib/Phrase/models/order_delete.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class OrderDelete + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::OrderDelete` 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::OrderDelete`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/order_show.rb b/lib/Phrase/models/order_show.rb new file mode 100644 index 0000000..962e401 --- /dev/null +++ b/lib/Phrase/models/order_show.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class OrderShow + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::OrderShow` 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::OrderShow`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/orders_list.rb b/lib/Phrase/models/orders_list.rb new file mode 100644 index 0000000..02ee37d --- /dev/null +++ b/lib/Phrase/models/orders_list.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class OrdersList + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::OrdersList` 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::OrdersList`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/project.rb b/lib/Phrase/models/project.rb new file mode 100644 index 0000000..7c30a48 --- /dev/null +++ b/lib/Phrase/models/project.rb @@ -0,0 +1,248 @@ +require 'date' + +module Phrase + class Project + attr_accessor :id + + attr_accessor :name + + attr_accessor :main_format + + attr_accessor :project_image_url + + attr_accessor :account + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'main_format' => :'main_format', + :'project_image_url' => :'project_image_url', + :'account' => :'account', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'main_format' => :'String', + :'project_image_url' => :'String', + :'account' => :'Account', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime' + } + 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::Project` 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::Project`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'main_format') + self.main_format = attributes[:'main_format'] + end + + if attributes.key?(:'project_image_url') + self.project_image_url = attributes[:'project_image_url'] + end + + if attributes.key?(:'account') + self.account = attributes[:'account'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 && + id == o.id && + name == o.name && + main_format == o.main_format && + project_image_url == o.project_image_url && + account == o.account && + created_at == o.created_at && + updated_at == o.updated_at + 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 + [id, name, main_format, project_image_url, account, created_at, updated_at].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 :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/project_create.rb b/lib/Phrase/models/project_create.rb new file mode 100644 index 0000000..3f8d89c --- /dev/null +++ b/lib/Phrase/models/project_create.rb @@ -0,0 +1,245 @@ +require 'date' + +module Phrase + class ProjectCreate + # Name of the project + attr_accessor :name + + # Main file format specified by its API Extension name. Used for locale downloads if no format is specified. For API Extension names of available file formats see Format Guide or our Formats API Endpoint. + attr_accessor :main_format + + # Indicates whether the project should share the account's translation memory + attr_accessor :shares_translation_memory + + # Image to identify the project + attr_accessor :project_image + + # Indicates whether the project image should be deleted. + attr_accessor :remove_project_image + + # Account ID to specify the actual account the project should be created in. Required if the requesting user is a member of multiple accounts. + attr_accessor :account_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'main_format' => :'main_format', + :'shares_translation_memory' => :'shares_translation_memory', + :'project_image' => :'project_image', + :'remove_project_image' => :'remove_project_image', + :'account_id' => :'account_id' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'main_format' => :'String', + :'shares_translation_memory' => :'String', + :'project_image' => :'String', + :'remove_project_image' => :'String', + :'account_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::ProjectCreate` 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::ProjectCreate`. 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?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'main_format') + self.main_format = attributes[:'main_format'] + end + + if attributes.key?(:'shares_translation_memory') + self.shares_translation_memory = attributes[:'shares_translation_memory'] + end + + if attributes.key?(:'project_image') + self.project_image = attributes[:'project_image'] + end + + if attributes.key?(:'remove_project_image') + self.remove_project_image = attributes[:'remove_project_image'] + end + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_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 && + name == o.name && + main_format == o.main_format && + shares_translation_memory == o.shares_translation_memory && + project_image == o.project_image && + remove_project_image == o.remove_project_image && + account_id == o.account_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 + [name, main_format, shares_translation_memory, project_image, remove_project_image, account_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 :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/project_short.rb b/lib/Phrase/models/project_short.rb new file mode 100644 index 0000000..5657c30 --- /dev/null +++ b/lib/Phrase/models/project_short.rb @@ -0,0 +1,230 @@ +require 'date' + +module Phrase + class ProjectShort + attr_accessor :id + + attr_accessor :name + + attr_accessor :main_format + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'main_format' => :'main_format', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'main_format' => :'String', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime' + } + 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::ProjectShort` 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::ProjectShort`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'main_format') + self.main_format = attributes[:'main_format'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 && + id == o.id && + name == o.name && + main_format == o.main_format && + created_at == o.created_at && + updated_at == o.updated_at + 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 + [id, name, main_format, created_at, updated_at].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 :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/project_update.rb b/lib/Phrase/models/project_update.rb new file mode 100644 index 0000000..55975b9 --- /dev/null +++ b/lib/Phrase/models/project_update.rb @@ -0,0 +1,245 @@ +require 'date' + +module Phrase + class ProjectUpdate + # Name of the project + attr_accessor :name + + # Main file format specified by its API Extension name. Used for locale downloads if no format is specified. For API Extension names of available file formats see Format Guide or our Formats API Endpoint. + attr_accessor :main_format + + # Indicates whether the project should share the account's translation memory + attr_accessor :shares_translation_memory + + # Image to identify the project + attr_accessor :project_image + + # Indicates whether the project image should be deleted. + attr_accessor :remove_project_image + + # Account ID to specify the actual account the project should be created in. Required if the requesting user is a member of multiple accounts. + attr_accessor :account_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'main_format' => :'main_format', + :'shares_translation_memory' => :'shares_translation_memory', + :'project_image' => :'project_image', + :'remove_project_image' => :'remove_project_image', + :'account_id' => :'account_id' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'main_format' => :'String', + :'shares_translation_memory' => :'String', + :'project_image' => :'String', + :'remove_project_image' => :'String', + :'account_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::ProjectUpdate` 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::ProjectUpdate`. 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?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'main_format') + self.main_format = attributes[:'main_format'] + end + + if attributes.key?(:'shares_translation_memory') + self.shares_translation_memory = attributes[:'shares_translation_memory'] + end + + if attributes.key?(:'project_image') + self.project_image = attributes[:'project_image'] + end + + if attributes.key?(:'remove_project_image') + self.remove_project_image = attributes[:'remove_project_image'] + end + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_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 && + name == o.name && + main_format == o.main_format && + shares_translation_memory == o.shares_translation_memory && + project_image == o.project_image && + remove_project_image == o.remove_project_image && + account_id == o.account_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 + [name, main_format, shares_translation_memory, project_image, remove_project_image, account_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 :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/release.rb b/lib/Phrase/models/release.rb new file mode 100644 index 0000000..2af4357 --- /dev/null +++ b/lib/Phrase/models/release.rb @@ -0,0 +1,290 @@ +require 'date' + +module Phrase + class Release + attr_accessor :id + + attr_accessor :version + + attr_accessor :app_min_version + + attr_accessor :app_max_version + + attr_accessor :description + + attr_accessor :platforms + + attr_accessor :environments + + attr_accessor :locales + + attr_accessor :project + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'version' => :'version', + :'app_min_version' => :'app_min_version', + :'app_max_version' => :'app_max_version', + :'description' => :'description', + :'platforms' => :'platforms', + :'environments' => :'environments', + :'locales' => :'locales', + :'project' => :'project', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'version' => :'Integer', + :'app_min_version' => :'String', + :'app_max_version' => :'String', + :'description' => :'String', + :'platforms' => :'Array', + :'environments' => :'Array', + :'locales' => :'Array', + :'project' => :'Object', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime' + } + 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::Release` 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::Release`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'version') + self.version = attributes[:'version'] + end + + if attributes.key?(:'app_min_version') + self.app_min_version = attributes[:'app_min_version'] + end + + if attributes.key?(:'app_max_version') + self.app_max_version = attributes[:'app_max_version'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'platforms') + if (value = attributes[:'platforms']).is_a?(Array) + self.platforms = value + end + end + + if attributes.key?(:'environments') + if (value = attributes[:'environments']).is_a?(Array) + self.environments = value + end + end + + if attributes.key?(:'locales') + if (value = attributes[:'locales']).is_a?(Array) + self.locales = value + end + end + + if attributes.key?(:'project') + self.project = attributes[:'project'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 && + id == o.id && + version == o.version && + app_min_version == o.app_min_version && + app_max_version == o.app_max_version && + description == o.description && + platforms == o.platforms && + environments == o.environments && + locales == o.locales && + project == o.project && + created_at == o.created_at && + updated_at == o.updated_at + 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 + [id, version, app_min_version, app_max_version, description, platforms, environments, locales, project, created_at, updated_at].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 :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/release_create.rb b/lib/Phrase/models/release_create.rb new file mode 100644 index 0000000..b0ddbd2 --- /dev/null +++ b/lib/Phrase/models/release_create.rb @@ -0,0 +1,215 @@ +require 'date' + +module Phrase + class ReleaseCreate + # Description of the release + attr_accessor :description + + # List of platforms the release should support. + attr_accessor :platforms + + # Branch used for release + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'description' => :'description', + :'platforms' => :'platforms', + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'description' => :'String', + :'platforms' => :'String', + :'branch' => :'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::ReleaseCreate` 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::ReleaseCreate`. 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?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'platforms') + self.platforms = attributes[:'platforms'] + end + + if attributes.key?(:'branch') + self.branch = attributes[:'branch'] + 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 && + description == o.description && + platforms == o.platforms && + branch == o.branch + 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 + [description, platforms, branch].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 :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/release_preview.rb b/lib/Phrase/models/release_preview.rb new file mode 100644 index 0000000..1a87ce3 --- /dev/null +++ b/lib/Phrase/models/release_preview.rb @@ -0,0 +1,290 @@ +require 'date' + +module Phrase + class ReleasePreview + attr_accessor :id + + attr_accessor :version + + attr_accessor :app_min_version + + attr_accessor :app_max_version + + attr_accessor :description + + attr_accessor :platforms + + attr_accessor :environments + + attr_accessor :locale_codes + + attr_accessor :project + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'version' => :'version', + :'app_min_version' => :'app_min_version', + :'app_max_version' => :'app_max_version', + :'description' => :'description', + :'platforms' => :'platforms', + :'environments' => :'environments', + :'locale_codes' => :'locale_codes', + :'project' => :'project', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'version' => :'Integer', + :'app_min_version' => :'String', + :'app_max_version' => :'String', + :'description' => :'String', + :'platforms' => :'Array', + :'environments' => :'Array', + :'locale_codes' => :'Array', + :'project' => :'Object', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime' + } + 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::ReleasePreview` 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::ReleasePreview`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'version') + self.version = attributes[:'version'] + end + + if attributes.key?(:'app_min_version') + self.app_min_version = attributes[:'app_min_version'] + end + + if attributes.key?(:'app_max_version') + self.app_max_version = attributes[:'app_max_version'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'platforms') + if (value = attributes[:'platforms']).is_a?(Array) + self.platforms = value + end + end + + if attributes.key?(:'environments') + if (value = attributes[:'environments']).is_a?(Array) + self.environments = value + end + end + + if attributes.key?(:'locale_codes') + if (value = attributes[:'locale_codes']).is_a?(Array) + self.locale_codes = value + end + end + + if attributes.key?(:'project') + self.project = attributes[:'project'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 && + id == o.id && + version == o.version && + app_min_version == o.app_min_version && + app_max_version == o.app_max_version && + description == o.description && + platforms == o.platforms && + environments == o.environments && + locale_codes == o.locale_codes && + project == o.project && + created_at == o.created_at && + updated_at == o.updated_at + 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 + [id, version, app_min_version, app_max_version, description, platforms, environments, locale_codes, project, created_at, updated_at].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 :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/release_update.rb b/lib/Phrase/models/release_update.rb new file mode 100644 index 0000000..887dcf4 --- /dev/null +++ b/lib/Phrase/models/release_update.rb @@ -0,0 +1,215 @@ +require 'date' + +module Phrase + class ReleaseUpdate + # Description of the release + attr_accessor :description + + # List of platforms the release should support. + attr_accessor :platforms + + # Branch used for release + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'description' => :'description', + :'platforms' => :'platforms', + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'description' => :'String', + :'platforms' => :'String', + :'branch' => :'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::ReleaseUpdate` 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::ReleaseUpdate`. 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?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'platforms') + self.platforms = attributes[:'platforms'] + end + + if attributes.key?(:'branch') + self.branch = attributes[:'branch'] + 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 && + description == o.description && + platforms == o.platforms && + branch == o.branch + 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 + [description, platforms, branch].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 :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/screenshot.rb b/lib/Phrase/models/screenshot.rb new file mode 100644 index 0000000..4e9411a --- /dev/null +++ b/lib/Phrase/models/screenshot.rb @@ -0,0 +1,248 @@ +require 'date' + +module Phrase + class Screenshot + attr_accessor :id + + attr_accessor :name + + attr_accessor :description + + attr_accessor :screenshot_url + + attr_accessor :created_at + + attr_accessor :updated_at + + attr_accessor :markers_count + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'description' => :'description', + :'screenshot_url' => :'screenshot_url', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'markers_count' => :'markers_count' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'description' => :'String', + :'screenshot_url' => :'String', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime', + :'markers_count' => :'Integer' + } + 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::Screenshot` 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::Screenshot`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'screenshot_url') + self.screenshot_url = attributes[:'screenshot_url'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'markers_count') + self.markers_count = attributes[:'markers_count'] + 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 && + id == o.id && + name == o.name && + description == o.description && + screenshot_url == o.screenshot_url && + created_at == o.created_at && + updated_at == o.updated_at && + markers_count == o.markers_count + 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 + [id, name, description, screenshot_url, created_at, updated_at, markers_count].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 :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/screenshot_create.rb b/lib/Phrase/models/screenshot_create.rb new file mode 100644 index 0000000..e484e05 --- /dev/null +++ b/lib/Phrase/models/screenshot_create.rb @@ -0,0 +1,215 @@ +require 'date' + +module Phrase + class ScreenshotCreate + # Name of the screenshot + attr_accessor :name + + # Description of the screenshot + attr_accessor :description + + # Screenshot file + attr_accessor :filename + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'description' => :'description', + :'filename' => :'filename' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'description' => :'String', + :'filename' => :'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::ScreenshotCreate` 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::ScreenshotCreate`. 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?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'filename') + self.filename = attributes[:'filename'] + 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 && + name == o.name && + description == o.description && + filename == o.filename + 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 + [name, description, filename].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 :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/screenshot_marker.rb b/lib/Phrase/models/screenshot_marker.rb new file mode 100644 index 0000000..28ba172 --- /dev/null +++ b/lib/Phrase/models/screenshot_marker.rb @@ -0,0 +1,239 @@ +require 'date' + +module Phrase + class ScreenshotMarker + attr_accessor :id + + attr_accessor :presentation + + attr_accessor :presentation_type + + attr_accessor :created_at + + attr_accessor :updated_at + + attr_accessor :translation_key + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'presentation' => :'presentation', + :'presentation_type' => :'presentation_type', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'translation_key' => :'translation_key' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'presentation' => :'String', + :'presentation_type' => :'String', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime', + :'translation_key' => :'Object' + } + 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::ScreenshotMarker` 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::ScreenshotMarker`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'presentation') + self.presentation = attributes[:'presentation'] + end + + if attributes.key?(:'presentation_type') + self.presentation_type = attributes[:'presentation_type'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'translation_key') + self.translation_key = attributes[:'translation_key'] + 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 && + id == o.id && + presentation == o.presentation && + presentation_type == o.presentation_type && + created_at == o.created_at && + updated_at == o.updated_at && + translation_key == o.translation_key + 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 + [id, presentation, presentation_type, created_at, updated_at, translation_key].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 :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/screenshot_marker_create.rb b/lib/Phrase/models/screenshot_marker_create.rb new file mode 100644 index 0000000..8e08587 --- /dev/null +++ b/lib/Phrase/models/screenshot_marker_create.rb @@ -0,0 +1,205 @@ +require 'date' + +module Phrase + class ScreenshotMarkerCreate + # Specify the Key ID which should be highlighted on the specified screenshot. The Key must belong to the project. + attr_accessor :key_id + + # Presentation details of the screenshot marker in JSON format.

Each Screenshot Marker is represented as a rectangular shaped highlight box with the name of the specified Key attached. You can specify the marker position on the screenshot (x-axis and y-axis in pixels) from the top left corner of the screenshot and the dimensions of the marker itself (w and h in pixels). + attr_accessor :presentation + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'key_id' => :'key_id', + :'presentation' => :'presentation' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'key_id' => :'String', + :'presentation' => :'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::ScreenshotMarkerCreate` 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::ScreenshotMarkerCreate`. 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?(:'key_id') + self.key_id = attributes[:'key_id'] + end + + if attributes.key?(:'presentation') + self.presentation = attributes[:'presentation'] + 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 && + key_id == o.key_id && + presentation == o.presentation + 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 + [key_id, presentation].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 :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/screenshot_marker_update.rb b/lib/Phrase/models/screenshot_marker_update.rb new file mode 100644 index 0000000..e0f8db1 --- /dev/null +++ b/lib/Phrase/models/screenshot_marker_update.rb @@ -0,0 +1,205 @@ +require 'date' + +module Phrase + class ScreenshotMarkerUpdate + # Specify the Key ID which should be highlighted on the specified screenshot. The Key must belong to the project. + attr_accessor :key_id + + # Presentation details of the screenshot marker in JSON format.

Each Screenshot Marker is represented as a rectangular shaped highlight box with the name of the specified Key attached. You can specify the marker position on the screenshot (x-axis and y-axis in pixels) from the top left corner of the screenshot and the dimensions of the marker itself (w and h in pixels). + attr_accessor :presentation + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'key_id' => :'key_id', + :'presentation' => :'presentation' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'key_id' => :'String', + :'presentation' => :'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::ScreenshotMarkerUpdate` 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::ScreenshotMarkerUpdate`. 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?(:'key_id') + self.key_id = attributes[:'key_id'] + end + + if attributes.key?(:'presentation') + self.presentation = attributes[:'presentation'] + 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 && + key_id == o.key_id && + presentation == o.presentation + 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 + [key_id, presentation].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 :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/screenshot_update.rb b/lib/Phrase/models/screenshot_update.rb new file mode 100644 index 0000000..d8b46a8 --- /dev/null +++ b/lib/Phrase/models/screenshot_update.rb @@ -0,0 +1,215 @@ +require 'date' + +module Phrase + class ScreenshotUpdate + # Name of the screenshot + attr_accessor :name + + # Description of the screenshot + attr_accessor :description + + # Screenshot file + attr_accessor :filename + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'description' => :'description', + :'filename' => :'filename' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'description' => :'String', + :'filename' => :'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::ScreenshotUpdate` 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::ScreenshotUpdate`. 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?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'filename') + self.filename = attributes[:'filename'] + 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 && + name == o.name && + description == o.description && + filename == o.filename + 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 + [name, description, filename].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 :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/space.rb b/lib/Phrase/models/space.rb new file mode 100644 index 0000000..330590f --- /dev/null +++ b/lib/Phrase/models/space.rb @@ -0,0 +1,241 @@ +require 'date' + +module Phrase + class Space + attr_accessor :id + + attr_accessor :name + + attr_accessor :created_at + + attr_accessor :updated_at + + attr_accessor :projects_count + + attr_accessor :projects + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'projects_count' => :'projects_count', + :'projects' => :'projects' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime', + :'projects_count' => :'Integer', + :'projects' => :'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::Space` 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::Space`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'projects_count') + self.projects_count = attributes[:'projects_count'] + end + + if attributes.key?(:'projects') + if (value = attributes[:'projects']).is_a?(Array) + self.projects = 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 && + id == o.id && + name == o.name && + created_at == o.created_at && + updated_at == o.updated_at && + projects_count == o.projects_count && + projects == o.projects + 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 + [id, name, created_at, updated_at, projects_count, projects].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 :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/space_create.rb b/lib/Phrase/models/space_create.rb new file mode 100644 index 0000000..b965b65 --- /dev/null +++ b/lib/Phrase/models/space_create.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class SpaceCreate + # Name of the space + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'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::SpaceCreate` 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::SpaceCreate`. 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?(:'name') + self.name = attributes[:'name'] + 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 && + name == o.name + 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 + [name].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 :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/space_update.rb b/lib/Phrase/models/space_update.rb new file mode 100644 index 0000000..daf58ac --- /dev/null +++ b/lib/Phrase/models/space_update.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class SpaceUpdate + # New name of the space + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'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::SpaceUpdate` 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::SpaceUpdate`. 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?(:'name') + self.name = attributes[:'name'] + 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 && + name == o.name + 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 + [name].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 :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/spaces_projects_create.rb b/lib/Phrase/models/spaces_projects_create.rb new file mode 100644 index 0000000..e40bacc --- /dev/null +++ b/lib/Phrase/models/spaces_projects_create.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class SpacesProjectsCreate + # Project ID to add or to the Space + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'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::SpacesProjectsCreate` 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::SpacesProjectsCreate`. 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?(:'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 && + 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 + [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 :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/styleguide.rb b/lib/Phrase/models/styleguide.rb new file mode 100644 index 0000000..0d8b5f6 --- /dev/null +++ b/lib/Phrase/models/styleguide.rb @@ -0,0 +1,221 @@ +require 'date' + +module Phrase + class Styleguide + attr_accessor :id + + attr_accessor :title + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'title' => :'title', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'title' => :'String', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime' + } + 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::Styleguide` 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::Styleguide`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 && + id == o.id && + title == o.title && + created_at == o.created_at && + updated_at == o.updated_at + 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 + [id, title, created_at, updated_at].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 :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/styleguide_create.rb b/lib/Phrase/models/styleguide_create.rb new file mode 100644 index 0000000..6590991 --- /dev/null +++ b/lib/Phrase/models/styleguide_create.rb @@ -0,0 +1,315 @@ +require 'date' + +module Phrase + class StyleguideCreate + # Style guide title + attr_accessor :title + + # Audience description + attr_accessor :audience + + # Can be one of: not_specified, children, teenager, young_adults, adults, old_adults. + attr_accessor :target_audience + + # Can be one of: not_specified, first_person_singular, second_person_singular, third_person_singular_masculine, third_person_singular_feminine, third_person_singular_neuter, first_person_plural, second_person_plural, third_person_plural. + attr_accessor :grammatical_person + + # Can be one of: not_specified, popular, technical, fictional. + attr_accessor :vocabulary_type + + # Description of the business + attr_accessor :business + + # Company branding to remain consistent. + attr_accessor :company_branding + + # Formatting requirements and character limitations. + attr_accessor :formatting + + # List of terms and/or phrases that need to be translated consistently. + attr_accessor :glossary_terms + + # Formal or informal pronouns, consistent conjugation, grammatical gender + attr_accessor :grammar_consistency + + # Can be one of: Cultural/Conversational, Literal, Neutral. + attr_accessor :literal_translation + + # Tone requirement descriptions + attr_accessor :overall_tone + + # Provide links to sample product pages, FAQ pages, etc. to give the translator a point of reference. You can also provide past translations. Even snippets or short paragraphs are helpful for maintaining consistency. + attr_accessor :samples + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'title' => :'title', + :'audience' => :'audience', + :'target_audience' => :'target_audience', + :'grammatical_person' => :'grammatical_person', + :'vocabulary_type' => :'vocabulary_type', + :'business' => :'business', + :'company_branding' => :'company_branding', + :'formatting' => :'formatting', + :'glossary_terms' => :'glossary_terms', + :'grammar_consistency' => :'grammar_consistency', + :'literal_translation' => :'literal_translation', + :'overall_tone' => :'overall_tone', + :'samples' => :'samples' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'title' => :'String', + :'audience' => :'String', + :'target_audience' => :'String', + :'grammatical_person' => :'String', + :'vocabulary_type' => :'String', + :'business' => :'String', + :'company_branding' => :'String', + :'formatting' => :'String', + :'glossary_terms' => :'String', + :'grammar_consistency' => :'String', + :'literal_translation' => :'String', + :'overall_tone' => :'String', + :'samples' => :'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::StyleguideCreate` 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::StyleguideCreate`. 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?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'audience') + self.audience = attributes[:'audience'] + end + + if attributes.key?(:'target_audience') + self.target_audience = attributes[:'target_audience'] + end + + if attributes.key?(:'grammatical_person') + self.grammatical_person = attributes[:'grammatical_person'] + end + + if attributes.key?(:'vocabulary_type') + self.vocabulary_type = attributes[:'vocabulary_type'] + end + + if attributes.key?(:'business') + self.business = attributes[:'business'] + end + + if attributes.key?(:'company_branding') + self.company_branding = attributes[:'company_branding'] + end + + if attributes.key?(:'formatting') + self.formatting = attributes[:'formatting'] + end + + if attributes.key?(:'glossary_terms') + self.glossary_terms = attributes[:'glossary_terms'] + end + + if attributes.key?(:'grammar_consistency') + self.grammar_consistency = attributes[:'grammar_consistency'] + end + + if attributes.key?(:'literal_translation') + self.literal_translation = attributes[:'literal_translation'] + end + + if attributes.key?(:'overall_tone') + self.overall_tone = attributes[:'overall_tone'] + end + + if attributes.key?(:'samples') + self.samples = attributes[:'samples'] + 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 && + title == o.title && + audience == o.audience && + target_audience == o.target_audience && + grammatical_person == o.grammatical_person && + vocabulary_type == o.vocabulary_type && + business == o.business && + company_branding == o.company_branding && + formatting == o.formatting && + glossary_terms == o.glossary_terms && + grammar_consistency == o.grammar_consistency && + literal_translation == o.literal_translation && + overall_tone == o.overall_tone && + samples == o.samples + 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 + [title, audience, target_audience, grammatical_person, vocabulary_type, business, company_branding, formatting, glossary_terms, grammar_consistency, literal_translation, overall_tone, samples].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 :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/styleguide_preview.rb b/lib/Phrase/models/styleguide_preview.rb new file mode 100644 index 0000000..6bfe4fc --- /dev/null +++ b/lib/Phrase/models/styleguide_preview.rb @@ -0,0 +1,203 @@ +require 'date' + +module Phrase + class StyleguidePreview + attr_accessor :id + + attr_accessor :title + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'title' => :'title' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'title' => :'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::StyleguidePreview` 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::StyleguidePreview`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + 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 && + id == o.id && + title == o.title + 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 + [id, title].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 :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/styleguide_update.rb b/lib/Phrase/models/styleguide_update.rb new file mode 100644 index 0000000..1283c58 --- /dev/null +++ b/lib/Phrase/models/styleguide_update.rb @@ -0,0 +1,315 @@ +require 'date' + +module Phrase + class StyleguideUpdate + # Style guide title + attr_accessor :title + + # Audience description + attr_accessor :audience + + # Can be one of: not_specified, children, teenager, young_adults, adults, old_adults. + attr_accessor :target_audience + + # Can be one of: not_specified, first_person_singular, second_person_singular, third_person_singular_masculine, third_person_singular_feminine, third_person_singular_neuter, first_person_plural, second_person_plural, third_person_plural. + attr_accessor :grammatical_person + + # Can be one of: not_specified, popular, technical, fictional. + attr_accessor :vocabulary_type + + # Description of the business + attr_accessor :business + + # Company branding to remain consistent. + attr_accessor :company_branding + + # Formatting requirements and character limitations. + attr_accessor :formatting + + # List of terms and/or phrases that need to be translated consistently. + attr_accessor :glossary_terms + + # Formal or informal pronouns, consistent conjugation, grammatical gender + attr_accessor :grammar_consistency + + # Can be one of: Cultural/Conversational, Literal, Neutral. + attr_accessor :literal_translation + + # Tone requirement descriptions + attr_accessor :overall_tone + + # Provide links to sample product pages, FAQ pages, etc. to give the translator a point of reference. You can also provide past translations. Even snippets or short paragraphs are helpful for maintaining consistency. + attr_accessor :samples + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'title' => :'title', + :'audience' => :'audience', + :'target_audience' => :'target_audience', + :'grammatical_person' => :'grammatical_person', + :'vocabulary_type' => :'vocabulary_type', + :'business' => :'business', + :'company_branding' => :'company_branding', + :'formatting' => :'formatting', + :'glossary_terms' => :'glossary_terms', + :'grammar_consistency' => :'grammar_consistency', + :'literal_translation' => :'literal_translation', + :'overall_tone' => :'overall_tone', + :'samples' => :'samples' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'title' => :'String', + :'audience' => :'String', + :'target_audience' => :'String', + :'grammatical_person' => :'String', + :'vocabulary_type' => :'String', + :'business' => :'String', + :'company_branding' => :'String', + :'formatting' => :'String', + :'glossary_terms' => :'String', + :'grammar_consistency' => :'String', + :'literal_translation' => :'String', + :'overall_tone' => :'String', + :'samples' => :'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::StyleguideUpdate` 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::StyleguideUpdate`. 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?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'audience') + self.audience = attributes[:'audience'] + end + + if attributes.key?(:'target_audience') + self.target_audience = attributes[:'target_audience'] + end + + if attributes.key?(:'grammatical_person') + self.grammatical_person = attributes[:'grammatical_person'] + end + + if attributes.key?(:'vocabulary_type') + self.vocabulary_type = attributes[:'vocabulary_type'] + end + + if attributes.key?(:'business') + self.business = attributes[:'business'] + end + + if attributes.key?(:'company_branding') + self.company_branding = attributes[:'company_branding'] + end + + if attributes.key?(:'formatting') + self.formatting = attributes[:'formatting'] + end + + if attributes.key?(:'glossary_terms') + self.glossary_terms = attributes[:'glossary_terms'] + end + + if attributes.key?(:'grammar_consistency') + self.grammar_consistency = attributes[:'grammar_consistency'] + end + + if attributes.key?(:'literal_translation') + self.literal_translation = attributes[:'literal_translation'] + end + + if attributes.key?(:'overall_tone') + self.overall_tone = attributes[:'overall_tone'] + end + + if attributes.key?(:'samples') + self.samples = attributes[:'samples'] + 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 && + title == o.title && + audience == o.audience && + target_audience == o.target_audience && + grammatical_person == o.grammatical_person && + vocabulary_type == o.vocabulary_type && + business == o.business && + company_branding == o.company_branding && + formatting == o.formatting && + glossary_terms == o.glossary_terms && + grammar_consistency == o.grammar_consistency && + literal_translation == o.literal_translation && + overall_tone == o.overall_tone && + samples == o.samples + 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 + [title, audience, target_audience, grammatical_person, vocabulary_type, business, company_branding, formatting, glossary_terms, grammar_consistency, literal_translation, overall_tone, samples].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 :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/tag.rb b/lib/Phrase/models/tag.rb new file mode 100644 index 0000000..d6c2ed0 --- /dev/null +++ b/lib/Phrase/models/tag.rb @@ -0,0 +1,221 @@ +require 'date' + +module Phrase + class Tag + attr_accessor :name + + attr_accessor :keys_count + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'keys_count' => :'keys_count', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'keys_count' => :'Integer', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime' + } + 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::Tag` 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::Tag`. 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?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'keys_count') + self.keys_count = attributes[:'keys_count'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 && + name == o.name && + keys_count == o.keys_count && + created_at == o.created_at && + updated_at == o.updated_at + 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 + [name, keys_count, created_at, updated_at].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 :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/tag_create.rb b/lib/Phrase/models/tag_create.rb new file mode 100644 index 0000000..3bbb74d --- /dev/null +++ b/lib/Phrase/models/tag_create.rb @@ -0,0 +1,205 @@ +require 'date' + +module Phrase + class TagCreate + # specify the branch to use + attr_accessor :branch + + # Name of the tag + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'name' => :'name' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'name' => :'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::TagCreate` 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::TagCreate`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + 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 && + branch == o.branch && + name == o.name + 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 + [branch, name].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 :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/tag_delete.rb b/lib/Phrase/models/tag_delete.rb new file mode 100644 index 0000000..131bcec --- /dev/null +++ b/lib/Phrase/models/tag_delete.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class TagDelete + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::TagDelete` 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::TagDelete`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/tag_show.rb b/lib/Phrase/models/tag_show.rb new file mode 100644 index 0000000..7b0aab4 --- /dev/null +++ b/lib/Phrase/models/tag_show.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class TagShow + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::TagShow` 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::TagShow`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/tags_list.rb b/lib/Phrase/models/tags_list.rb new file mode 100644 index 0000000..2806c3f --- /dev/null +++ b/lib/Phrase/models/tags_list.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class TagsList + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::TagsList` 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::TagsList`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/translation.rb b/lib/Phrase/models/translation.rb new file mode 100644 index 0000000..c88a88d --- /dev/null +++ b/lib/Phrase/models/translation.rb @@ -0,0 +1,286 @@ +require 'date' + +module Phrase + class Translation + attr_accessor :id + + attr_accessor :content + + attr_accessor :unverified + + attr_accessor :excluded + + attr_accessor :plural_suffix + + attr_accessor :key + + attr_accessor :locale + + attr_accessor :placeholders + + attr_accessor :state + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'content' => :'content', + :'unverified' => :'unverified', + :'excluded' => :'excluded', + :'plural_suffix' => :'plural_suffix', + :'key' => :'key', + :'locale' => :'locale', + :'placeholders' => :'placeholders', + :'state' => :'state', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'content' => :'String', + :'unverified' => :'Boolean', + :'excluded' => :'Boolean', + :'plural_suffix' => :'String', + :'key' => :'KeyPreview', + :'locale' => :'Object', + :'placeholders' => :'Array', + :'state' => :'String', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime' + } + 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::Translation` 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::Translation`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'content') + self.content = attributes[:'content'] + end + + if attributes.key?(:'unverified') + self.unverified = attributes[:'unverified'] + end + + if attributes.key?(:'excluded') + self.excluded = attributes[:'excluded'] + end + + if attributes.key?(:'plural_suffix') + self.plural_suffix = attributes[:'plural_suffix'] + end + + if attributes.key?(:'key') + self.key = attributes[:'key'] + end + + if attributes.key?(:'locale') + self.locale = attributes[:'locale'] + end + + if attributes.key?(:'placeholders') + if (value = attributes[:'placeholders']).is_a?(Array) + self.placeholders = value + end + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 && + id == o.id && + content == o.content && + unverified == o.unverified && + excluded == o.excluded && + plural_suffix == o.plural_suffix && + key == o.key && + locale == o.locale && + placeholders == o.placeholders && + state == o.state && + created_at == o.created_at && + updated_at == o.updated_at + 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 + [id, content, unverified, excluded, plural_suffix, key, locale, placeholders, state, created_at, updated_at].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 :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/translation_create.rb b/lib/Phrase/models/translation_create.rb new file mode 100644 index 0000000..a270407 --- /dev/null +++ b/lib/Phrase/models/translation_create.rb @@ -0,0 +1,265 @@ +require 'date' + +module Phrase + class TranslationCreate + # specify the branch to use + attr_accessor :branch + + # Locale. Can be the name or public id of the locale. Preferred is the public id. + attr_accessor :locale_id + + # Key + attr_accessor :key_id + + # Translation content + attr_accessor :content + + # Plural suffix. Can be one of: zero, one, two, few, many, other. Must be specified if the key associated to the translation is pluralized. + attr_accessor :plural_suffix + + # Indicates whether translation is unverified. Part of the Advanced Workflows feature. + attr_accessor :unverified + + # Indicates whether translation is excluded. + attr_accessor :excluded + + # Indicates whether the translation should be auto-translated. Responses with status 422 if provided for translation within a non-default locale or the project does not have the Autopilot feature enabled. + attr_accessor :autotranslate + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'locale_id' => :'locale_id', + :'key_id' => :'key_id', + :'content' => :'content', + :'plural_suffix' => :'plural_suffix', + :'unverified' => :'unverified', + :'excluded' => :'excluded', + :'autotranslate' => :'autotranslate' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'locale_id' => :'String', + :'key_id' => :'String', + :'content' => :'String', + :'plural_suffix' => :'String', + :'unverified' => :'String', + :'excluded' => :'String', + :'autotranslate' => :'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::TranslationCreate` 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::TranslationCreate`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'locale_id') + self.locale_id = attributes[:'locale_id'] + end + + if attributes.key?(:'key_id') + self.key_id = attributes[:'key_id'] + end + + if attributes.key?(:'content') + self.content = attributes[:'content'] + end + + if attributes.key?(:'plural_suffix') + self.plural_suffix = attributes[:'plural_suffix'] + end + + if attributes.key?(:'unverified') + self.unverified = attributes[:'unverified'] + end + + if attributes.key?(:'excluded') + self.excluded = attributes[:'excluded'] + end + + if attributes.key?(:'autotranslate') + self.autotranslate = attributes[:'autotranslate'] + 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 && + branch == o.branch && + locale_id == o.locale_id && + key_id == o.key_id && + content == o.content && + plural_suffix == o.plural_suffix && + unverified == o.unverified && + excluded == o.excluded && + autotranslate == o.autotranslate + 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 + [branch, locale_id, key_id, content, plural_suffix, unverified, excluded, autotranslate].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 :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/translation_exclude.rb b/lib/Phrase/models/translation_exclude.rb new file mode 100644 index 0000000..99d7de8 --- /dev/null +++ b/lib/Phrase/models/translation_exclude.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class TranslationExclude + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::TranslationExclude` 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::TranslationExclude`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/translation_include.rb b/lib/Phrase/models/translation_include.rb new file mode 100644 index 0000000..2780844 --- /dev/null +++ b/lib/Phrase/models/translation_include.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class TranslationInclude + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::TranslationInclude` 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::TranslationInclude`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/translation_key.rb b/lib/Phrase/models/translation_key.rb new file mode 100644 index 0000000..1c944a1 --- /dev/null +++ b/lib/Phrase/models/translation_key.rb @@ -0,0 +1,268 @@ +require 'date' + +module Phrase + class TranslationKey + attr_accessor :id + + attr_accessor :name + + attr_accessor :description + + attr_accessor :name_hash + + attr_accessor :plural + + attr_accessor :tags + + attr_accessor :data_type + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'description' => :'description', + :'name_hash' => :'name_hash', + :'plural' => :'plural', + :'tags' => :'tags', + :'data_type' => :'data_type', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'description' => :'String', + :'name_hash' => :'String', + :'plural' => :'Boolean', + :'tags' => :'Array', + :'data_type' => :'String', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime' + } + 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::TranslationKey` 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::TranslationKey`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'name_hash') + self.name_hash = attributes[:'name_hash'] + end + + if attributes.key?(:'plural') + self.plural = attributes[:'plural'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'data_type') + self.data_type = attributes[:'data_type'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 && + id == o.id && + name == o.name && + description == o.description && + name_hash == o.name_hash && + plural == o.plural && + tags == o.tags && + data_type == o.data_type && + created_at == o.created_at && + updated_at == o.updated_at + 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 + [id, name, description, name_hash, plural, tags, data_type, created_at, updated_at].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 :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/translation_order.rb b/lib/Phrase/models/translation_order.rb new file mode 100644 index 0000000..bad90eb --- /dev/null +++ b/lib/Phrase/models/translation_order.rb @@ -0,0 +1,340 @@ +require 'date' + +module Phrase + class TranslationOrder + attr_accessor :id + + attr_accessor :lsp + + attr_accessor :amount_in_cents + + attr_accessor :currency + + attr_accessor :message + + attr_accessor :state + + attr_accessor :translation_type + + attr_accessor :progress_percent + + attr_accessor :source_locale + + attr_accessor :target_locales + + attr_accessor :tag + + attr_accessor :styleguide + + attr_accessor :unverify_translations_upon_delivery + + attr_accessor :quality + + attr_accessor :priority + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'lsp' => :'lsp', + :'amount_in_cents' => :'amount_in_cents', + :'currency' => :'currency', + :'message' => :'message', + :'state' => :'state', + :'translation_type' => :'translation_type', + :'progress_percent' => :'progress_percent', + :'source_locale' => :'source_locale', + :'target_locales' => :'target_locales', + :'tag' => :'tag', + :'styleguide' => :'styleguide', + :'unverify_translations_upon_delivery' => :'unverify_translations_upon_delivery', + :'quality' => :'quality', + :'priority' => :'priority', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'lsp' => :'String', + :'amount_in_cents' => :'Integer', + :'currency' => :'String', + :'message' => :'String', + :'state' => :'String', + :'translation_type' => :'String', + :'progress_percent' => :'Integer', + :'source_locale' => :'LocalePreview', + :'target_locales' => :'Array', + :'tag' => :'String', + :'styleguide' => :'StyleguidePreview', + :'unverify_translations_upon_delivery' => :'Boolean', + :'quality' => :'Boolean', + :'priority' => :'Boolean', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime' + } + 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::TranslationOrder` 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::TranslationOrder`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'lsp') + self.lsp = attributes[:'lsp'] + end + + if attributes.key?(:'amount_in_cents') + self.amount_in_cents = attributes[:'amount_in_cents'] + end + + if attributes.key?(:'currency') + self.currency = attributes[:'currency'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'translation_type') + self.translation_type = attributes[:'translation_type'] + end + + if attributes.key?(:'progress_percent') + self.progress_percent = attributes[:'progress_percent'] + end + + if attributes.key?(:'source_locale') + self.source_locale = attributes[:'source_locale'] + end + + if attributes.key?(:'target_locales') + if (value = attributes[:'target_locales']).is_a?(Array) + self.target_locales = value + end + end + + if attributes.key?(:'tag') + self.tag = attributes[:'tag'] + end + + if attributes.key?(:'styleguide') + self.styleguide = attributes[:'styleguide'] + end + + if attributes.key?(:'unverify_translations_upon_delivery') + self.unverify_translations_upon_delivery = attributes[:'unverify_translations_upon_delivery'] + end + + if attributes.key?(:'quality') + self.quality = attributes[:'quality'] + end + + if attributes.key?(:'priority') + self.priority = attributes[:'priority'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 && + id == o.id && + lsp == o.lsp && + amount_in_cents == o.amount_in_cents && + currency == o.currency && + message == o.message && + state == o.state && + translation_type == o.translation_type && + progress_percent == o.progress_percent && + source_locale == o.source_locale && + target_locales == o.target_locales && + tag == o.tag && + styleguide == o.styleguide && + unverify_translations_upon_delivery == o.unverify_translations_upon_delivery && + quality == o.quality && + priority == o.priority && + created_at == o.created_at && + updated_at == o.updated_at + 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 + [id, lsp, amount_in_cents, currency, message, state, translation_type, progress_percent, source_locale, target_locales, tag, styleguide, unverify_translations_upon_delivery, quality, priority, created_at, updated_at].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 :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/translation_review.rb b/lib/Phrase/models/translation_review.rb new file mode 100644 index 0000000..1dd83fd --- /dev/null +++ b/lib/Phrase/models/translation_review.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class TranslationReview + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::TranslationReview` 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::TranslationReview`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/translation_show.rb b/lib/Phrase/models/translation_show.rb new file mode 100644 index 0000000..2f060dd --- /dev/null +++ b/lib/Phrase/models/translation_show.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class TranslationShow + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::TranslationShow` 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::TranslationShow`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/translation_unverify.rb b/lib/Phrase/models/translation_unverify.rb new file mode 100644 index 0000000..50080dc --- /dev/null +++ b/lib/Phrase/models/translation_unverify.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class TranslationUnverify + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::TranslationUnverify` 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::TranslationUnverify`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/translation_update.rb b/lib/Phrase/models/translation_update.rb new file mode 100644 index 0000000..79f994a --- /dev/null +++ b/lib/Phrase/models/translation_update.rb @@ -0,0 +1,245 @@ +require 'date' + +module Phrase + class TranslationUpdate + # specify the branch to use + attr_accessor :branch + + # Translation content + attr_accessor :content + + # Plural suffix. Can be one of: zero, one, two, few, many, other. Must be specified if the key associated to the translation is pluralized. + attr_accessor :plural_suffix + + # Indicates whether translation is unverified. Part of the Advanced Workflows feature. + attr_accessor :unverified + + # Indicates whether translation is excluded. + attr_accessor :excluded + + # Indicates whether the translation should be auto-translated. Responses with status 422 if provided for translation within a non-default locale or the project does not have the Autopilot feature enabled. + attr_accessor :autotranslate + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'content' => :'content', + :'plural_suffix' => :'plural_suffix', + :'unverified' => :'unverified', + :'excluded' => :'excluded', + :'autotranslate' => :'autotranslate' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'content' => :'String', + :'plural_suffix' => :'String', + :'unverified' => :'String', + :'excluded' => :'String', + :'autotranslate' => :'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::TranslationUpdate` 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::TranslationUpdate`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'content') + self.content = attributes[:'content'] + end + + if attributes.key?(:'plural_suffix') + self.plural_suffix = attributes[:'plural_suffix'] + end + + if attributes.key?(:'unverified') + self.unverified = attributes[:'unverified'] + end + + if attributes.key?(:'excluded') + self.excluded = attributes[:'excluded'] + end + + if attributes.key?(:'autotranslate') + self.autotranslate = attributes[:'autotranslate'] + 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 && + branch == o.branch && + content == o.content && + plural_suffix == o.plural_suffix && + unverified == o.unverified && + excluded == o.excluded && + autotranslate == o.autotranslate + 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 + [branch, content, plural_suffix, unverified, excluded, autotranslate].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 :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/translation_verify.rb b/lib/Phrase/models/translation_verify.rb new file mode 100644 index 0000000..a741824 --- /dev/null +++ b/lib/Phrase/models/translation_verify.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class TranslationVerify + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::TranslationVerify` 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::TranslationVerify`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/translation_version.rb b/lib/Phrase/models/translation_version.rb new file mode 100644 index 0000000..5e7cde8 --- /dev/null +++ b/lib/Phrase/models/translation_version.rb @@ -0,0 +1,257 @@ +require 'date' + +module Phrase + class TranslationVersion + attr_accessor :id + + attr_accessor :content + + attr_accessor :plural_suffix + + attr_accessor :key + + attr_accessor :locale + + attr_accessor :created_at + + attr_accessor :updated_at + + attr_accessor :changed_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'content' => :'content', + :'plural_suffix' => :'plural_suffix', + :'key' => :'key', + :'locale' => :'locale', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'changed_at' => :'changed_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'content' => :'String', + :'plural_suffix' => :'String', + :'key' => :'Object', + :'locale' => :'Object', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime', + :'changed_at' => :'DateTime' + } + 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::TranslationVersion` 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::TranslationVersion`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'content') + self.content = attributes[:'content'] + end + + if attributes.key?(:'plural_suffix') + self.plural_suffix = attributes[:'plural_suffix'] + end + + if attributes.key?(:'key') + self.key = attributes[:'key'] + end + + if attributes.key?(:'locale') + self.locale = attributes[:'locale'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'changed_at') + self.changed_at = attributes[:'changed_at'] + 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 && + id == o.id && + content == o.content && + plural_suffix == o.plural_suffix && + key == o.key && + locale == o.locale && + created_at == o.created_at && + updated_at == o.updated_at && + changed_at == o.changed_at + 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 + [id, content, plural_suffix, key, locale, created_at, updated_at, changed_at].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 :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/translations_by_key.rb b/lib/Phrase/models/translations_by_key.rb new file mode 100644 index 0000000..a2b8b41 --- /dev/null +++ b/lib/Phrase/models/translations_by_key.rb @@ -0,0 +1,225 @@ +require 'date' + +module Phrase + class TranslationsByKey + # specify the branch to use + attr_accessor :branch + + # Sort criteria. Can be one of: key_name, created_at, updated_at. + attr_accessor :sort + + # Order direction. Can be one of: asc, desc. + attr_accessor :order + + # q_description_placeholder + attr_accessor :q + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'sort' => :'sort', + :'order' => :'order', + :'q' => :'q' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'sort' => :'String', + :'order' => :'String', + :'q' => :'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::TranslationsByKey` 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::TranslationsByKey`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'q') + self.q = attributes[:'q'] + 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 && + branch == o.branch && + sort == o.sort && + order == o.order && + q == o.q + 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 + [branch, sort, order, q].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 :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/translations_by_locale.rb b/lib/Phrase/models/translations_by_locale.rb new file mode 100644 index 0000000..ad678b9 --- /dev/null +++ b/lib/Phrase/models/translations_by_locale.rb @@ -0,0 +1,225 @@ +require 'date' + +module Phrase + class TranslationsByLocale + # specify the branch to use + attr_accessor :branch + + # Sort criteria. Can be one of: key_name, created_at, updated_at. + attr_accessor :sort + + # Order direction. Can be one of: asc, desc. + attr_accessor :order + + # q_description_placeholder + attr_accessor :q + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'sort' => :'sort', + :'order' => :'order', + :'q' => :'q' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'sort' => :'String', + :'order' => :'String', + :'q' => :'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::TranslationsByLocale` 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::TranslationsByLocale`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'q') + self.q = attributes[:'q'] + 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 && + branch == o.branch && + sort == o.sort && + order == o.order && + q == o.q + 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 + [branch, sort, order, q].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 :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/translations_exclude.rb b/lib/Phrase/models/translations_exclude.rb new file mode 100644 index 0000000..f84aecb --- /dev/null +++ b/lib/Phrase/models/translations_exclude.rb @@ -0,0 +1,225 @@ +require 'date' + +module Phrase + class TranslationsExclude + # specify the branch to use + attr_accessor :branch + + # q_description_placeholder + attr_accessor :q + + # Sort criteria. Can be one of: key_name, created_at, updated_at. + attr_accessor :sort + + # Order direction. Can be one of: asc, desc. + attr_accessor :order + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'q' => :'q', + :'sort' => :'sort', + :'order' => :'order' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'q' => :'String', + :'sort' => :'String', + :'order' => :'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::TranslationsExclude` 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::TranslationsExclude`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'q') + self.q = attributes[:'q'] + end + + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + 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 && + branch == o.branch && + q == o.q && + sort == o.sort && + order == o.order + 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 + [branch, q, sort, order].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 :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/translations_include.rb b/lib/Phrase/models/translations_include.rb new file mode 100644 index 0000000..11d9426 --- /dev/null +++ b/lib/Phrase/models/translations_include.rb @@ -0,0 +1,225 @@ +require 'date' + +module Phrase + class TranslationsInclude + # specify the branch to use + attr_accessor :branch + + # q_description_placeholder + attr_accessor :q + + # Sort criteria. Can be one of: key_name, created_at, updated_at. + attr_accessor :sort + + # Order direction. Can be one of: asc, desc. + attr_accessor :order + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'q' => :'q', + :'sort' => :'sort', + :'order' => :'order' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'q' => :'String', + :'sort' => :'String', + :'order' => :'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::TranslationsInclude` 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::TranslationsInclude`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'q') + self.q = attributes[:'q'] + end + + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + 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 && + branch == o.branch && + q == o.q && + sort == o.sort && + order == o.order + 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 + [branch, q, sort, order].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 :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/translations_list.rb b/lib/Phrase/models/translations_list.rb new file mode 100644 index 0000000..8aa6bea --- /dev/null +++ b/lib/Phrase/models/translations_list.rb @@ -0,0 +1,225 @@ +require 'date' + +module Phrase + class TranslationsList + # specify the branch to use + attr_accessor :branch + + # Sort criteria. Can be one of: key_name, created_at, updated_at. + attr_accessor :sort + + # Order direction. Can be one of: asc, desc. + attr_accessor :order + + # q_description_placeholder + attr_accessor :q + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'sort' => :'sort', + :'order' => :'order', + :'q' => :'q' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'sort' => :'String', + :'order' => :'String', + :'q' => :'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::TranslationsList` 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::TranslationsList`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'q') + self.q = attributes[:'q'] + 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 && + branch == o.branch && + sort == o.sort && + order == o.order && + q == o.q + 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 + [branch, sort, order, q].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 :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/translations_review.rb b/lib/Phrase/models/translations_review.rb new file mode 100644 index 0000000..a1a31dc --- /dev/null +++ b/lib/Phrase/models/translations_review.rb @@ -0,0 +1,205 @@ +require 'date' + +module Phrase + class TranslationsReview + # specify the branch to use + attr_accessor :branch + + # q_description_placeholder + attr_accessor :q + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'q' => :'q' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'q' => :'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::TranslationsReview` 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::TranslationsReview`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'q') + self.q = attributes[:'q'] + 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 && + branch == o.branch && + q == o.q + 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 + [branch, q].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 :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/translations_search.rb b/lib/Phrase/models/translations_search.rb new file mode 100644 index 0000000..dc1dd6e --- /dev/null +++ b/lib/Phrase/models/translations_search.rb @@ -0,0 +1,225 @@ +require 'date' + +module Phrase + class TranslationsSearch + # specify the branch to use + attr_accessor :branch + + # Sort criteria. Can be one of: key_name, created_at, updated_at. + attr_accessor :sort + + # Order direction. Can be one of: asc, desc. + attr_accessor :order + + # q_description_placeholder + attr_accessor :q + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'sort' => :'sort', + :'order' => :'order', + :'q' => :'q' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'sort' => :'String', + :'order' => :'String', + :'q' => :'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::TranslationsSearch` 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::TranslationsSearch`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + end + + if attributes.key?(:'q') + self.q = attributes[:'q'] + 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 && + branch == o.branch && + sort == o.sort && + order == o.order && + q == o.q + 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 + [branch, sort, order, q].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 :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/translations_unverify.rb b/lib/Phrase/models/translations_unverify.rb new file mode 100644 index 0000000..fb2fc5e --- /dev/null +++ b/lib/Phrase/models/translations_unverify.rb @@ -0,0 +1,225 @@ +require 'date' + +module Phrase + class TranslationsUnverify + # specify the branch to use + attr_accessor :branch + + # q_description_placeholder + attr_accessor :q + + # Sort criteria. Can be one of: key_name, created_at, updated_at. + attr_accessor :sort + + # Order direction. Can be one of: asc, desc. + attr_accessor :order + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'q' => :'q', + :'sort' => :'sort', + :'order' => :'order' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'q' => :'String', + :'sort' => :'String', + :'order' => :'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::TranslationsUnverify` 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::TranslationsUnverify`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'q') + self.q = attributes[:'q'] + end + + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + 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 && + branch == o.branch && + q == o.q && + sort == o.sort && + order == o.order + 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 + [branch, q, sort, order].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 :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/translations_verify.rb b/lib/Phrase/models/translations_verify.rb new file mode 100644 index 0000000..307648c --- /dev/null +++ b/lib/Phrase/models/translations_verify.rb @@ -0,0 +1,225 @@ +require 'date' + +module Phrase + class TranslationsVerify + # specify the branch to use + attr_accessor :branch + + # q_description_placeholder + attr_accessor :q + + # Sort criteria. Can be one of: key_name, created_at, updated_at. + attr_accessor :sort + + # Order direction. Can be one of: asc, desc. + attr_accessor :order + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'q' => :'q', + :'sort' => :'sort', + :'order' => :'order' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'q' => :'String', + :'sort' => :'String', + :'order' => :'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::TranslationsVerify` 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::TranslationsVerify`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'q') + self.q = attributes[:'q'] + end + + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + 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 && + branch == o.branch && + q == o.q && + sort == o.sort && + order == o.order + 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 + [branch, q, sort, order].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 :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/upload.rb b/lib/Phrase/models/upload.rb new file mode 100644 index 0000000..edd81db --- /dev/null +++ b/lib/Phrase/models/upload.rb @@ -0,0 +1,257 @@ +require 'date' + +module Phrase + class Upload + attr_accessor :id + + attr_accessor :filename + + attr_accessor :format + + attr_accessor :state + + attr_accessor :tag + + attr_accessor :summary + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'filename' => :'filename', + :'format' => :'format', + :'state' => :'state', + :'tag' => :'tag', + :'summary' => :'summary', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'filename' => :'String', + :'format' => :'String', + :'state' => :'String', + :'tag' => :'String', + :'summary' => :'UploadSummary', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime' + } + 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::Upload` 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::Upload`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'filename') + self.filename = attributes[:'filename'] + end + + if attributes.key?(:'format') + self.format = attributes[:'format'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'tag') + self.tag = attributes[:'tag'] + end + + if attributes.key?(:'summary') + self.summary = attributes[:'summary'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 && + id == o.id && + filename == o.filename && + format == o.format && + state == o.state && + tag == o.tag && + summary == o.summary && + created_at == o.created_at && + updated_at == o.updated_at + 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 + [id, filename, format, state, tag, summary, created_at, updated_at].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 :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/upload_create.rb b/lib/Phrase/models/upload_create.rb new file mode 100644 index 0000000..98cf63d --- /dev/null +++ b/lib/Phrase/models/upload_create.rb @@ -0,0 +1,335 @@ +require 'date' + +module Phrase + class UploadCreate + # specify the branch to use + attr_accessor :branch + + # File to be imported + attr_accessor :file + + # File format. Auto-detected when possible and not specified. + attr_accessor :file_format + + # Locale of the file's content. Can be the name or public id of the locale. Preferred is the public id. + attr_accessor :locale_id + + # List of tags separated by comma to be associated with the new keys contained in the upload. + attr_accessor :tags + + # Indicates whether existing translations should be updated with the file content. + attr_accessor :update_translations + + # Existing key descriptions will be updated with the file content. Empty descriptions overwrite existing descriptions. + attr_accessor :update_descriptions + + # This option is obsolete. Providing the option will cause a bad request error. + attr_accessor :convert_emoji + + # Indicates whether the upload should not create upload tags. + attr_accessor :skip_upload_tags + + # Indicates whether the upload should unverify updated translations. + attr_accessor :skip_unverification + + # Enforces a specific encoding on the file contents. Valid options are \"UTF-8\", \"UTF-16\" and \"ISO-8859-1\". + attr_accessor :file_encoding + + # Optional, format specific mapping between locale names and the columns the translations to those locales are contained in. + attr_accessor :locale_mapping + + # Additional options available for specific formats. See our format guide for complete list. + attr_accessor :format_options + + # If set, translations for the uploaded language will be fetched automatically. + attr_accessor :autotranslate + + # Indicated whether the imported translations should be marked as reviewed. This setting is available if the review workflow (currently beta) is enabled for the project. + attr_accessor :mark_reviewed + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch', + :'file' => :'file', + :'file_format' => :'file_format', + :'locale_id' => :'locale_id', + :'tags' => :'tags', + :'update_translations' => :'update_translations', + :'update_descriptions' => :'update_descriptions', + :'convert_emoji' => :'convert_emoji', + :'skip_upload_tags' => :'skip_upload_tags', + :'skip_unverification' => :'skip_unverification', + :'file_encoding' => :'file_encoding', + :'locale_mapping' => :'locale_mapping', + :'format_options' => :'format_options', + :'autotranslate' => :'autotranslate', + :'mark_reviewed' => :'mark_reviewed' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'String', + :'file' => :'String', + :'file_format' => :'String', + :'locale_id' => :'String', + :'tags' => :'String', + :'update_translations' => :'String', + :'update_descriptions' => :'String', + :'convert_emoji' => :'String', + :'skip_upload_tags' => :'String', + :'skip_unverification' => :'String', + :'file_encoding' => :'String', + :'locale_mapping' => :'String', + :'format_options' => :'String', + :'autotranslate' => :'String', + :'mark_reviewed' => :'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::UploadCreate` 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::UploadCreate`. 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'file') + self.file = attributes[:'file'] + end + + if attributes.key?(:'file_format') + self.file_format = attributes[:'file_format'] + end + + if attributes.key?(:'locale_id') + self.locale_id = attributes[:'locale_id'] + end + + if attributes.key?(:'tags') + self.tags = attributes[:'tags'] + end + + if attributes.key?(:'update_translations') + self.update_translations = attributes[:'update_translations'] + end + + if attributes.key?(:'update_descriptions') + self.update_descriptions = attributes[:'update_descriptions'] + end + + if attributes.key?(:'convert_emoji') + self.convert_emoji = attributes[:'convert_emoji'] + end + + if attributes.key?(:'skip_upload_tags') + self.skip_upload_tags = attributes[:'skip_upload_tags'] + end + + if attributes.key?(:'skip_unverification') + self.skip_unverification = attributes[:'skip_unverification'] + end + + if attributes.key?(:'file_encoding') + self.file_encoding = attributes[:'file_encoding'] + end + + if attributes.key?(:'locale_mapping') + self.locale_mapping = attributes[:'locale_mapping'] + end + + if attributes.key?(:'format_options') + self.format_options = attributes[:'format_options'] + end + + if attributes.key?(:'autotranslate') + self.autotranslate = attributes[:'autotranslate'] + end + + if attributes.key?(:'mark_reviewed') + self.mark_reviewed = attributes[:'mark_reviewed'] + 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 && + branch == o.branch && + file == o.file && + file_format == o.file_format && + locale_id == o.locale_id && + tags == o.tags && + update_translations == o.update_translations && + update_descriptions == o.update_descriptions && + convert_emoji == o.convert_emoji && + skip_upload_tags == o.skip_upload_tags && + skip_unverification == o.skip_unverification && + file_encoding == o.file_encoding && + locale_mapping == o.locale_mapping && + format_options == o.format_options && + autotranslate == o.autotranslate && + mark_reviewed == o.mark_reviewed + 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 + [branch, file, file_format, locale_id, tags, update_translations, update_descriptions, convert_emoji, skip_upload_tags, skip_unverification, file_encoding, locale_mapping, format_options, autotranslate, mark_reviewed].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 :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/upload_show.rb b/lib/Phrase/models/upload_show.rb new file mode 100644 index 0000000..8754bf6 --- /dev/null +++ b/lib/Phrase/models/upload_show.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class UploadShow + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::UploadShow` 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::UploadShow`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/upload_summary.rb b/lib/Phrase/models/upload_summary.rb new file mode 100644 index 0000000..167e75e --- /dev/null +++ b/lib/Phrase/models/upload_summary.rb @@ -0,0 +1,257 @@ +require 'date' + +module Phrase + class UploadSummary + attr_accessor :locales_created + + attr_accessor :translation_keys_created + + attr_accessor :translation_keys_updated + + attr_accessor :translation_keys_unmentioned + + attr_accessor :translations_created + + attr_accessor :translations_updated + + attr_accessor :tags_created + + attr_accessor :translation_keys_ignored + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'locales_created' => :'locales_created', + :'translation_keys_created' => :'translation_keys_created', + :'translation_keys_updated' => :'translation_keys_updated', + :'translation_keys_unmentioned' => :'translation_keys_unmentioned', + :'translations_created' => :'translations_created', + :'translations_updated' => :'translations_updated', + :'tags_created' => :'tags_created', + :'translation_keys_ignored' => :'translation_keys_ignored' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'locales_created' => :'Integer', + :'translation_keys_created' => :'Integer', + :'translation_keys_updated' => :'Integer', + :'translation_keys_unmentioned' => :'Integer', + :'translations_created' => :'Integer', + :'translations_updated' => :'Integer', + :'tags_created' => :'Integer', + :'translation_keys_ignored' => :'Integer' + } + 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::UploadSummary` 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::UploadSummary`. 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?(:'locales_created') + self.locales_created = attributes[:'locales_created'] + end + + if attributes.key?(:'translation_keys_created') + self.translation_keys_created = attributes[:'translation_keys_created'] + end + + if attributes.key?(:'translation_keys_updated') + self.translation_keys_updated = attributes[:'translation_keys_updated'] + end + + if attributes.key?(:'translation_keys_unmentioned') + self.translation_keys_unmentioned = attributes[:'translation_keys_unmentioned'] + end + + if attributes.key?(:'translations_created') + self.translations_created = attributes[:'translations_created'] + end + + if attributes.key?(:'translations_updated') + self.translations_updated = attributes[:'translations_updated'] + end + + if attributes.key?(:'tags_created') + self.tags_created = attributes[:'tags_created'] + end + + if attributes.key?(:'translation_keys_ignored') + self.translation_keys_ignored = attributes[:'translation_keys_ignored'] + 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 && + locales_created == o.locales_created && + translation_keys_created == o.translation_keys_created && + translation_keys_updated == o.translation_keys_updated && + translation_keys_unmentioned == o.translation_keys_unmentioned && + translations_created == o.translations_created && + translations_updated == o.translations_updated && + tags_created == o.tags_created && + translation_keys_ignored == o.translation_keys_ignored + 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 + [locales_created, translation_keys_created, translation_keys_updated, translation_keys_unmentioned, translations_created, translations_updated, tags_created, translation_keys_ignored].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 :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/uploads_list.rb b/lib/Phrase/models/uploads_list.rb new file mode 100644 index 0000000..30e1e8e --- /dev/null +++ b/lib/Phrase/models/uploads_list.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class UploadsList + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::UploadsList` 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::UploadsList`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/user.rb b/lib/Phrase/models/user.rb new file mode 100644 index 0000000..b197f3b --- /dev/null +++ b/lib/Phrase/models/user.rb @@ -0,0 +1,248 @@ +require 'date' + +module Phrase + class User + attr_accessor :id + + attr_accessor :username + + attr_accessor :name + + attr_accessor :email + + attr_accessor :position + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'username' => :'username', + :'name' => :'name', + :'email' => :'email', + :'position' => :'position', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'username' => :'String', + :'name' => :'String', + :'email' => :'String', + :'position' => :'String', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime' + } + 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::User` 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::User`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'username') + self.username = attributes[:'username'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'position') + self.position = attributes[:'position'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 && + id == o.id && + username == o.username && + name == o.name && + email == o.email && + position == o.position && + created_at == o.created_at && + updated_at == o.updated_at + 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 + [id, username, name, email, position, created_at, updated_at].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 :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/user_preview.rb b/lib/Phrase/models/user_preview.rb new file mode 100644 index 0000000..1d5cb53 --- /dev/null +++ b/lib/Phrase/models/user_preview.rb @@ -0,0 +1,212 @@ +require 'date' + +module Phrase + class UserPreview + attr_accessor :id + + attr_accessor :username + + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'username' => :'username', + :'name' => :'name' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'username' => :'String', + :'name' => :'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::UserPreview` 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::UserPreview`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'username') + self.username = attributes[:'username'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + 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 && + id == o.id && + username == o.username && + name == o.name + 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 + [id, username, name].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 :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/version_show.rb b/lib/Phrase/models/version_show.rb new file mode 100644 index 0000000..38c9dd0 --- /dev/null +++ b/lib/Phrase/models/version_show.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class VersionShow + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::VersionShow` 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::VersionShow`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/versions_list.rb b/lib/Phrase/models/versions_list.rb new file mode 100644 index 0000000..2f61507 --- /dev/null +++ b/lib/Phrase/models/versions_list.rb @@ -0,0 +1,195 @@ +require 'date' + +module Phrase + class VersionsList + # specify the branch to use + attr_accessor :branch + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'branch' => :'branch' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'branch' => :'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::VersionsList` 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::VersionsList`. 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?(:'branch') + self.branch = attributes[:'branch'] + 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 && + branch == o.branch + 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 + [branch].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 :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/webhook.rb b/lib/Phrase/models/webhook.rb new file mode 100644 index 0000000..6748569 --- /dev/null +++ b/lib/Phrase/models/webhook.rb @@ -0,0 +1,250 @@ +require 'date' + +module Phrase + class Webhook + attr_accessor :id + + attr_accessor :callback_url + + attr_accessor :description + + attr_accessor :events + + attr_accessor :active + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'callback_url' => :'callback_url', + :'description' => :'description', + :'events' => :'events', + :'active' => :'active', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'callback_url' => :'String', + :'description' => :'String', + :'events' => :'Array', + :'active' => :'Boolean', + :'created_at' => :'DateTime', + :'updated_at' => :'DateTime' + } + 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::Webhook` 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::Webhook`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'callback_url') + self.callback_url = attributes[:'callback_url'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'events') + if (value = attributes[:'events']).is_a?(Array) + self.events = value + end + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 && + id == o.id && + callback_url == o.callback_url && + description == o.description && + events == o.events && + active == o.active && + created_at == o.created_at && + updated_at == o.updated_at + 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 + [id, callback_url, description, events, active, created_at, updated_at].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 :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/webhook_create.rb b/lib/Phrase/models/webhook_create.rb new file mode 100644 index 0000000..4b381ae --- /dev/null +++ b/lib/Phrase/models/webhook_create.rb @@ -0,0 +1,225 @@ +require 'date' + +module Phrase + class WebhookCreate + # Callback URL to send requests to + attr_accessor :callback_url + + # Webhook description + attr_accessor :description + + # List of event names to trigger the webhook (separated by comma) + attr_accessor :events + + # Whether webhook is active or inactive + attr_accessor :active + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'callback_url' => :'callback_url', + :'description' => :'description', + :'events' => :'events', + :'active' => :'active' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'callback_url' => :'String', + :'description' => :'String', + :'events' => :'String', + :'active' => :'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::WebhookCreate` 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::WebhookCreate`. 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?(:'callback_url') + self.callback_url = attributes[:'callback_url'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'events') + self.events = attributes[:'events'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + 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 && + callback_url == o.callback_url && + description == o.description && + events == o.events && + active == o.active + 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 + [callback_url, description, events, active].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 :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/webhook_update.rb b/lib/Phrase/models/webhook_update.rb new file mode 100644 index 0000000..4eda401 --- /dev/null +++ b/lib/Phrase/models/webhook_update.rb @@ -0,0 +1,225 @@ +require 'date' + +module Phrase + class WebhookUpdate + # Callback URL to send requests to + attr_accessor :callback_url + + # Webhook description + attr_accessor :description + + # List of event names to trigger the webhook (separated by comma) + attr_accessor :events + + # Whether webhook is active or inactive + attr_accessor :active + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'callback_url' => :'callback_url', + :'description' => :'description', + :'events' => :'events', + :'active' => :'active' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'callback_url' => :'String', + :'description' => :'String', + :'events' => :'String', + :'active' => :'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::WebhookUpdate` 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::WebhookUpdate`. 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?(:'callback_url') + self.callback_url = attributes[:'callback_url'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'events') + self.events = attributes[:'events'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + 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 && + callback_url == o.callback_url && + description == o.description && + events == o.events && + active == o.active + 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 + [callback_url, description, events, active].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 :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/version.rb b/lib/Phrase/version.rb new file mode 100644 index 0000000..4ed169b --- /dev/null +++ b/lib/Phrase/version.rb @@ -0,0 +1,3 @@ +module Phrase + VERSION = '1.0.0' +end diff --git a/spec/api/accounts_api_spec.rb b/spec/api/accounts_api_spec.rb new file mode 100644 index 0000000..22bc89f --- /dev/null +++ b/spec/api/accounts_api_spec.rb @@ -0,0 +1,50 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::AccountsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'AccountsApi' do + before do + # run before each test + @api_instance = Phrase::AccountsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of AccountsApi' do + it 'should create an instance of AccountsApi' do + expect(@api_instance).to be_instance_of(Phrase::AccountsApi) + end + end + + # unit tests for account_show + # Get a single account + # Get details on a single account. + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Account] + describe 'account_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for accounts_list + # List accounts + # List all accounts the current user has access to. + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'accounts_list 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/api/authorizations_api_spec.rb b/spec/api/authorizations_api_spec.rb new file mode 100644 index 0000000..2602a60 --- /dev/null +++ b/spec/api/authorizations_api_spec.rb @@ -0,0 +1,90 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::AuthorizationsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'AuthorizationsApi' do + before do + # run before each test + @api_instance = Phrase::AuthorizationsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of AuthorizationsApi' do + it 'should create an instance of AuthorizationsApi' do + expect(@api_instance).to be_instance_of(Phrase::AuthorizationsApi) + end + end + + # unit tests for authorization_create + # Create an authorization + # Create a new authorization. + # @param authorization_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'authorization_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for authorization_delete + # Delete an authorization + # Delete an existing authorization. API calls using that token will stop working. + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'authorization_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for authorization_show + # Get a single authorization + # Get details on a single authorization. + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Authorization] + describe 'authorization_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for authorization_update + # Update an authorization + # Update an existing authorization. + # @param id ID + # @param authorization_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'authorization_update test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for authorizations_list + # List authorizations + # List all your authorizations. + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'authorizations_list 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/api/bitbucket_sync_api_spec.rb b/spec/api/bitbucket_sync_api_spec.rb new file mode 100644 index 0000000..b98ef60 --- /dev/null +++ b/spec/api/bitbucket_sync_api_spec.rb @@ -0,0 +1,64 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::BitbucketSyncApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BitbucketSyncApi' do + before do + # run before each test + @api_instance = Phrase::BitbucketSyncApi.new + end + + after do + # run after each test + end + + describe 'test an instance of BitbucketSyncApi' do + it 'should create an instance of BitbucketSyncApi' do + expect(@api_instance).to be_instance_of(Phrase::BitbucketSyncApi) + end + end + + # unit tests for bitbucket_sync_export + # Export from Phrase to Bitbucket + # Export translations from Phrase to Bitbucket according to the .phraseapp.yml file within the Bitbucket Repository. + # @param id ID + # @param bitbucket_sync_export + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [BitbucketSyncExportResponse] + describe 'bitbucket_sync_export test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for bitbucket_sync_import + # Import to Phrase from Bitbucket + # Import translations from Bitbucket to Phrase according to the .phraseapp.yml file within the Bitbucket repository. + # @param id ID + # @param bitbucket_sync_import + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'bitbucket_sync_import test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for bitbucket_syncs_list + # List Bitbucket syncs + # List all Bitbucket repositories for which synchronisation with Phrase is activated. + # @param bitbucket_syncs_list + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array] + describe 'bitbucket_syncs_list 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/api/blacklisted_keys_api_spec.rb b/spec/api/blacklisted_keys_api_spec.rb new file mode 100644 index 0000000..61bf6a0 --- /dev/null +++ b/spec/api/blacklisted_keys_api_spec.rb @@ -0,0 +1,95 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::BlacklistedKeysApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BlacklistedKeysApi' do + before do + # run before each test + @api_instance = Phrase::BlacklistedKeysApi.new + end + + after do + # run after each test + end + + describe 'test an instance of BlacklistedKeysApi' do + it 'should create an instance of BlacklistedKeysApi' do + expect(@api_instance).to be_instance_of(Phrase::BlacklistedKeysApi) + end + end + + # unit tests for blacklisted_key_create + # Create a blacklisted key + # Create a new rule for blacklisting keys. + # @param project_id Project ID + # @param blacklisted_key_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'blacklisted_key_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for blacklisted_key_delete + # Delete a blacklisted key + # Delete an existing rule for blacklisting keys. + # @param project_id Project ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'blacklisted_key_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for blacklisted_key_show + # Get a single blacklisted key + # Get details on a single rule for blacklisting keys for a given project. + # @param project_id Project ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [BlacklistedKey] + describe 'blacklisted_key_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for blacklisted_key_update + # Update a blacklisted key + # Update an existing rule for blacklisting keys. + # @param project_id Project ID + # @param id ID + # @param blacklisted_key_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'blacklisted_key_update test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for blacklisted_keys_list + # List blacklisted keys + # List all rules for blacklisting keys for the given project. + # @param project_id Project ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'blacklisted_keys_list 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/api/branches_api_spec.rb b/spec/api/branches_api_spec.rb new file mode 100644 index 0000000..2bca846 --- /dev/null +++ b/spec/api/branches_api_spec.rb @@ -0,0 +1,125 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::BranchesApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BranchesApi' do + before do + # run before each test + @api_instance = Phrase::BranchesApi.new + end + + after do + # run after each test + end + + describe 'test an instance of BranchesApi' do + it 'should create an instance of BranchesApi' do + expect(@api_instance).to be_instance_of(Phrase::BranchesApi) + end + end + + # unit tests for branch_compare + # Compare branches + # Compare branch with main branch. + # @param project_id Project ID + # @param name name + # @param branch_compare + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'branch_compare test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for branch_create + # Create a branch + # Create a new branch. + # @param project_id Project ID + # @param branch_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'branch_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for branch_delete + # Delete a branch + # Delete an existing branch. + # @param project_id Project ID + # @param name name + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'branch_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for branch_merge + # Merge a branch + # Merge an existing branch. + # @param project_id Project ID + # @param name name + # @param branch_merge + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'branch_merge test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for branch_show + # Get a single branch + # Get details on a single branch for a given project. + # @param project_id Project ID + # @param name name + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Branch] + describe 'branch_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for branch_update + # Update a branch + # Update an existing branch. + # @param project_id Project ID + # @param name name + # @param branch_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'branch_update test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for branches_list + # List branches + # List all branches the of the current project. + # @param project_id Project ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'branches_list 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/api/comments_api_spec.rb b/spec/api/comments_api_spec.rb new file mode 100644 index 0000000..1e5b333 --- /dev/null +++ b/spec/api/comments_api_spec.rb @@ -0,0 +1,151 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::CommentsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'CommentsApi' do + before do + # run before each test + @api_instance = Phrase::CommentsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of CommentsApi' do + it 'should create an instance of CommentsApi' do + expect(@api_instance).to be_instance_of(Phrase::CommentsApi) + end + end + + # unit tests for comment_create + # Create a comment + # Create a new comment for a key. + # @param project_id Project ID + # @param key_id Translation Key ID + # @param comment_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'comment_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for comment_delete + # Delete a comment + # Delete an existing comment. + # @param project_id Project ID + # @param key_id Translation Key ID + # @param id ID + # @param comment_delete + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'comment_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for comment_mark_check + # Check if comment is read + # Check if comment was marked as read. Returns 204 if read, 404 if unread. + # @param project_id Project ID + # @param key_id Translation Key ID + # @param id ID + # @param comment_mark_check + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'comment_mark_check test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for comment_mark_read + # Mark a comment as read + # Mark a comment as read. + # @param project_id Project ID + # @param key_id Translation Key ID + # @param id ID + # @param comment_mark_read + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'comment_mark_read test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for comment_mark_unread + # Mark a comment as unread + # Mark a comment as unread. + # @param project_id Project ID + # @param key_id Translation Key ID + # @param id ID + # @param comment_mark_unread + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'comment_mark_unread test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for comment_show + # Get a single comment + # Get details on a single comment. + # @param project_id Project ID + # @param key_id Translation Key ID + # @param id ID + # @param comment_show + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Comment] + describe 'comment_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for comment_update + # Update a comment + # Update an existing comment. + # @param project_id Project ID + # @param key_id Translation Key ID + # @param id ID + # @param comment_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'comment_update test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for comments_list + # List comments + # List all comments for a key. + # @param project_id Project ID + # @param key_id Translation Key ID + # @param comments_list + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'comments_list 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/api/distributions_api_spec.rb b/spec/api/distributions_api_spec.rb new file mode 100644 index 0000000..9475c2d --- /dev/null +++ b/spec/api/distributions_api_spec.rb @@ -0,0 +1,95 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::DistributionsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'DistributionsApi' do + before do + # run before each test + @api_instance = Phrase::DistributionsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of DistributionsApi' do + it 'should create an instance of DistributionsApi' do + expect(@api_instance).to be_instance_of(Phrase::DistributionsApi) + end + end + + # unit tests for distribution_create + # Create a distribution + # Create a new distribution. + # @param account_id Account ID + # @param distribution_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'distribution_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for distribution_delete + # Delete a distribution + # Delete an existing distribution. + # @param account_id Account ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'distribution_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for distribution_show + # Get a single distribution + # Get details on a single distribution. + # @param account_id Account ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Distribution] + describe 'distribution_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for distribution_update + # Update a distribution + # Update an existing distribution. + # @param account_id Account ID + # @param id ID + # @param distribution_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'distribution_update test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for distributions_list + # List distributions + # List all distributions for the given account. + # @param account_id Account ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'distributions_list 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/api/formats_api_spec.rb b/spec/api/formats_api_spec.rb new file mode 100644 index 0000000..e339cf4 --- /dev/null +++ b/spec/api/formats_api_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::FormatsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'FormatsApi' do + before do + # run before each test + @api_instance = Phrase::FormatsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of FormatsApi' do + it 'should create an instance of FormatsApi' do + expect(@api_instance).to be_instance_of(Phrase::FormatsApi) + end + end + + # unit tests for formats_list + # List formats + # Get a handy list of all localization file formats supported in Phrase. + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array] + describe 'formats_list 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/api/git_lab_sync_api_spec.rb b/spec/api/git_lab_sync_api_spec.rb new file mode 100644 index 0000000..592ca75 --- /dev/null +++ b/spec/api/git_lab_sync_api_spec.rb @@ -0,0 +1,122 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::GitLabSyncApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GitLabSyncApi' do + before do + # run before each test + @api_instance = Phrase::GitLabSyncApi.new + end + + after do + # run after each test + end + + describe 'test an instance of GitLabSyncApi' do + it 'should create an instance of GitLabSyncApi' do + expect(@api_instance).to be_instance_of(Phrase::GitLabSyncApi) + end + end + + # unit tests for gitlab_sync_delete + # Delete single Sync Setting + # Deletes a single GitLab Sync Setting. + # @param id ID + # @param gitlab_sync_delete + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'gitlab_sync_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for gitlab_sync_export + # Export from Phrase to GitLab + # Export translations from Phrase to GitLab according to the .phraseapp.yml file within the GitLab repository. + # @param gitlab_sync_id Gitlab Sync ID + # @param gitlab_sync_export + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [GitlabSyncExport1] + describe 'gitlab_sync_export test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for gitlab_sync_history + # History of single Sync Setting + # List history for a single Sync Setting. + # @param gitlab_sync_id Gitlab Sync ID + # @param gitlab_sync_history + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'gitlab_sync_history test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for gitlab_sync_import + # Import from GitLab to Phrase + # Import translations from GitLab to Phrase according to the .phraseapp.yml file within the GitLab repository. + # @param gitlab_sync_id Gitlab Sync ID + # @param gitlab_sync_import + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array] + describe 'gitlab_sync_import test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for gitlab_sync_list + # List GitLab syncs + # List all GitLab Sync Settings for which synchronisation with Phrase and GitLab is activated. + # @param gitlab_sync_list + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array] + describe 'gitlab_sync_list test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for gitlab_sync_show + # Get single Sync Setting + # Shows a single GitLab Sync Setting. + # @param id ID + # @param gitlab_sync_show + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [GitlabSync] + describe 'gitlab_sync_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for gitlab_sync_update + # Update single Sync Setting + # Updates a single GitLab Sync Setting. + # @param id ID + # @param gitlab_sync_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'gitlab_sync_update 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/api/glossary_api_spec.rb b/spec/api/glossary_api_spec.rb new file mode 100644 index 0000000..6a136fe --- /dev/null +++ b/spec/api/glossary_api_spec.rb @@ -0,0 +1,95 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::GlossaryApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GlossaryApi' do + before do + # run before each test + @api_instance = Phrase::GlossaryApi.new + end + + after do + # run after each test + end + + describe 'test an instance of GlossaryApi' do + it 'should create an instance of GlossaryApi' do + expect(@api_instance).to be_instance_of(Phrase::GlossaryApi) + end + end + + # unit tests for glossaries_list + # List glossaries + # List all glossaries the current user has access to. + # @param account_id Account ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'glossaries_list test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for glossary_create + # Create a glossary + # Create a new glossary. + # @param account_id Account ID + # @param glossary_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'glossary_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for glossary_delete + # Delete a glossary + # Delete an existing glossary. + # @param account_id Account ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'glossary_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for glossary_show + # Get a single glossary + # Get details on a single glossary. + # @param account_id Account ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Glossary] + describe 'glossary_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for glossary_update + # Update a glossary + # Update an existing glossary. + # @param account_id Account ID + # @param id ID + # @param glossary_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'glossary_update 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/api/glossary_term_translations_api_spec.rb b/spec/api/glossary_term_translations_api_spec.rb new file mode 100644 index 0000000..405ed36 --- /dev/null +++ b/spec/api/glossary_term_translations_api_spec.rb @@ -0,0 +1,72 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::GlossaryTermTranslationsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GlossaryTermTranslationsApi' do + before do + # run before each test + @api_instance = Phrase::GlossaryTermTranslationsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of GlossaryTermTranslationsApi' do + it 'should create an instance of GlossaryTermTranslationsApi' do + expect(@api_instance).to be_instance_of(Phrase::GlossaryTermTranslationsApi) + end + end + + # unit tests for glossary_term_translation_create + # Create a glossary term translation + # Create a new glossary term translation. + # @param account_id Account ID + # @param glossary_id Glossary ID + # @param term_id Term ID + # @param glossary_term_translation_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'glossary_term_translation_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for glossary_term_translation_delete + # Delete a glossary term translation + # Delete an existing glossary term translation. + # @param account_id Account ID + # @param glossary_id Glossary ID + # @param term_id Term ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'glossary_term_translation_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for glossary_term_translation_update + # Update a glossary term translation + # Update an existing glossary term translation. + # @param account_id Account ID + # @param glossary_id Glossary ID + # @param term_id Term ID + # @param id ID + # @param glossary_term_translation_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [GlossaryTermTranslation] + describe 'glossary_term_translation_update 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/api/glossary_terms_api_spec.rb b/spec/api/glossary_terms_api_spec.rb new file mode 100644 index 0000000..05c7950 --- /dev/null +++ b/spec/api/glossary_terms_api_spec.rb @@ -0,0 +1,100 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::GlossaryTermsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GlossaryTermsApi' do + before do + # run before each test + @api_instance = Phrase::GlossaryTermsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of GlossaryTermsApi' do + it 'should create an instance of GlossaryTermsApi' do + expect(@api_instance).to be_instance_of(Phrase::GlossaryTermsApi) + end + end + + # unit tests for glossary_term_create + # Create a glossary term + # Create a new glossary term. + # @param account_id Account ID + # @param glossary_id Glossary ID + # @param glossary_term_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'glossary_term_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for glossary_term_delete + # Delete a glossary term + # Delete an existing glossary term. + # @param account_id Account ID + # @param glossary_id Glossary ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'glossary_term_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for glossary_term_show + # Get a single glossary term + # Get details on a single glossary term. + # @param account_id Account ID + # @param glossary_id Glossary ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [GlossaryTerm] + describe 'glossary_term_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for glossary_term_update + # Update a glossary term + # Update an existing glossary term. + # @param account_id Account ID + # @param glossary_id Glossary ID + # @param id ID + # @param glossary_term_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'glossary_term_update test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for glossary_terms_list + # List glossary terms + # List all glossary terms the current user has access to. + # @param account_id Account ID + # @param glossary_id Glossary ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'glossary_terms_list 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/api/invitations_api_spec.rb b/spec/api/invitations_api_spec.rb new file mode 100644 index 0000000..fe4394a --- /dev/null +++ b/spec/api/invitations_api_spec.rb @@ -0,0 +1,109 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::InvitationsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'InvitationsApi' do + before do + # run before each test + @api_instance = Phrase::InvitationsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of InvitationsApi' do + it 'should create an instance of InvitationsApi' do + expect(@api_instance).to be_instance_of(Phrase::InvitationsApi) + end + end + + # unit tests for invitation_create + # Create a new invitation + # Invite a person to an account. Developers and translators need <code>project_ids</code> and <code>locale_ids</code> assigned to access them. Access token scope must include <code>team.manage</code>. + # @param account_id Account ID + # @param invitation_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'invitation_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for invitation_delete + # Delete an invitation + # Delete an existing invitation (must not be accepted yet). Access token scope must include <code>team.manage</code>. + # @param account_id Account ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'invitation_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for invitation_resend + # Resend an invitation + # Resend the invitation email (must not be accepted yet). Access token scope must include <code>team.manage</code>. + # @param account_id Account ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'invitation_resend test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for invitation_show + # Get a single invitation + # Get details on a single invitation. Access token scope must include <code>team.manage</code>. + # @param account_id Account ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Invitation] + describe 'invitation_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for invitation_update + # Update an invitation + # Update an existing invitation (must not be accepted yet). The <code>email</code> cannot be updated. Developers and translators need <code>project_ids</code> and <code>locale_ids</code> assigned to access them. Access token scope must include <code>team.manage</code>. + # @param account_id Account ID + # @param id ID + # @param invitation_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'invitation_update test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for invitations_list + # List invitations + # List invitations for an account. It will also list the accessible resources like projects and locales the invited user has access to. In case nothing is shown the default access from the role is used. Access token scope must include <code>team.manage</code>. + # @param account_id Account ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'invitations_list 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/api/job_locales_api_spec.rb b/spec/api/job_locales_api_spec.rb new file mode 100644 index 0000000..fa7053c --- /dev/null +++ b/spec/api/job_locales_api_spec.rb @@ -0,0 +1,135 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::JobLocalesApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'JobLocalesApi' do + before do + # run before each test + @api_instance = Phrase::JobLocalesApi.new + end + + after do + # run after each test + end + + describe 'test an instance of JobLocalesApi' do + it 'should create an instance of JobLocalesApi' do + expect(@api_instance).to be_instance_of(Phrase::JobLocalesApi) + end + end + + # unit tests for job_locale_complete + # Complete a job locale + # Mark a job locale as completed. + # @param project_id Project ID + # @param job_id Job ID + # @param id ID + # @param job_locale_complete + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'job_locale_complete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for job_locale_delete + # Delete a job locale + # Delete an existing job locale. + # @param project_id Project ID + # @param job_id Job ID + # @param id ID + # @param job_locale_delete + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'job_locale_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for job_locale_reopen + # Reopen a job locale + # Mark a job locale as uncompleted. + # @param project_id Project ID + # @param job_id Job ID + # @param id ID + # @param job_locale_reopen + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'job_locale_reopen test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for job_locale_show + # Get a single job locale + # Get a single job locale for a given job. + # @param project_id Project ID + # @param job_id Job ID + # @param id ID + # @param job_locale_show + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [JobLocale] + describe 'job_locale_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for job_locale_update + # Update a job locale + # Update an existing job locale. + # @param project_id Project ID + # @param job_id Job ID + # @param id ID + # @param job_locale_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'job_locale_update test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for job_locales_create + # Create a job locale + # Create a new job locale. + # @param project_id Project ID + # @param job_id Job ID + # @param job_locales_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'job_locales_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for job_locales_list + # List job locales + # List all job locales for a given job. + # @param project_id Project ID + # @param job_id Job ID + # @param job_locales_list + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'job_locales_list 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/api/jobs_api_spec.rb b/spec/api/jobs_api_spec.rb new file mode 100644 index 0000000..6816e30 --- /dev/null +++ b/spec/api/jobs_api_spec.rb @@ -0,0 +1,173 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::JobsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'JobsApi' do + before do + # run before each test + @api_instance = Phrase::JobsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of JobsApi' do + it 'should create an instance of JobsApi' do + expect(@api_instance).to be_instance_of(Phrase::JobsApi) + end + end + + # unit tests for job_complete + # Complete a job + # Mark a job as completed. + # @param project_id Project ID + # @param id ID + # @param job_complete + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'job_complete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for job_create + # Create a job + # Create a new job. + # @param project_id Project ID + # @param job_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'job_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for job_delete + # Delete a job + # Delete an existing job. + # @param project_id Project ID + # @param id ID + # @param job_delete + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'job_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for job_keys_create + # Add keys to job + # Add multiple keys to a existing job. + # @param project_id Project ID + # @param id ID + # @param job_keys_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'job_keys_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for job_keys_delete + # Remove keys from job + # Remove multiple keys from existing job. + # @param project_id Project ID + # @param id ID + # @param job_keys_delete + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'job_keys_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for job_reopen + # Reopen a job + # Mark a job as uncompleted. + # @param project_id Project ID + # @param id ID + # @param job_reopen + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'job_reopen test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for job_show + # Get a single job + # Get details on a single job for a given project. + # @param project_id Project ID + # @param id ID + # @param job_show + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'job_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for job_start + # Start a job + # Starts an existing job in state draft. + # @param project_id Project ID + # @param id ID + # @param job_start + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'job_start test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for job_update + # Update a job + # Update an existing job. + # @param project_id Project ID + # @param id ID + # @param job_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'job_update test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for jobs_list + # List jobs + # List all jobs for the given project. + # @param project_id Project ID + # @param jobs_list + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'jobs_list 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/api/keys_api_spec.rb b/spec/api/keys_api_spec.rb new file mode 100644 index 0000000..9ac5b29 --- /dev/null +++ b/spec/api/keys_api_spec.rb @@ -0,0 +1,156 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::KeysApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'KeysApi' do + before do + # run before each test + @api_instance = Phrase::KeysApi.new + end + + after do + # run after each test + end + + describe 'test an instance of KeysApi' do + it 'should create an instance of KeysApi' do + expect(@api_instance).to be_instance_of(Phrase::KeysApi) + end + end + + # unit tests for key_create + # Create a key + # Create a new key. + # @param project_id Project ID + # @param key_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'key_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for key_delete + # Delete a key + # Delete an existing key. + # @param project_id Project ID + # @param id ID + # @param key_delete + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'key_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for key_show + # Get a single key + # Get details on a single key for a given project. + # @param project_id Project ID + # @param id ID + # @param key_show + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'key_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for key_update + # Update a key + # Update an existing key. + # @param project_id Project ID + # @param id ID + # @param key_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'key_update test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for keys_delete + # Delete collection of keys + # Delete all keys matching query. Same constraints as list. Please limit the number of affected keys to about 1,000 as you might experience timeouts otherwise. + # @param project_id Project ID + # @param keys_delete + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [AffectedResources] + describe 'keys_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for keys_list + # List keys + # List all keys for the given project. Alternatively you can POST requests to /search. + # @param project_id Project ID + # @param keys_list + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'keys_list test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for keys_search + # Search keys + # Search keys for the given project matching query. + # @param project_id Project ID + # @param keys_search + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'keys_search test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for keys_tag + # Add tags to collection of keys + # Tags all keys matching query. Same constraints as list. + # @param project_id Project ID + # @param keys_tag + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'keys_tag test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for keys_untag + # Remove tags from collection of keys + # Removes specified tags from keys matching query. + # @param project_id Project ID + # @param keys_untag + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'keys_untag 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/api/locales_api_spec.rb b/spec/api/locales_api_spec.rb new file mode 100644 index 0000000..9d4cce1 --- /dev/null +++ b/spec/api/locales_api_spec.rb @@ -0,0 +1,113 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::LocalesApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'LocalesApi' do + before do + # run before each test + @api_instance = Phrase::LocalesApi.new + end + + after do + # run after each test + end + + describe 'test an instance of LocalesApi' do + it 'should create an instance of LocalesApi' do + expect(@api_instance).to be_instance_of(Phrase::LocalesApi) + end + end + + # unit tests for locale_create + # Create a locale + # Create a new locale. + # @param project_id Project ID + # @param locale_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'locale_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for locale_delete + # Delete a locale + # Delete an existing locale. + # @param project_id Project ID + # @param id ID + # @param locale_delete + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'locale_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for locale_download + # Download a locale + # Download a locale in a specific file format. + # @param project_id Project ID + # @param id ID + # @param locale_download + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'locale_download test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for locale_show + # Get a single locale + # Get details on a single locale for a given project. + # @param project_id Project ID + # @param id ID + # @param locale_show + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'locale_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for locale_update + # Update a locale + # Update an existing locale. + # @param project_id Project ID + # @param id ID + # @param locale_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'locale_update test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for locales_list + # List locales + # List all locales for the given project. + # @param project_id Project ID + # @param locales_list + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'locales_list 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/api/members_api_spec.rb b/spec/api/members_api_spec.rb new file mode 100644 index 0000000..8975dcd --- /dev/null +++ b/spec/api/members_api_spec.rb @@ -0,0 +1,81 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::MembersApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'MembersApi' do + before do + # run before each test + @api_instance = Phrase::MembersApi.new + end + + after do + # run after each test + end + + describe 'test an instance of MembersApi' do + it 'should create an instance of MembersApi' do + expect(@api_instance).to be_instance_of(Phrase::MembersApi) + end + end + + # unit tests for member_delete + # Remove a user from the account + # Remove a user from the account. The user will be removed from the account but not deleted from Phrase. Access token scope must include <code>team.manage</code>. + # @param account_id Account ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'member_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for member_show + # Get single member + # Get details on a single user in the account. Access token scope must include <code>team.manage</code>. + # @param account_id Account ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Member] + describe 'member_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for member_update + # Update a member + # Update user permissions in the account. Developers and translators need <code>project_ids</code> and <code>locale_ids</code> assigned to access them. Access token scope must include <code>team.manage</code>. + # @param account_id Account ID + # @param id ID + # @param member_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'member_update test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for members_list + # List members + # Get all users active in the account. It also lists resources like projects and locales the member has access to. In case nothing is shown the default access from the role is used. Access token scope must include <code>team.manage</code>. + # @param account_id Account ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'members_list 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/api/orders_api_spec.rb b/spec/api/orders_api_spec.rb new file mode 100644 index 0000000..f332e9a --- /dev/null +++ b/spec/api/orders_api_spec.rb @@ -0,0 +1,98 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::OrdersApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'OrdersApi' do + before do + # run before each test + @api_instance = Phrase::OrdersApi.new + end + + after do + # run after each test + end + + describe 'test an instance of OrdersApi' do + it 'should create an instance of OrdersApi' do + expect(@api_instance).to be_instance_of(Phrase::OrdersApi) + end + end + + # unit tests for order_confirm + # Confirm an order + # Confirm an existing order and send it to the provider for translation. Same constraints as for create. + # @param project_id Project ID + # @param id ID + # @param order_confirm + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'order_confirm test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for order_create + # Create a new order + # Create a new order. Access token scope must include <code>orders.create</code>. + # @param project_id Project ID + # @param order_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'order_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for order_delete + # Cancel an order + # Cancel an existing order. Must not yet be confirmed. + # @param project_id Project ID + # @param id ID + # @param order_delete + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'order_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for order_show + # Get a single order + # Get details on a single order. + # @param project_id Project ID + # @param id ID + # @param order_show + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [TranslationOrder] + describe 'order_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for orders_list + # List orders + # List all orders for the given project. + # @param project_id Project ID + # @param orders_list + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'orders_list 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/api/projects_api_spec.rb b/spec/api/projects_api_spec.rb new file mode 100644 index 0000000..b356094 --- /dev/null +++ b/spec/api/projects_api_spec.rb @@ -0,0 +1,90 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::ProjectsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ProjectsApi' do + before do + # run before each test + @api_instance = Phrase::ProjectsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of ProjectsApi' do + it 'should create an instance of ProjectsApi' do + expect(@api_instance).to be_instance_of(Phrase::ProjectsApi) + end + end + + # unit tests for project_create + # Create a project + # Create a new project. + # @param project_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'project_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for project_delete + # Delete a project + # Delete an existing project. + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'project_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for project_show + # Get a single project + # Get details on a single project. + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Project] + describe 'project_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for project_update + # Update a project + # Update an existing project. + # @param id ID + # @param project_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'project_update test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for projects_list + # List projects + # List all projects the current user has access to. + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'projects_list 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/api/releases_api_spec.rb b/spec/api/releases_api_spec.rb new file mode 100644 index 0000000..2842fab --- /dev/null +++ b/spec/api/releases_api_spec.rb @@ -0,0 +1,115 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::ReleasesApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ReleasesApi' do + before do + # run before each test + @api_instance = Phrase::ReleasesApi.new + end + + after do + # run after each test + end + + describe 'test an instance of ReleasesApi' do + it 'should create an instance of ReleasesApi' do + expect(@api_instance).to be_instance_of(Phrase::ReleasesApi) + end + end + + # unit tests for release_create + # Create a release + # Create a new release. + # @param account_id Account ID + # @param distribution_id Distribution ID + # @param release_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'release_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for release_delete + # Delete a release + # Delete an existing release. + # @param account_id Account ID + # @param distribution_id Distribution ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'release_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for release_publish + # Publish a release + # Publish a release for production. + # @param account_id Account ID + # @param distribution_id Distribution ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'release_publish test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for release_show + # Get a single release + # Get details on a single release. + # @param account_id Account ID + # @param distribution_id Distribution ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Release] + describe 'release_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for release_update + # Update a release + # Update an existing release. + # @param account_id Account ID + # @param distribution_id Distribution ID + # @param id ID + # @param release_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'release_update test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for releases_list + # List releases + # List all releases for the given distribution. + # @param account_id Account ID + # @param distribution_id Distribution ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'releases_list 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/api/screenshot_markers_api_spec.rb b/spec/api/screenshot_markers_api_spec.rb new file mode 100644 index 0000000..9279a80 --- /dev/null +++ b/spec/api/screenshot_markers_api_spec.rb @@ -0,0 +1,98 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::ScreenshotMarkersApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ScreenshotMarkersApi' do + before do + # run before each test + @api_instance = Phrase::ScreenshotMarkersApi.new + end + + after do + # run after each test + end + + describe 'test an instance of ScreenshotMarkersApi' do + it 'should create an instance of ScreenshotMarkersApi' do + expect(@api_instance).to be_instance_of(Phrase::ScreenshotMarkersApi) + end + end + + # unit tests for screenshot_marker_create + # Create a screenshot marker + # Create a new screenshot marker. + # @param project_id Project ID + # @param screenshot_id Screenshot ID + # @param screenshot_marker_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'screenshot_marker_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for screenshot_marker_delete + # Delete a screenshot marker + # Delete an existing screenshot marker. + # @param project_id Project ID + # @param screenshot_id Screenshot ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'screenshot_marker_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for screenshot_marker_show + # Get a single screenshot marker + # Get details on a single screenshot marker for a given project. + # @param project_id Project ID + # @param screenshot_id Screenshot ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'screenshot_marker_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for screenshot_marker_update + # Update a screenshot marker + # Update an existing screenshot marker. + # @param project_id Project ID + # @param screenshot_id Screenshot ID + # @param screenshot_marker_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [ScreenshotMarker] + describe 'screenshot_marker_update test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for screenshot_markers_list + # List screenshot markers + # List all screenshot markers for the given project. + # @param project_id Project ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'screenshot_markers_list 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/api/screenshots_api_spec.rb b/spec/api/screenshots_api_spec.rb new file mode 100644 index 0000000..3f91354 --- /dev/null +++ b/spec/api/screenshots_api_spec.rb @@ -0,0 +1,95 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::ScreenshotsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ScreenshotsApi' do + before do + # run before each test + @api_instance = Phrase::ScreenshotsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of ScreenshotsApi' do + it 'should create an instance of ScreenshotsApi' do + expect(@api_instance).to be_instance_of(Phrase::ScreenshotsApi) + end + end + + # unit tests for screenshot_create + # Create a screenshot + # Create a new screenshot. + # @param project_id Project ID + # @param screenshot_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'screenshot_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for screenshot_delete + # Delete a screenshot + # Delete an existing screenshot. + # @param project_id Project ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'screenshot_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for screenshot_show + # Get a single screenshot + # Get details on a single screenshot for a given project. + # @param project_id Project ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Screenshot] + describe 'screenshot_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for screenshot_update + # Update a screenshot + # Update an existing screenshot. + # @param project_id Project ID + # @param id ID + # @param screenshot_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'screenshot_update test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for screenshots_list + # List screenshots + # List all screenshots for the given project. + # @param project_id Project ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'screenshots_list 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/api/spaces_api_spec.rb b/spec/api/spaces_api_spec.rb new file mode 100644 index 0000000..2281ede --- /dev/null +++ b/spec/api/spaces_api_spec.rb @@ -0,0 +1,141 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::SpacesApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'SpacesApi' do + before do + # run before each test + @api_instance = Phrase::SpacesApi.new + end + + after do + # run after each test + end + + describe 'test an instance of SpacesApi' do + it 'should create an instance of SpacesApi' do + expect(@api_instance).to be_instance_of(Phrase::SpacesApi) + end + end + + # unit tests for space_create + # Create a Space + # Create a new Space. + # @param account_id Account ID + # @param space_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'space_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for space_delete + # Delete Space + # Delete the specified Space. + # @param account_id Account ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'space_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for space_show + # Get Space + # Show the specified Space. + # @param account_id Account ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Space] + describe 'space_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for space_update + # Update Space + # Update the specified Space. + # @param account_id Account ID + # @param id ID + # @param space_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Space] + describe 'space_update test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for spaces_list + # List Spaces + # List all Spaces for the given account. + # @param account_id Account ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'spaces_list test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for spaces_projects_create + # Add Project + # Adds an existing project to the space. + # @param account_id Account ID + # @param space_id Space ID + # @param spaces_projects_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'spaces_projects_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for spaces_projects_delete + # Remove Project + # Removes a specified project from the specified space. + # @param account_id Account ID + # @param space_id Space ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'spaces_projects_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for spaces_projects_list + # List Projects + # List all projects for the specified Space. + # @param account_id Account ID + # @param space_id Space ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'spaces_projects_list 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/api/style_guides_api_spec.rb b/spec/api/style_guides_api_spec.rb new file mode 100644 index 0000000..bd0e25e --- /dev/null +++ b/spec/api/style_guides_api_spec.rb @@ -0,0 +1,95 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::StyleGuidesApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'StyleGuidesApi' do + before do + # run before each test + @api_instance = Phrase::StyleGuidesApi.new + end + + after do + # run after each test + end + + describe 'test an instance of StyleGuidesApi' do + it 'should create an instance of StyleGuidesApi' do + expect(@api_instance).to be_instance_of(Phrase::StyleGuidesApi) + end + end + + # unit tests for styleguide_create + # Create a style guide + # Create a new style guide. + # @param project_id Project ID + # @param styleguide_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'styleguide_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for styleguide_delete + # Delete a style guide + # Delete an existing style guide. + # @param project_id Project ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'styleguide_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for styleguide_show + # Get a single style guide + # Get details on a single style guide. + # @param project_id Project ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'styleguide_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for styleguide_update + # Update a style guide + # Update an existing style guide. + # @param project_id Project ID + # @param id ID + # @param styleguide_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'styleguide_update test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for styleguides_list + # List style guides + # List all styleguides for the given project. + # @param project_id Project ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'styleguides_list 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/api/tags_api_spec.rb b/spec/api/tags_api_spec.rb new file mode 100644 index 0000000..f42316b --- /dev/null +++ b/spec/api/tags_api_spec.rb @@ -0,0 +1,83 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::TagsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TagsApi' do + before do + # run before each test + @api_instance = Phrase::TagsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of TagsApi' do + it 'should create an instance of TagsApi' do + expect(@api_instance).to be_instance_of(Phrase::TagsApi) + end + end + + # unit tests for tag_create + # Create a tag + # Create a new tag. + # @param project_id Project ID + # @param tag_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'tag_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for tag_delete + # Delete a tag + # Delete an existing tag. + # @param project_id Project ID + # @param name name + # @param tag_delete + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'tag_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for tag_show + # Get a single tag + # Get details and progress information on a single tag for a given project. + # @param project_id Project ID + # @param name name + # @param tag_show + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'tag_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for tags_list + # List tags + # List all tags for the given project. + # @param project_id Project ID + # @param tags_list + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'tags_list 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/api/translations_api_spec.rb b/spec/api/translations_api_spec.rb new file mode 100644 index 0000000..b3aaa94 --- /dev/null +++ b/spec/api/translations_api_spec.rb @@ -0,0 +1,278 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::TranslationsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TranslationsApi' do + before do + # run before each test + @api_instance = Phrase::TranslationsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of TranslationsApi' do + it 'should create an instance of TranslationsApi' do + expect(@api_instance).to be_instance_of(Phrase::TranslationsApi) + end + end + + # unit tests for translation_create + # Create a translation + # Create a translation. + # @param project_id Project ID + # @param translation_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'translation_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for translation_exclude + # Exclude a translation from export + # Set exclude from export flag on an existing translation. + # @param project_id Project ID + # @param id ID + # @param translation_exclude + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'translation_exclude test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for translation_include + # Revoke exclusion of a translation in export + # Remove exclude from export flag from an existing translation. + # @param project_id Project ID + # @param id ID + # @param translation_include + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'translation_include test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for translation_review + # Review a translation + # Mark an existing translation as reviewed. + # @param project_id Project ID + # @param id ID + # @param translation_review + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'translation_review test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for translation_show + # Get a single translation + # Get details on a single translation. + # @param project_id Project ID + # @param id ID + # @param translation_show + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'translation_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for translation_unverify + # Mark a translation as unverified + # Mark an existing translation as unverified. + # @param project_id Project ID + # @param id ID + # @param translation_unverify + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'translation_unverify test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for translation_update + # Update a translation + # Update an existing translation. + # @param project_id Project ID + # @param id ID + # @param translation_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'translation_update test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for translation_verify + # Verify a translation + # Verify an existing translation. + # @param project_id Project ID + # @param id ID + # @param translation_verify + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'translation_verify test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for translations_by_key + # List translations by key + # List translations for a specific key. + # @param project_id Project ID + # @param key_id Translation Key ID + # @param translations_by_key + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'translations_by_key test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for translations_by_locale + # List translations by locale + # List translations for a specific locale. If you want to download all translations for one locale we recommend to use the <code>locales#download</code> endpoint. + # @param project_id Project ID + # @param locale_id Locale ID + # @param translations_by_locale + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'translations_by_locale test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for translations_exclude + # Set exclude from export flag on translations selected by query + # Exclude translations matching query from locale export. + # @param project_id Project ID + # @param translations_exclude + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'translations_exclude test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for translations_include + # Remove exlude from import flag from translations selected by query + # Include translations matching query in locale export. + # @param project_id Project ID + # @param translations_include + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'translations_include test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for translations_list + # List all translations + # List translations for the given project. If you want to download all translations for one locale we recommend to use the <code>locales#download</code> endpoint. + # @param project_id Project ID + # @param translations_list + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'translations_list test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for translations_review + # Review translations selected by query + # Review translations matching query. + # @param project_id Project ID + # @param translations_review + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'translations_review test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for translations_search + # Search translations + # Search translations for the given project. Provides the same search interface as <code>translations#index</code> but allows POST requests to avoid limitations imposed by GET requests. If you want to download all translations for one locale we recommend to use the <code>locales#download</code> endpoint. + # @param project_id Project ID + # @param translations_search + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'translations_search test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for translations_unverify + # Mark translations selected by query as unverified + # Mark translations matching query as unverified. + # @param project_id Project ID + # @param translations_unverify + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'translations_unverify test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for translations_verify + # Verify translations selected by query + # Verify translations matching query. + # @param project_id Project ID + # @param translations_verify + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [AffectedCount] + describe 'translations_verify 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/api/uploads_api_spec.rb b/spec/api/uploads_api_spec.rb new file mode 100644 index 0000000..41b12af --- /dev/null +++ b/spec/api/uploads_api_spec.rb @@ -0,0 +1,68 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::UploadsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'UploadsApi' do + before do + # run before each test + @api_instance = Phrase::UploadsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of UploadsApi' do + it 'should create an instance of UploadsApi' do + expect(@api_instance).to be_instance_of(Phrase::UploadsApi) + end + end + + # unit tests for upload_create + # Upload a new file + # Upload a new language file. Creates necessary resources in your project. + # @param project_id Project ID + # @param upload_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'upload_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for upload_show + # View upload details + # View details and summary for a single upload. + # @param project_id Project ID + # @param id ID + # @param upload_show + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Upload] + describe 'upload_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for uploads_list + # List uploads + # List all uploads for the given project. + # @param project_id Project ID + # @param uploads_list + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'uploads_list 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/api/users_api_spec.rb b/spec/api/users_api_spec.rb new file mode 100644 index 0000000..0323457 --- /dev/null +++ b/spec/api/users_api_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::UsersApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'UsersApi' do + before do + # run before each test + @api_instance = Phrase::UsersApi.new + end + + after do + # run after each test + end + + describe 'test an instance of UsersApi' do + it 'should create an instance of UsersApi' do + expect(@api_instance).to be_instance_of(Phrase::UsersApi) + end + end + + # unit tests for show_user + # Show current User + # Show details for current User. + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [User] + describe 'show_user 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/api/versions_history_api_spec.rb b/spec/api/versions_history_api_spec.rb new file mode 100644 index 0000000..4677e76 --- /dev/null +++ b/spec/api/versions_history_api_spec.rb @@ -0,0 +1,56 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::VersionsHistoryApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'VersionsHistoryApi' do + before do + # run before each test + @api_instance = Phrase::VersionsHistoryApi.new + end + + after do + # run after each test + end + + describe 'test an instance of VersionsHistoryApi' do + it 'should create an instance of VersionsHistoryApi' do + expect(@api_instance).to be_instance_of(Phrase::VersionsHistoryApi) + end + end + + # unit tests for version_show + # Get a single version + # Get details on a single version. + # @param project_id Project ID + # @param translation_id Translation ID + # @param id ID + # @param version_show + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'version_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for versions_list + # List all versions + # List all versions for the given translation. + # @param project_id Project ID + # @param translation_id Translation ID + # @param versions_list + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'versions_list 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/api/webhooks_api_spec.rb b/spec/api/webhooks_api_spec.rb new file mode 100644 index 0000000..de931e3 --- /dev/null +++ b/spec/api/webhooks_api_spec.rb @@ -0,0 +1,109 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::WebhooksApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'WebhooksApi' do + before do + # run before each test + @api_instance = Phrase::WebhooksApi.new + end + + after do + # run after each test + end + + describe 'test an instance of WebhooksApi' do + it 'should create an instance of WebhooksApi' do + expect(@api_instance).to be_instance_of(Phrase::WebhooksApi) + end + end + + # unit tests for webhook_create + # Create a webhook + # Create a new webhook. + # @param project_id Project ID + # @param webhook_create + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'webhook_create test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for webhook_delete + # Delete a webhook + # Delete an existing webhook. + # @param project_id Project ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'webhook_delete test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for webhook_show + # Get a single webhook + # Get details on a single webhook. + # @param project_id Project ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Webhook] + describe 'webhook_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for webhook_test + # Test a webhook + # Perform a test request for a webhook. + # @param project_id Project ID + # @param id ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [nil] + describe 'webhook_test test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for webhook_update + # Update a webhook + # Update an existing webhook. + # @param project_id Project ID + # @param id ID + # @param webhook_update + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Object] + describe 'webhook_update test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for webhooks_list + # List webhooks + # List all webhooks for the given project. + # @param project_id Project ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @option opts [Integer] :page Page number + # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 10 by default + # @return [Array] + describe 'webhooks_list 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/api_client_spec.rb b/spec/api_client_spec.rb new file mode 100644 index 0000000..5f4a408 --- /dev/null +++ b/spec/api_client_spec.rb @@ -0,0 +1,214 @@ +require 'spec_helper' + +describe Phrase::ApiClient do + context 'initialization' do + context 'URL stuff' do + context 'host' do + it 'removes http from host' do + Phrase.configure { |c| c.host = 'http://example.com' } + expect(Phrase::Configuration.default.host).to eq('example.com') + end + + it 'removes https from host' do + Phrase.configure { |c| c.host = 'https://wookiee.com' } + expect(Phrase::ApiClient.default.config.host).to eq('wookiee.com') + end + + it 'removes trailing path from host' do + Phrase.configure { |c| c.host = 'hobo.com/v4' } + expect(Phrase::Configuration.default.host).to eq('hobo.com') + end + end + + context 'base_path' do + it "prepends a slash to base_path" do + Phrase.configure { |c| c.base_path = 'v4/dog' } + expect(Phrase::Configuration.default.base_path).to eq('/v4/dog') + end + + it "doesn't prepend a slash if one is already there" do + Phrase.configure { |c| c.base_path = '/v4/dog' } + expect(Phrase::Configuration.default.base_path).to eq('/v4/dog') + end + + it "ends up as a blank string if nil" do + Phrase.configure { |c| c.base_path = nil } + expect(Phrase::Configuration.default.base_path).to eq('') + end + end + end + end + + describe 'params_encoding in #build_request' do + let(:config) { Phrase::Configuration.new } + let(:api_client) { Phrase::ApiClient.new(config) } + + it 'defaults to nil' do + expect(Phrase::Configuration.default.params_encoding).to eq(nil) + expect(config.params_encoding).to eq(nil) + + request = api_client.build_request(:get, '/test') + expect(request.options[:params_encoding]).to eq(nil) + end + + it 'can be customized' do + config.params_encoding = :multi + request = api_client.build_request(:get, '/test') + expect(request.options[:params_encoding]).to eq(:multi) + end + end + + describe 'timeout in #build_request' do + let(:config) { Phrase::Configuration.new } + let(:api_client) { Phrase::ApiClient.new(config) } + + it 'defaults to 0' do + expect(Phrase::Configuration.default.timeout).to eq(0) + expect(config.timeout).to eq(0) + + request = api_client.build_request(:get, '/test') + expect(request.options[:timeout]).to eq(0) + end + + it 'can be customized' do + config.timeout = 100 + request = api_client.build_request(:get, '/test') + expect(request.options[:timeout]).to eq(100) + end + end + + describe '#deserialize' do + it "handles Array" do + api_client = Phrase::ApiClient.new + headers = { 'Content-Type' => 'application/json' } + response = double('response', headers: headers, body: '[12, 34]') + data = api_client.deserialize(response, 'Array') + expect(data).to be_instance_of(Array) + expect(data).to eq([12, 34]) + end + + it 'handles Array>' do + api_client = Phrase::ApiClient.new + headers = { 'Content-Type' => 'application/json' } + response = double('response', headers: headers, body: '[[12, 34], [56]]') + data = api_client.deserialize(response, 'Array>') + expect(data).to be_instance_of(Array) + expect(data).to eq([[12, 34], [56]]) + end + + it 'handles Hash' do + api_client = Phrase::ApiClient.new + headers = { 'Content-Type' => 'application/json' } + response = double('response', headers: headers, body: '{"message": "Hello"}') + data = api_client.deserialize(response, 'Hash') + expect(data).to be_instance_of(Hash) + expect(data).to eq(:message => 'Hello') + end + end + + describe "#object_to_hash" do + it 'ignores nils and includes empty arrays' do + # uncomment below to test object_to_hash for model + # api_client = Phrase::ApiClient.new + # _model = Phrase::ModelName.new + # update the model attribute below + # _model.id = 1 + # update the expected value (hash) below + # expected = {id: 1, name: '', tags: []} + # expect(api_client.object_to_hash(_model)).to eq(expected) + end + end + + describe '#build_collection_param' do + let(:param) { ['aa', 'bb', 'cc'] } + let(:api_client) { Phrase::ApiClient.new } + + it 'works for csv' do + expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc') + end + + it 'works for ssv' do + expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc') + end + + it 'works for tsv' do + expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc") + end + + it 'works for pipes' do + expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc') + end + + it 'works for multi' do + expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc']) + end + + it 'fails for invalid collection format' do + expect { api_client.build_collection_param(param, :INVALID) }.to raise_error(RuntimeError, 'unknown collection format: :INVALID') + end + end + + describe '#json_mime?' do + let(:api_client) { Phrase::ApiClient.new } + + it 'works' do + expect(api_client.json_mime?(nil)).to eq false + expect(api_client.json_mime?('')).to eq false + + expect(api_client.json_mime?('application/json')).to eq true + expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true + expect(api_client.json_mime?('APPLICATION/JSON')).to eq true + + expect(api_client.json_mime?('application/xml')).to eq false + expect(api_client.json_mime?('text/plain')).to eq false + expect(api_client.json_mime?('application/jsonp')).to eq false + end + end + + describe '#select_header_accept' do + let(:api_client) { Phrase::ApiClient.new } + + it 'works' do + expect(api_client.select_header_accept(nil)).to be_nil + expect(api_client.select_header_accept([])).to be_nil + + expect(api_client.select_header_accept(['application/json'])).to eq('application/json') + expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8') + expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON') + + expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml') + expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml') + end + end + + describe '#select_header_content_type' do + let(:api_client) { Phrase::ApiClient.new } + + it 'works' do + expect(api_client.select_header_content_type(nil)).to eq('application/json') + expect(api_client.select_header_content_type([])).to eq('application/json') + + expect(api_client.select_header_content_type(['application/json'])).to eq('application/json') + expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8') + expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON') + expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml') + expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain') + end + end + + describe '#sanitize_filename' do + let(:api_client) { Phrase::ApiClient.new } + + it 'works' do + expect(api_client.sanitize_filename('sun')).to eq('sun') + expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif') + end + end +end diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb new file mode 100644 index 0000000..51d478d --- /dev/null +++ b/spec/configuration_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper' + +describe Phrase::Configuration do + let(:config) { Phrase::Configuration.default } + + before(:each) do + # uncomment below to setup host and base_path + # require 'URI' + # uri = URI.parse("https://api.phrase.com/v2") + # Phrase.configure do |c| + # c.host = uri.host + # c.base_path = uri.path + # end + end + + describe '#base_url' do + it 'should have the default value' do + # uncomment below to test default value of the base path + # expect(config.base_url).to eq("https://api.phrase.com/v2") + end + + it 'should remove trailing slashes' do + [nil, '', '/', '//'].each do |base_path| + config.base_path = base_path + # uncomment below to test trailing slashes + # expect(config.base_url).to eq("https://api.phrase.com/v2") + end + end + end +end diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb new file mode 100644 index 0000000..9f7f217 --- /dev/null +++ b/spec/models/account_spec.rb @@ -0,0 +1,53 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Account +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Account' do + before do + # run before each test + @instance = Phrase::Account.new + end + + after do + # run after each test + end + + describe 'test an instance of Account' do + it 'should create an instance of Account' do + expect(@instance).to be_instance_of(Phrase::Account) + 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 + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "company"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' 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/affected_count_spec.rb b/spec/models/affected_count_spec.rb new file mode 100644 index 0000000..1fd63ef --- /dev/null +++ b/spec/models/affected_count_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::AffectedCount +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'AffectedCount' do + before do + # run before each test + @instance = Phrase::AffectedCount.new + end + + after do + # run after each test + end + + describe 'test an instance of AffectedCount' do + it 'should create an instance of AffectedCount' do + expect(@instance).to be_instance_of(Phrase::AffectedCount) + end + end + describe 'test attribute "records_affected"' 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/affected_resources_spec.rb b/spec/models/affected_resources_spec.rb new file mode 100644 index 0000000..3b9c551 --- /dev/null +++ b/spec/models/affected_resources_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::AffectedResources +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'AffectedResources' do + before do + # run before each test + @instance = Phrase::AffectedResources.new + end + + after do + # run after each test + end + + describe 'test an instance of AffectedResources' do + it 'should create an instance of AffectedResources' do + expect(@instance).to be_instance_of(Phrase::AffectedResources) + end + end + describe 'test attribute "records_affected"' 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/authorization_create_spec.rb b/spec/models/authorization_create_spec.rb new file mode 100644 index 0000000..ae60eb0 --- /dev/null +++ b/spec/models/authorization_create_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::AuthorizationCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'AuthorizationCreate' do + before do + # run before each test + @instance = Phrase::AuthorizationCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of AuthorizationCreate' do + it 'should create an instance of AuthorizationCreate' do + expect(@instance).to be_instance_of(Phrase::AuthorizationCreate) + end + end + describe 'test attribute "note"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "scopes"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "expires_at"' 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/authorization_spec.rb b/spec/models/authorization_spec.rb new file mode 100644 index 0000000..de9b2cb --- /dev/null +++ b/spec/models/authorization_spec.rb @@ -0,0 +1,71 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Authorization +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Authorization' do + before do + # run before each test + @instance = Phrase::Authorization.new + end + + after do + # run after each test + end + + describe 'test an instance of Authorization' do + it 'should create an instance of Authorization' do + expect(@instance).to be_instance_of(Phrase::Authorization) + 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 + + describe 'test attribute "note"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "token_last_eight"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "hashed_token"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "scopes"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "expires_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' 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/authorization_update_spec.rb b/spec/models/authorization_update_spec.rb new file mode 100644 index 0000000..c737aa7 --- /dev/null +++ b/spec/models/authorization_update_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::AuthorizationUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'AuthorizationUpdate' do + before do + # run before each test + @instance = Phrase::AuthorizationUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of AuthorizationUpdate' do + it 'should create an instance of AuthorizationUpdate' do + expect(@instance).to be_instance_of(Phrase::AuthorizationUpdate) + end + end + describe 'test attribute "note"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "scopes"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "expires_at"' 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/bitbucket_sync_export_response_spec.rb b/spec/models/bitbucket_sync_export_response_spec.rb new file mode 100644 index 0000000..0b32031 --- /dev/null +++ b/spec/models/bitbucket_sync_export_response_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::BitbucketSyncExportResponse +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BitbucketSyncExportResponse' do + before do + # run before each test + @instance = Phrase::BitbucketSyncExportResponse.new + end + + after do + # run after each test + end + + describe 'test an instance of BitbucketSyncExportResponse' do + it 'should create an instance of BitbucketSyncExportResponse' do + expect(@instance).to be_instance_of(Phrase::BitbucketSyncExportResponse) + end + end + describe 'test attribute "status_path"' 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/bitbucket_sync_export_spec.rb b/spec/models/bitbucket_sync_export_spec.rb new file mode 100644 index 0000000..d914981 --- /dev/null +++ b/spec/models/bitbucket_sync_export_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::BitbucketSyncExport +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BitbucketSyncExport' do + before do + # run before each test + @instance = Phrase::BitbucketSyncExport.new + end + + after do + # run after each test + end + + describe 'test an instance of BitbucketSyncExport' do + it 'should create an instance of BitbucketSyncExport' do + expect(@instance).to be_instance_of(Phrase::BitbucketSyncExport) + end + end + describe 'test attribute "account_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/bitbucket_sync_import_spec.rb b/spec/models/bitbucket_sync_import_spec.rb new file mode 100644 index 0000000..15ab0d3 --- /dev/null +++ b/spec/models/bitbucket_sync_import_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::BitbucketSyncImport +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BitbucketSyncImport' do + before do + # run before each test + @instance = Phrase::BitbucketSyncImport.new + end + + after do + # run after each test + end + + describe 'test an instance of BitbucketSyncImport' do + it 'should create an instance of BitbucketSyncImport' do + expect(@instance).to be_instance_of(Phrase::BitbucketSyncImport) + end + end + describe 'test attribute "account_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/bitbucket_sync_spec.rb b/spec/models/bitbucket_sync_spec.rb new file mode 100644 index 0000000..426ee16 --- /dev/null +++ b/spec/models/bitbucket_sync_spec.rb @@ -0,0 +1,59 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::BitbucketSync +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BitbucketSync' do + before do + # run before each test + @instance = Phrase::BitbucketSync.new + end + + after do + # run after each test + end + + describe 'test an instance of BitbucketSync' do + it 'should create an instance of BitbucketSync' do + expect(@instance).to be_instance_of(Phrase::BitbucketSync) + 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 + + describe 'test attribute "repository_name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "last_export_to_bitbucket_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "last_import_from_bitbucket_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "valid_phraseapp_yaml"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "phraseapp_projects"' 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/bitbucket_syncs_list_spec.rb b/spec/models/bitbucket_syncs_list_spec.rb new file mode 100644 index 0000000..40fd042 --- /dev/null +++ b/spec/models/bitbucket_syncs_list_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::BitbucketSyncsList +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BitbucketSyncsList' do + before do + # run before each test + @instance = Phrase::BitbucketSyncsList.new + end + + after do + # run after each test + end + + describe 'test an instance of BitbucketSyncsList' do + it 'should create an instance of BitbucketSyncsList' do + expect(@instance).to be_instance_of(Phrase::BitbucketSyncsList) + end + end + describe 'test attribute "account_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/blacklisted_key_create_spec.rb b/spec/models/blacklisted_key_create_spec.rb new file mode 100644 index 0000000..00df1fb --- /dev/null +++ b/spec/models/blacklisted_key_create_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::BlacklistedKeyCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BlacklistedKeyCreate' do + before do + # run before each test + @instance = Phrase::BlacklistedKeyCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of BlacklistedKeyCreate' do + it 'should create an instance of BlacklistedKeyCreate' do + expect(@instance).to be_instance_of(Phrase::BlacklistedKeyCreate) + end + end + describe 'test attribute "name"' 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/blacklisted_key_spec.rb b/spec/models/blacklisted_key_spec.rb new file mode 100644 index 0000000..f22dd46 --- /dev/null +++ b/spec/models/blacklisted_key_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::BlacklistedKey +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BlacklistedKey' do + before do + # run before each test + @instance = Phrase::BlacklistedKey.new + end + + after do + # run after each test + end + + describe 'test an instance of BlacklistedKey' do + it 'should create an instance of BlacklistedKey' do + expect(@instance).to be_instance_of(Phrase::BlacklistedKey) + 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 + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' 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/blacklisted_key_update_spec.rb b/spec/models/blacklisted_key_update_spec.rb new file mode 100644 index 0000000..97e4efe --- /dev/null +++ b/spec/models/blacklisted_key_update_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::BlacklistedKeyUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BlacklistedKeyUpdate' do + before do + # run before each test + @instance = Phrase::BlacklistedKeyUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of BlacklistedKeyUpdate' do + it 'should create an instance of BlacklistedKeyUpdate' do + expect(@instance).to be_instance_of(Phrase::BlacklistedKeyUpdate) + end + end + describe 'test attribute "name"' 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/branch_compare_spec.rb b/spec/models/branch_compare_spec.rb new file mode 100644 index 0000000..f6a5bc8 --- /dev/null +++ b/spec/models/branch_compare_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::BranchCompare +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BranchCompare' do + before do + # run before each test + @instance = Phrase::BranchCompare.new + end + + after do + # run after each test + end + + describe 'test an instance of BranchCompare' do + it 'should create an instance of BranchCompare' do + expect(@instance).to be_instance_of(Phrase::BranchCompare) + end + end + describe 'test attribute "name"' 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/branch_create_spec.rb b/spec/models/branch_create_spec.rb new file mode 100644 index 0000000..ba22af7 --- /dev/null +++ b/spec/models/branch_create_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::BranchCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BranchCreate' do + before do + # run before each test + @instance = Phrase::BranchCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of BranchCreate' do + it 'should create an instance of BranchCreate' do + expect(@instance).to be_instance_of(Phrase::BranchCreate) + end + end + describe 'test attribute "name"' 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/branch_merge_spec.rb b/spec/models/branch_merge_spec.rb new file mode 100644 index 0000000..bc66697 --- /dev/null +++ b/spec/models/branch_merge_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::BranchMerge +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BranchMerge' do + before do + # run before each test + @instance = Phrase::BranchMerge.new + end + + after do + # run after each test + end + + describe 'test an instance of BranchMerge' do + it 'should create an instance of BranchMerge' do + expect(@instance).to be_instance_of(Phrase::BranchMerge) + end + end + describe 'test attribute "strategy"' 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/branch_spec.rb b/spec/models/branch_spec.rb new file mode 100644 index 0000000..a987bdd --- /dev/null +++ b/spec/models/branch_spec.rb @@ -0,0 +1,65 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Branch +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Branch' do + before do + # run before each test + @instance = Phrase::Branch.new + end + + after do + # run after each test + end + + describe 'test an instance of Branch' do + it 'should create an instance of Branch' do + expect(@instance).to be_instance_of(Phrase::Branch) + end + end + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "merged_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "merged_by"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_by"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "state"' 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/branch_update_spec.rb b/spec/models/branch_update_spec.rb new file mode 100644 index 0000000..3848ce6 --- /dev/null +++ b/spec/models/branch_update_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::BranchUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BranchUpdate' do + before do + # run before each test + @instance = Phrase::BranchUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of BranchUpdate' do + it 'should create an instance of BranchUpdate' do + expect(@instance).to be_instance_of(Phrase::BranchUpdate) + end + end + describe 'test attribute "name"' 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/comment_create_spec.rb b/spec/models/comment_create_spec.rb new file mode 100644 index 0000000..81ce005 --- /dev/null +++ b/spec/models/comment_create_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::CommentCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'CommentCreate' do + before do + # run before each test + @instance = Phrase::CommentCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of CommentCreate' do + it 'should create an instance of CommentCreate' do + expect(@instance).to be_instance_of(Phrase::CommentCreate) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + 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 + +end diff --git a/spec/models/comment_delete_spec.rb b/spec/models/comment_delete_spec.rb new file mode 100644 index 0000000..8cebe79 --- /dev/null +++ b/spec/models/comment_delete_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::CommentDelete +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'CommentDelete' do + before do + # run before each test + @instance = Phrase::CommentDelete.new + end + + after do + # run after each test + end + + describe 'test an instance of CommentDelete' do + it 'should create an instance of CommentDelete' do + expect(@instance).to be_instance_of(Phrase::CommentDelete) + end + end + describe 'test attribute "branch"' 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/comment_mark_check_spec.rb b/spec/models/comment_mark_check_spec.rb new file mode 100644 index 0000000..314ff95 --- /dev/null +++ b/spec/models/comment_mark_check_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::CommentMarkCheck +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'CommentMarkCheck' do + before do + # run before each test + @instance = Phrase::CommentMarkCheck.new + end + + after do + # run after each test + end + + describe 'test an instance of CommentMarkCheck' do + it 'should create an instance of CommentMarkCheck' do + expect(@instance).to be_instance_of(Phrase::CommentMarkCheck) + end + end + describe 'test attribute "branch"' 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/comment_mark_read_spec.rb b/spec/models/comment_mark_read_spec.rb new file mode 100644 index 0000000..118c9a2 --- /dev/null +++ b/spec/models/comment_mark_read_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::CommentMarkRead +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'CommentMarkRead' do + before do + # run before each test + @instance = Phrase::CommentMarkRead.new + end + + after do + # run after each test + end + + describe 'test an instance of CommentMarkRead' do + it 'should create an instance of CommentMarkRead' do + expect(@instance).to be_instance_of(Phrase::CommentMarkRead) + end + end + describe 'test attribute "branch"' 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/comment_mark_unread_spec.rb b/spec/models/comment_mark_unread_spec.rb new file mode 100644 index 0000000..fef8580 --- /dev/null +++ b/spec/models/comment_mark_unread_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::CommentMarkUnread +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'CommentMarkUnread' do + before do + # run before each test + @instance = Phrase::CommentMarkUnread.new + end + + after do + # run after each test + end + + describe 'test an instance of CommentMarkUnread' do + it 'should create an instance of CommentMarkUnread' do + expect(@instance).to be_instance_of(Phrase::CommentMarkUnread) + end + end + describe 'test attribute "branch"' 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/comment_show_spec.rb b/spec/models/comment_show_spec.rb new file mode 100644 index 0000000..adf306a --- /dev/null +++ b/spec/models/comment_show_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::CommentShow +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'CommentShow' do + before do + # run before each test + @instance = Phrase::CommentShow.new + end + + after do + # run after each test + end + + describe 'test an instance of CommentShow' do + it 'should create an instance of CommentShow' do + expect(@instance).to be_instance_of(Phrase::CommentShow) + end + end + describe 'test attribute "branch"' 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/comment_spec.rb b/spec/models/comment_spec.rb new file mode 100644 index 0000000..24439d3 --- /dev/null +++ b/spec/models/comment_spec.rb @@ -0,0 +1,53 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Comment +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Comment' do + before do + # run before each test + @instance = Phrase::Comment.new + end + + after do + # run after each test + end + + describe 'test an instance of Comment' do + it 'should create an instance of Comment' do + expect(@instance).to be_instance_of(Phrase::Comment) + 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 + + 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 "user"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' 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/comment_update_spec.rb b/spec/models/comment_update_spec.rb new file mode 100644 index 0000000..930b860 --- /dev/null +++ b/spec/models/comment_update_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::CommentUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'CommentUpdate' do + before do + # run before each test + @instance = Phrase::CommentUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of CommentUpdate' do + it 'should create an instance of CommentUpdate' do + expect(@instance).to be_instance_of(Phrase::CommentUpdate) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + 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 + +end diff --git a/spec/models/comments_list_spec.rb b/spec/models/comments_list_spec.rb new file mode 100644 index 0000000..30525d9 --- /dev/null +++ b/spec/models/comments_list_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::CommentsList +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'CommentsList' do + before do + # run before each test + @instance = Phrase::CommentsList.new + end + + after do + # run after each test + end + + describe 'test an instance of CommentsList' do + it 'should create an instance of CommentsList' do + expect(@instance).to be_instance_of(Phrase::CommentsList) + end + end + describe 'test attribute "branch"' 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/distribution_create_spec.rb b/spec/models/distribution_create_spec.rb new file mode 100644 index 0000000..99769b2 --- /dev/null +++ b/spec/models/distribution_create_spec.rb @@ -0,0 +1,65 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::DistributionCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'DistributionCreate' do + before do + # run before each test + @instance = Phrase::DistributionCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of DistributionCreate' do + it 'should create an instance of DistributionCreate' do + expect(@instance).to be_instance_of(Phrase::DistributionCreate) + end + end + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "project_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "platforms"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "format_options"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "fallback_to_non_regional_locale"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "fallback_to_default_locale"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "use_last_reviewed_version"' 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/distribution_preview_spec.rb b/spec/models/distribution_preview_spec.rb new file mode 100644 index 0000000..f5f3457 --- /dev/null +++ b/spec/models/distribution_preview_spec.rb @@ -0,0 +1,65 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::DistributionPreview +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'DistributionPreview' do + before do + # run before each test + @instance = Phrase::DistributionPreview.new + end + + after do + # run after each test + end + + describe 'test an instance of DistributionPreview' do + it 'should create an instance of DistributionPreview' do + expect(@instance).to be_instance_of(Phrase::DistributionPreview) + 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 + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "project"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "platforms"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "release_count"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "deleted_at"' 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/distribution_spec.rb b/spec/models/distribution_spec.rb new file mode 100644 index 0000000..b56ea7a --- /dev/null +++ b/spec/models/distribution_spec.rb @@ -0,0 +1,65 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Distribution +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Distribution' do + before do + # run before each test + @instance = Phrase::Distribution.new + end + + after do + # run after each test + end + + describe 'test an instance of Distribution' do + it 'should create an instance of Distribution' do + expect(@instance).to be_instance_of(Phrase::Distribution) + 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 + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "project"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "platforms"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "releases"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "deleted_at"' 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/distribution_update_spec.rb b/spec/models/distribution_update_spec.rb new file mode 100644 index 0000000..2b0a255 --- /dev/null +++ b/spec/models/distribution_update_spec.rb @@ -0,0 +1,65 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::DistributionUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'DistributionUpdate' do + before do + # run before each test + @instance = Phrase::DistributionUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of DistributionUpdate' do + it 'should create an instance of DistributionUpdate' do + expect(@instance).to be_instance_of(Phrase::DistributionUpdate) + end + end + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "project_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "platforms"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "format_options"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "fallback_to_non_regional_locale"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "fallback_to_default_locale"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "use_last_reviewed_version"' 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/errors_errors_spec.rb b/spec/models/errors_errors_spec.rb new file mode 100644 index 0000000..a3639b8 --- /dev/null +++ b/spec/models/errors_errors_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::ErrorsErrors +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ErrorsErrors' do + before do + # run before each test + @instance = Phrase::ErrorsErrors.new + end + + after do + # run after each test + end + + describe 'test an instance of ErrorsErrors' do + it 'should create an instance of ErrorsErrors' do + expect(@instance).to be_instance_of(Phrase::ErrorsErrors) + end + end + describe 'test attribute "resource"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "field"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + 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 + +end diff --git a/spec/models/errors_spec.rb b/spec/models/errors_spec.rb new file mode 100644 index 0000000..0dc0373 --- /dev/null +++ b/spec/models/errors_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Errors +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Errors' do + before do + # run before each test + @instance = Phrase::Errors.new + end + + after do + # run after each test + end + + describe 'test an instance of Errors' do + it 'should create an instance of Errors' do + expect(@instance).to be_instance_of(Phrase::Errors) + 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 "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/format_spec.rb b/spec/models/format_spec.rb new file mode 100644 index 0000000..18cc267 --- /dev/null +++ b/spec/models/format_spec.rb @@ -0,0 +1,83 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Format +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Format' do + before do + # run before each test + @instance = Phrase::Format.new + end + + after do + # run after each test + end + + describe 'test an instance of Format' do + it 'should create an instance of Format' do + expect(@instance).to be_instance_of(Phrase::Format) + end + end + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "api_name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "extension"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "default_encoding"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "importable"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "exportable"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "default_file"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "renders_default_locale"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "includes_locale_information"' 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/gitlab_sync_delete_spec.rb b/spec/models/gitlab_sync_delete_spec.rb new file mode 100644 index 0000000..0378ca3 --- /dev/null +++ b/spec/models/gitlab_sync_delete_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::GitlabSyncDelete +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GitlabSyncDelete' do + before do + # run before each test + @instance = Phrase::GitlabSyncDelete.new + end + + after do + # run after each test + end + + describe 'test an instance of GitlabSyncDelete' do + it 'should create an instance of GitlabSyncDelete' do + expect(@instance).to be_instance_of(Phrase::GitlabSyncDelete) + end + end + describe 'test attribute "account_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/gitlab_sync_export1_spec.rb b/spec/models/gitlab_sync_export1_spec.rb new file mode 100644 index 0000000..e80805b --- /dev/null +++ b/spec/models/gitlab_sync_export1_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::GitlabSyncExport1 +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GitlabSyncExport1' do + before do + # run before each test + @instance = Phrase::GitlabSyncExport1.new + end + + after do + # run after each test + end + + describe 'test an instance of GitlabSyncExport1' do + it 'should create an instance of GitlabSyncExport1' do + expect(@instance).to be_instance_of(Phrase::GitlabSyncExport1) + end + end + describe 'test attribute "merge_request_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "merge_request_web_url"' 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/gitlab_sync_export_spec.rb b/spec/models/gitlab_sync_export_spec.rb new file mode 100644 index 0000000..67c2e62 --- /dev/null +++ b/spec/models/gitlab_sync_export_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::GitlabSyncExport +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GitlabSyncExport' do + before do + # run before each test + @instance = Phrase::GitlabSyncExport.new + end + + after do + # run after each test + end + + describe 'test an instance of GitlabSyncExport' do + it 'should create an instance of GitlabSyncExport' do + expect(@instance).to be_instance_of(Phrase::GitlabSyncExport) + end + end + describe 'test attribute "account_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/gitlab_sync_history1_spec.rb b/spec/models/gitlab_sync_history1_spec.rb new file mode 100644 index 0000000..1401354 --- /dev/null +++ b/spec/models/gitlab_sync_history1_spec.rb @@ -0,0 +1,53 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::GitlabSyncHistory1 +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GitlabSyncHistory1' do + before do + # run before each test + @instance = Phrase::GitlabSyncHistory1.new + end + + after do + # run after each test + end + + describe 'test an instance of GitlabSyncHistory1' do + it 'should create an instance of GitlabSyncHistory1' do + expect(@instance).to be_instance_of(Phrase::GitlabSyncHistory1) + end + end + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "action"' 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 + + describe 'test attribute "date"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "details"' 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/gitlab_sync_history_spec.rb b/spec/models/gitlab_sync_history_spec.rb new file mode 100644 index 0000000..fd309a4 --- /dev/null +++ b/spec/models/gitlab_sync_history_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::GitlabSyncHistory +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GitlabSyncHistory' do + before do + # run before each test + @instance = Phrase::GitlabSyncHistory.new + end + + after do + # run after each test + end + + describe 'test an instance of GitlabSyncHistory' do + it 'should create an instance of GitlabSyncHistory' do + expect(@instance).to be_instance_of(Phrase::GitlabSyncHistory) + end + end + describe 'test attribute "account_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/gitlab_sync_import_spec.rb b/spec/models/gitlab_sync_import_spec.rb new file mode 100644 index 0000000..7cdb073 --- /dev/null +++ b/spec/models/gitlab_sync_import_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::GitlabSyncImport +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GitlabSyncImport' do + before do + # run before each test + @instance = Phrase::GitlabSyncImport.new + end + + after do + # run after each test + end + + describe 'test an instance of GitlabSyncImport' do + it 'should create an instance of GitlabSyncImport' do + expect(@instance).to be_instance_of(Phrase::GitlabSyncImport) + end + end + describe 'test attribute "account_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/gitlab_sync_list_spec.rb b/spec/models/gitlab_sync_list_spec.rb new file mode 100644 index 0000000..ec5b2b3 --- /dev/null +++ b/spec/models/gitlab_sync_list_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::GitlabSyncList +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GitlabSyncList' do + before do + # run before each test + @instance = Phrase::GitlabSyncList.new + end + + after do + # run after each test + end + + describe 'test an instance of GitlabSyncList' do + it 'should create an instance of GitlabSyncList' do + expect(@instance).to be_instance_of(Phrase::GitlabSyncList) + end + end + describe 'test attribute "account_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/gitlab_sync_show_spec.rb b/spec/models/gitlab_sync_show_spec.rb new file mode 100644 index 0000000..83b8ffc --- /dev/null +++ b/spec/models/gitlab_sync_show_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::GitlabSyncShow +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GitlabSyncShow' do + before do + # run before each test + @instance = Phrase::GitlabSyncShow.new + end + + after do + # run after each test + end + + describe 'test an instance of GitlabSyncShow' do + it 'should create an instance of GitlabSyncShow' do + expect(@instance).to be_instance_of(Phrase::GitlabSyncShow) + end + end + describe 'test attribute "account_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/gitlab_sync_spec.rb b/spec/models/gitlab_sync_spec.rb new file mode 100644 index 0000000..35453bd --- /dev/null +++ b/spec/models/gitlab_sync_spec.rb @@ -0,0 +1,89 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::GitlabSync +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GitlabSync' do + before do + # run before each test + @instance = Phrase::GitlabSync.new + end + + after do + # run after each test + end + + describe 'test an instance of GitlabSync' do + it 'should create an instance of GitlabSync' do + expect(@instance).to be_instance_of(Phrase::GitlabSync) + 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 + + describe 'test attribute "project_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "gitlab_project_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "gitlab_branch_name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "auto_import"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "auto_import_secret"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "auto_import_url"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "self_hosted_api_url"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "last_exported_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "last_imported_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "last_status"' 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/gitlab_sync_update_spec.rb b/spec/models/gitlab_sync_update_spec.rb new file mode 100644 index 0000000..29f4ba8 --- /dev/null +++ b/spec/models/gitlab_sync_update_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::GitlabSyncUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GitlabSyncUpdate' do + before do + # run before each test + @instance = Phrase::GitlabSyncUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of GitlabSyncUpdate' do + it 'should create an instance of GitlabSyncUpdate' do + expect(@instance).to be_instance_of(Phrase::GitlabSyncUpdate) + end + end + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "phrase_project_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 "gitlab_project_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "gitlab_branch_name"' 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/glossary_create_spec.rb b/spec/models/glossary_create_spec.rb new file mode 100644 index 0000000..5f62f88 --- /dev/null +++ b/spec/models/glossary_create_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::GlossaryCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GlossaryCreate' do + before do + # run before each test + @instance = Phrase::GlossaryCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of GlossaryCreate' do + it 'should create an instance of GlossaryCreate' do + expect(@instance).to be_instance_of(Phrase::GlossaryCreate) + end + end + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "project_ids"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "space_ids"' 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/glossary_spec.rb b/spec/models/glossary_spec.rb new file mode 100644 index 0000000..122f117 --- /dev/null +++ b/spec/models/glossary_spec.rb @@ -0,0 +1,53 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Glossary +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Glossary' do + before do + # run before each test + @instance = Phrase::Glossary.new + end + + after do + # run after each test + end + + describe 'test an instance of Glossary' do + it 'should create an instance of Glossary' do + expect(@instance).to be_instance_of(Phrase::Glossary) + 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 + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "projects"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' 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/glossary_term_create_spec.rb b/spec/models/glossary_term_create_spec.rb new file mode 100644 index 0000000..e4d983b --- /dev/null +++ b/spec/models/glossary_term_create_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::GlossaryTermCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GlossaryTermCreate' do + before do + # run before each test + @instance = Phrase::GlossaryTermCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of GlossaryTermCreate' do + it 'should create an instance of GlossaryTermCreate' do + expect(@instance).to be_instance_of(Phrase::GlossaryTermCreate) + end + end + describe 'test attribute "term"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "translatable"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "case_sensitive"' 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/glossary_term_spec.rb b/spec/models/glossary_term_spec.rb new file mode 100644 index 0000000..501dded --- /dev/null +++ b/spec/models/glossary_term_spec.rb @@ -0,0 +1,71 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::GlossaryTerm +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GlossaryTerm' do + before do + # run before each test + @instance = Phrase::GlossaryTerm.new + end + + after do + # run after each test + end + + describe 'test an instance of GlossaryTerm' do + it 'should create an instance of GlossaryTerm' do + expect(@instance).to be_instance_of(Phrase::GlossaryTerm) + 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 + + describe 'test attribute "term"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "translatable"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "case_sensitive"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + 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 + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' 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/glossary_term_translation_create_spec.rb b/spec/models/glossary_term_translation_create_spec.rb new file mode 100644 index 0000000..866581c --- /dev/null +++ b/spec/models/glossary_term_translation_create_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::GlossaryTermTranslationCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GlossaryTermTranslationCreate' do + before do + # run before each test + @instance = Phrase::GlossaryTermTranslationCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of GlossaryTermTranslationCreate' do + it 'should create an instance of GlossaryTermTranslationCreate' do + expect(@instance).to be_instance_of(Phrase::GlossaryTermTranslationCreate) + end + end + describe 'test attribute "locale_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 "content"' 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/glossary_term_translation_spec.rb b/spec/models/glossary_term_translation_spec.rb new file mode 100644 index 0000000..a6b7d01 --- /dev/null +++ b/spec/models/glossary_term_translation_spec.rb @@ -0,0 +1,53 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::GlossaryTermTranslation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GlossaryTermTranslation' do + before do + # run before each test + @instance = Phrase::GlossaryTermTranslation.new + end + + after do + # run after each test + end + + describe 'test an instance of GlossaryTermTranslation' do + it 'should create an instance of GlossaryTermTranslation' do + expect(@instance).to be_instance_of(Phrase::GlossaryTermTranslation) + 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 + + describe 'test attribute "locale_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 "content"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' 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/glossary_term_translation_update_spec.rb b/spec/models/glossary_term_translation_update_spec.rb new file mode 100644 index 0000000..9bbeabc --- /dev/null +++ b/spec/models/glossary_term_translation_update_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::GlossaryTermTranslationUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GlossaryTermTranslationUpdate' do + before do + # run before each test + @instance = Phrase::GlossaryTermTranslationUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of GlossaryTermTranslationUpdate' do + it 'should create an instance of GlossaryTermTranslationUpdate' do + expect(@instance).to be_instance_of(Phrase::GlossaryTermTranslationUpdate) + end + end + describe 'test attribute "locale_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 "content"' 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/glossary_term_update_spec.rb b/spec/models/glossary_term_update_spec.rb new file mode 100644 index 0000000..1aca06f --- /dev/null +++ b/spec/models/glossary_term_update_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::GlossaryTermUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GlossaryTermUpdate' do + before do + # run before each test + @instance = Phrase::GlossaryTermUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of GlossaryTermUpdate' do + it 'should create an instance of GlossaryTermUpdate' do + expect(@instance).to be_instance_of(Phrase::GlossaryTermUpdate) + end + end + describe 'test attribute "term"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "translatable"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "case_sensitive"' 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/glossary_update_spec.rb b/spec/models/glossary_update_spec.rb new file mode 100644 index 0000000..05a20f4 --- /dev/null +++ b/spec/models/glossary_update_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::GlossaryUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GlossaryUpdate' do + before do + # run before each test + @instance = Phrase::GlossaryUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of GlossaryUpdate' do + it 'should create an instance of GlossaryUpdate' do + expect(@instance).to be_instance_of(Phrase::GlossaryUpdate) + end + end + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "project_ids"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "space_ids"' 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/invitation_create_spec.rb b/spec/models/invitation_create_spec.rb new file mode 100644 index 0000000..c437098 --- /dev/null +++ b/spec/models/invitation_create_spec.rb @@ -0,0 +1,53 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::InvitationCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'InvitationCreate' do + before do + # run before each test + @instance = Phrase::InvitationCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of InvitationCreate' do + it 'should create an instance of InvitationCreate' do + expect(@instance).to be_instance_of(Phrase::InvitationCreate) + end + end + describe 'test attribute "email"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "role"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "project_ids"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "locale_ids"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "permissions"' 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/invitation_spec.rb b/spec/models/invitation_spec.rb new file mode 100644 index 0000000..1146b00 --- /dev/null +++ b/spec/models/invitation_spec.rb @@ -0,0 +1,83 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Invitation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Invitation' do + before do + # run before each test + @instance = Phrase::Invitation.new + end + + after do + # run after each test + end + + describe 'test an instance of Invitation' do + it 'should create an instance of Invitation' do + expect(@instance).to be_instance_of(Phrase::Invitation) + 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 + + describe 'test attribute "email"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "role"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "state"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "projects"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "locales"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "permissions"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "accepted_at"' 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/invitation_update_spec.rb b/spec/models/invitation_update_spec.rb new file mode 100644 index 0000000..6aa5dcc --- /dev/null +++ b/spec/models/invitation_update_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::InvitationUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'InvitationUpdate' do + before do + # run before each test + @instance = Phrase::InvitationUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of InvitationUpdate' do + it 'should create an instance of InvitationUpdate' do + expect(@instance).to be_instance_of(Phrase::InvitationUpdate) + end + end + describe 'test attribute "role"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "project_ids"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "locale_ids"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "permissions"' 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/job_complete_spec.rb b/spec/models/job_complete_spec.rb new file mode 100644 index 0000000..0babbfe --- /dev/null +++ b/spec/models/job_complete_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::JobComplete +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'JobComplete' do + before do + # run before each test + @instance = Phrase::JobComplete.new + end + + after do + # run after each test + end + + describe 'test an instance of JobComplete' do + it 'should create an instance of JobComplete' do + expect(@instance).to be_instance_of(Phrase::JobComplete) + end + end + describe 'test attribute "branch"' 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/job_create_spec.rb b/spec/models/job_create_spec.rb new file mode 100644 index 0000000..c8e32fb --- /dev/null +++ b/spec/models/job_create_spec.rb @@ -0,0 +1,59 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::JobCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'JobCreate' do + before do + # run before each test + @instance = Phrase::JobCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of JobCreate' do + it 'should create an instance of JobCreate' do + expect(@instance).to be_instance_of(Phrase::JobCreate) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "briefing"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "due_date"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "tags"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "translation_key_ids"' 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/job_delete_spec.rb b/spec/models/job_delete_spec.rb new file mode 100644 index 0000000..3d35a99 --- /dev/null +++ b/spec/models/job_delete_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::JobDelete +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'JobDelete' do + before do + # run before each test + @instance = Phrase::JobDelete.new + end + + after do + # run after each test + end + + describe 'test an instance of JobDelete' do + it 'should create an instance of JobDelete' do + expect(@instance).to be_instance_of(Phrase::JobDelete) + end + end + describe 'test attribute "branch"' 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/job_keys_create_spec.rb b/spec/models/job_keys_create_spec.rb new file mode 100644 index 0000000..c46b98f --- /dev/null +++ b/spec/models/job_keys_create_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::JobKeysCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'JobKeysCreate' do + before do + # run before each test + @instance = Phrase::JobKeysCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of JobKeysCreate' do + it 'should create an instance of JobKeysCreate' do + expect(@instance).to be_instance_of(Phrase::JobKeysCreate) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "translation_key_ids"' 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/job_keys_delete_spec.rb b/spec/models/job_keys_delete_spec.rb new file mode 100644 index 0000000..9402626 --- /dev/null +++ b/spec/models/job_keys_delete_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::JobKeysDelete +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'JobKeysDelete' do + before do + # run before each test + @instance = Phrase::JobKeysDelete.new + end + + after do + # run after each test + end + + describe 'test an instance of JobKeysDelete' do + it 'should create an instance of JobKeysDelete' do + expect(@instance).to be_instance_of(Phrase::JobKeysDelete) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "translation_key_ids"' 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/job_locale_complete_spec.rb b/spec/models/job_locale_complete_spec.rb new file mode 100644 index 0000000..63f58b1 --- /dev/null +++ b/spec/models/job_locale_complete_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::JobLocaleComplete +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'JobLocaleComplete' do + before do + # run before each test + @instance = Phrase::JobLocaleComplete.new + end + + after do + # run after each test + end + + describe 'test an instance of JobLocaleComplete' do + it 'should create an instance of JobLocaleComplete' do + expect(@instance).to be_instance_of(Phrase::JobLocaleComplete) + end + end + describe 'test attribute "branch"' 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/job_locale_delete_spec.rb b/spec/models/job_locale_delete_spec.rb new file mode 100644 index 0000000..671fb49 --- /dev/null +++ b/spec/models/job_locale_delete_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::JobLocaleDelete +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'JobLocaleDelete' do + before do + # run before each test + @instance = Phrase::JobLocaleDelete.new + end + + after do + # run after each test + end + + describe 'test an instance of JobLocaleDelete' do + it 'should create an instance of JobLocaleDelete' do + expect(@instance).to be_instance_of(Phrase::JobLocaleDelete) + end + end + describe 'test attribute "branch"' 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/job_locale_reopen_spec.rb b/spec/models/job_locale_reopen_spec.rb new file mode 100644 index 0000000..8f9d859 --- /dev/null +++ b/spec/models/job_locale_reopen_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::JobLocaleReopen +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'JobLocaleReopen' do + before do + # run before each test + @instance = Phrase::JobLocaleReopen.new + end + + after do + # run after each test + end + + describe 'test an instance of JobLocaleReopen' do + it 'should create an instance of JobLocaleReopen' do + expect(@instance).to be_instance_of(Phrase::JobLocaleReopen) + end + end + describe 'test attribute "branch"' 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/job_locale_show_spec.rb b/spec/models/job_locale_show_spec.rb new file mode 100644 index 0000000..ef6b45c --- /dev/null +++ b/spec/models/job_locale_show_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::JobLocaleShow +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'JobLocaleShow' do + before do + # run before each test + @instance = Phrase::JobLocaleShow.new + end + + after do + # run after each test + end + + describe 'test an instance of JobLocaleShow' do + it 'should create an instance of JobLocaleShow' do + expect(@instance).to be_instance_of(Phrase::JobLocaleShow) + end + end + describe 'test attribute "branch"' 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/job_locale_spec.rb b/spec/models/job_locale_spec.rb new file mode 100644 index 0000000..62f5b58 --- /dev/null +++ b/spec/models/job_locale_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::JobLocale +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'JobLocale' do + before do + # run before each test + @instance = Phrase::JobLocale.new + end + + after do + # run after each test + end + + describe 'test an instance of JobLocale' do + it 'should create an instance of JobLocale' do + expect(@instance).to be_instance_of(Phrase::JobLocale) + 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 + + describe 'test attribute "job"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "locale"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "users"' 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/job_locale_update_spec.rb b/spec/models/job_locale_update_spec.rb new file mode 100644 index 0000000..ffd1cb9 --- /dev/null +++ b/spec/models/job_locale_update_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::JobLocaleUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'JobLocaleUpdate' do + before do + # run before each test + @instance = Phrase::JobLocaleUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of JobLocaleUpdate' do + it 'should create an instance of JobLocaleUpdate' do + expect(@instance).to be_instance_of(Phrase::JobLocaleUpdate) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "locale_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "user_ids"' 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/job_locales_create_spec.rb b/spec/models/job_locales_create_spec.rb new file mode 100644 index 0000000..aaea95b --- /dev/null +++ b/spec/models/job_locales_create_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::JobLocalesCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'JobLocalesCreate' do + before do + # run before each test + @instance = Phrase::JobLocalesCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of JobLocalesCreate' do + it 'should create an instance of JobLocalesCreate' do + expect(@instance).to be_instance_of(Phrase::JobLocalesCreate) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "locale_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "user_ids"' 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/job_locales_list_spec.rb b/spec/models/job_locales_list_spec.rb new file mode 100644 index 0000000..6674587 --- /dev/null +++ b/spec/models/job_locales_list_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::JobLocalesList +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'JobLocalesList' do + before do + # run before each test + @instance = Phrase::JobLocalesList.new + end + + after do + # run after each test + end + + describe 'test an instance of JobLocalesList' do + it 'should create an instance of JobLocalesList' do + expect(@instance).to be_instance_of(Phrase::JobLocalesList) + end + end + describe 'test attribute "branch"' 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/job_preview_spec.rb b/spec/models/job_preview_spec.rb new file mode 100644 index 0000000..799f622 --- /dev/null +++ b/spec/models/job_preview_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::JobPreview +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'JobPreview' do + before do + # run before each test + @instance = Phrase::JobPreview.new + end + + after do + # run after each test + end + + describe 'test an instance of JobPreview' do + it 'should create an instance of JobPreview' do + expect(@instance).to be_instance_of(Phrase::JobPreview) + 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 + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "state"' 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/job_reopen_spec.rb b/spec/models/job_reopen_spec.rb new file mode 100644 index 0000000..baf6fe1 --- /dev/null +++ b/spec/models/job_reopen_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::JobReopen +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'JobReopen' do + before do + # run before each test + @instance = Phrase::JobReopen.new + end + + after do + # run after each test + end + + describe 'test an instance of JobReopen' do + it 'should create an instance of JobReopen' do + expect(@instance).to be_instance_of(Phrase::JobReopen) + end + end + describe 'test attribute "branch"' 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/job_show_spec.rb b/spec/models/job_show_spec.rb new file mode 100644 index 0000000..c379669 --- /dev/null +++ b/spec/models/job_show_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::JobShow +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'JobShow' do + before do + # run before each test + @instance = Phrase::JobShow.new + end + + after do + # run after each test + end + + describe 'test an instance of JobShow' do + it 'should create an instance of JobShow' do + expect(@instance).to be_instance_of(Phrase::JobShow) + end + end + describe 'test attribute "branch"' 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/job_spec.rb b/spec/models/job_spec.rb new file mode 100644 index 0000000..71e49e7 --- /dev/null +++ b/spec/models/job_spec.rb @@ -0,0 +1,65 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Job +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Job' do + before do + # run before each test + @instance = Phrase::Job.new + end + + after do + # run after each test + end + + describe 'test an instance of Job' do + it 'should create an instance of Job' do + expect(@instance).to be_instance_of(Phrase::Job) + 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 + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "briefing"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "due_date"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "state"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' 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/job_start_spec.rb b/spec/models/job_start_spec.rb new file mode 100644 index 0000000..899a6a6 --- /dev/null +++ b/spec/models/job_start_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::JobStart +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'JobStart' do + before do + # run before each test + @instance = Phrase::JobStart.new + end + + after do + # run after each test + end + + describe 'test an instance of JobStart' do + it 'should create an instance of JobStart' do + expect(@instance).to be_instance_of(Phrase::JobStart) + end + end + describe 'test attribute "branch"' 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/job_update_spec.rb b/spec/models/job_update_spec.rb new file mode 100644 index 0000000..2381aa6 --- /dev/null +++ b/spec/models/job_update_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::JobUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'JobUpdate' do + before do + # run before each test + @instance = Phrase::JobUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of JobUpdate' do + it 'should create an instance of JobUpdate' do + expect(@instance).to be_instance_of(Phrase::JobUpdate) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "briefing"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "due_date"' 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/jobs_list_spec.rb b/spec/models/jobs_list_spec.rb new file mode 100644 index 0000000..a38c087 --- /dev/null +++ b/spec/models/jobs_list_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::JobsList +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'JobsList' do + before do + # run before each test + @instance = Phrase::JobsList.new + end + + after do + # run after each test + end + + describe 'test an instance of JobsList' do + it 'should create an instance of JobsList' do + expect(@instance).to be_instance_of(Phrase::JobsList) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "owned_by"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "assigned_to"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "state"' 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/key_create_spec.rb b/spec/models/key_create_spec.rb new file mode 100644 index 0000000..c5325e0 --- /dev/null +++ b/spec/models/key_create_spec.rb @@ -0,0 +1,113 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::KeyCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'KeyCreate' do + before do + # run before each test + @instance = Phrase::KeyCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of KeyCreate' do + it 'should create an instance of KeyCreate' do + expect(@instance).to be_instance_of(Phrase::KeyCreate) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "plural"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name_plural"' 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_type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "tags"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "max_characters_allowed"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "screenshot"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "remove_screenshot"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "unformatted"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "xml_space_preserve"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "original_file"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "localized_format_string"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "localized_format_key"' 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/key_delete_spec.rb b/spec/models/key_delete_spec.rb new file mode 100644 index 0000000..bc73aed --- /dev/null +++ b/spec/models/key_delete_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::KeyDelete +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'KeyDelete' do + before do + # run before each test + @instance = Phrase::KeyDelete.new + end + + after do + # run after each test + end + + describe 'test an instance of KeyDelete' do + it 'should create an instance of KeyDelete' do + expect(@instance).to be_instance_of(Phrase::KeyDelete) + end + end + describe 'test attribute "branch"' 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/key_preview_spec.rb b/spec/models/key_preview_spec.rb new file mode 100644 index 0000000..1e3e96e --- /dev/null +++ b/spec/models/key_preview_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::KeyPreview +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'KeyPreview' do + before do + # run before each test + @instance = Phrase::KeyPreview.new + end + + after do + # run after each test + end + + describe 'test an instance of KeyPreview' do + it 'should create an instance of KeyPreview' do + expect(@instance).to be_instance_of(Phrase::KeyPreview) + 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 + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "plural"' 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/key_show_spec.rb b/spec/models/key_show_spec.rb new file mode 100644 index 0000000..f66b734 --- /dev/null +++ b/spec/models/key_show_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::KeyShow +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'KeyShow' do + before do + # run before each test + @instance = Phrase::KeyShow.new + end + + after do + # run after each test + end + + describe 'test an instance of KeyShow' do + it 'should create an instance of KeyShow' do + expect(@instance).to be_instance_of(Phrase::KeyShow) + end + end + describe 'test attribute "branch"' 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/key_update_spec.rb b/spec/models/key_update_spec.rb new file mode 100644 index 0000000..2710d47 --- /dev/null +++ b/spec/models/key_update_spec.rb @@ -0,0 +1,113 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::KeyUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'KeyUpdate' do + before do + # run before each test + @instance = Phrase::KeyUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of KeyUpdate' do + it 'should create an instance of KeyUpdate' do + expect(@instance).to be_instance_of(Phrase::KeyUpdate) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "plural"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name_plural"' 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_type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "tags"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "max_characters_allowed"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "screenshot"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "remove_screenshot"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "unformatted"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "xml_space_preserve"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "original_file"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "localized_format_string"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "localized_format_key"' 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/keys_delete_spec.rb b/spec/models/keys_delete_spec.rb new file mode 100644 index 0000000..a03cac5 --- /dev/null +++ b/spec/models/keys_delete_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::KeysDelete +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'KeysDelete' do + before do + # run before each test + @instance = Phrase::KeysDelete.new + end + + after do + # run after each test + end + + describe 'test an instance of KeysDelete' do + it 'should create an instance of KeysDelete' do + expect(@instance).to be_instance_of(Phrase::KeysDelete) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "q"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "locale_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/keys_list_spec.rb b/spec/models/keys_list_spec.rb new file mode 100644 index 0000000..ead05cb --- /dev/null +++ b/spec/models/keys_list_spec.rb @@ -0,0 +1,53 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::KeysList +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'KeysList' do + before do + # run before each test + @instance = Phrase::KeysList.new + end + + after do + # run after each test + end + + describe 'test an instance of KeysList' do + it 'should create an instance of KeysList' do + expect(@instance).to be_instance_of(Phrase::KeysList) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "order"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "q"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "locale_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/keys_search_spec.rb b/spec/models/keys_search_spec.rb new file mode 100644 index 0000000..4b055ee --- /dev/null +++ b/spec/models/keys_search_spec.rb @@ -0,0 +1,53 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::KeysSearch +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'KeysSearch' do + before do + # run before each test + @instance = Phrase::KeysSearch.new + end + + after do + # run after each test + end + + describe 'test an instance of KeysSearch' do + it 'should create an instance of KeysSearch' do + expect(@instance).to be_instance_of(Phrase::KeysSearch) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "order"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "q"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "locale_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/keys_tag_spec.rb b/spec/models/keys_tag_spec.rb new file mode 100644 index 0000000..1f2769b --- /dev/null +++ b/spec/models/keys_tag_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::KeysTag +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'KeysTag' do + before do + # run before each test + @instance = Phrase::KeysTag.new + end + + after do + # run after each test + end + + describe 'test an instance of KeysTag' do + it 'should create an instance of KeysTag' do + expect(@instance).to be_instance_of(Phrase::KeysTag) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "q"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "locale_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "tags"' 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/keys_untag_spec.rb b/spec/models/keys_untag_spec.rb new file mode 100644 index 0000000..2de3366 --- /dev/null +++ b/spec/models/keys_untag_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::KeysUntag +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'KeysUntag' do + before do + # run before each test + @instance = Phrase::KeysUntag.new + end + + after do + # run after each test + end + + describe 'test an instance of KeysUntag' do + it 'should create an instance of KeysUntag' do + expect(@instance).to be_instance_of(Phrase::KeysUntag) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "q"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "locale_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "tags"' 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/locale_create_spec.rb b/spec/models/locale_create_spec.rb new file mode 100644 index 0000000..065102e --- /dev/null +++ b/spec/models/locale_create_spec.rb @@ -0,0 +1,83 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::LocaleCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'LocaleCreate' do + before do + # run before each test + @instance = Phrase::LocaleCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of LocaleCreate' do + it 'should create an instance of LocaleCreate' do + expect(@instance).to be_instance_of(Phrase::LocaleCreate) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name"' 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 "default"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "main"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "rtl"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "source_locale_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "unverify_new_translations"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "unverify_updated_translations"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "autotranslate"' 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/locale_delete_spec.rb b/spec/models/locale_delete_spec.rb new file mode 100644 index 0000000..18d2bf0 --- /dev/null +++ b/spec/models/locale_delete_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::LocaleDelete +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'LocaleDelete' do + before do + # run before each test + @instance = Phrase::LocaleDelete.new + end + + after do + # run after each test + end + + describe 'test an instance of LocaleDelete' do + it 'should create an instance of LocaleDelete' do + expect(@instance).to be_instance_of(Phrase::LocaleDelete) + end + end + describe 'test attribute "branch"' 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/locale_download_spec.rb b/spec/models/locale_download_spec.rb new file mode 100644 index 0000000..b80cf2b --- /dev/null +++ b/spec/models/locale_download_spec.rb @@ -0,0 +1,107 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::LocaleDownload +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'LocaleDownload' do + before do + # run before each test + @instance = Phrase::LocaleDownload.new + end + + after do + # run after each test + end + + describe 'test an instance of LocaleDownload' do + it 'should create an instance of LocaleDownload' do + expect(@instance).to be_instance_of(Phrase::LocaleDownload) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "file_format"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "tags"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "tag"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "include_empty_translations"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "include_translated_keys"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "keep_notranslate_tags"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "convert_emoji"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "format_options"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "encoding"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "skip_unverified_translations"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "include_unverified_translations"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "use_last_reviewed_version"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "fallback_locale_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/locale_preview_spec.rb b/spec/models/locale_preview_spec.rb new file mode 100644 index 0000000..6adce9d --- /dev/null +++ b/spec/models/locale_preview_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::LocalePreview +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'LocalePreview' do + before do + # run before each test + @instance = Phrase::LocalePreview.new + end + + after do + # run after each test + end + + describe 'test an instance of LocalePreview' do + it 'should create an instance of LocalePreview' do + expect(@instance).to be_instance_of(Phrase::LocalePreview) + 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 + + describe 'test attribute "name"' 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/locale_show_spec.rb b/spec/models/locale_show_spec.rb new file mode 100644 index 0000000..fd884e2 --- /dev/null +++ b/spec/models/locale_show_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::LocaleShow +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'LocaleShow' do + before do + # run before each test + @instance = Phrase::LocaleShow.new + end + + after do + # run after each test + end + + describe 'test an instance of LocaleShow' do + it 'should create an instance of LocaleShow' do + expect(@instance).to be_instance_of(Phrase::LocaleShow) + end + end + describe 'test attribute "branch"' 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/locale_spec.rb b/spec/models/locale_spec.rb new file mode 100644 index 0000000..e5622a9 --- /dev/null +++ b/spec/models/locale_spec.rb @@ -0,0 +1,83 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Locale +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Locale' do + before do + # run before each test + @instance = Phrase::Locale.new + end + + after do + # run after each test + end + + describe 'test an instance of Locale' do + it 'should create an instance of Locale' do + expect(@instance).to be_instance_of(Phrase::Locale) + 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 + + describe 'test attribute "name"' 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 "default"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "main"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "rtl"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "plural_forms"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "source_locale"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' 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/locale_update_spec.rb b/spec/models/locale_update_spec.rb new file mode 100644 index 0000000..6e128b4 --- /dev/null +++ b/spec/models/locale_update_spec.rb @@ -0,0 +1,83 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::LocaleUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'LocaleUpdate' do + before do + # run before each test + @instance = Phrase::LocaleUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of LocaleUpdate' do + it 'should create an instance of LocaleUpdate' do + expect(@instance).to be_instance_of(Phrase::LocaleUpdate) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name"' 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 "default"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "main"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "rtl"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "source_locale_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "unverify_new_translations"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "unverify_updated_translations"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "autotranslate"' 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/locales_list_spec.rb b/spec/models/locales_list_spec.rb new file mode 100644 index 0000000..f543e8a --- /dev/null +++ b/spec/models/locales_list_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::LocalesList +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'LocalesList' do + before do + # run before each test + @instance = Phrase::LocalesList.new + end + + after do + # run after each test + end + + describe 'test an instance of LocalesList' do + it 'should create an instance of LocalesList' do + expect(@instance).to be_instance_of(Phrase::LocalesList) + end + end + describe 'test attribute "branch"' 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/member_spec.rb b/spec/models/member_spec.rb new file mode 100644 index 0000000..0744900 --- /dev/null +++ b/spec/models/member_spec.rb @@ -0,0 +1,53 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Member +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Member' do + before do + # run before each test + @instance = Phrase::Member.new + end + + after do + # run after each test + end + + describe 'test an instance of Member' do + it 'should create an instance of Member' do + expect(@instance).to be_instance_of(Phrase::Member) + 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 + + describe 'test attribute "email"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "username"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "role"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "projects"' 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/member_update_spec.rb b/spec/models/member_update_spec.rb new file mode 100644 index 0000000..deb86e2 --- /dev/null +++ b/spec/models/member_update_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::MemberUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'MemberUpdate' do + before do + # run before each test + @instance = Phrase::MemberUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of MemberUpdate' do + it 'should create an instance of MemberUpdate' do + expect(@instance).to be_instance_of(Phrase::MemberUpdate) + end + end + describe 'test attribute "role"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "project_ids"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "locale_ids"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "permissions"' 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/order_confirm_spec.rb b/spec/models/order_confirm_spec.rb new file mode 100644 index 0000000..f28dda2 --- /dev/null +++ b/spec/models/order_confirm_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::OrderConfirm +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'OrderConfirm' do + before do + # run before each test + @instance = Phrase::OrderConfirm.new + end + + after do + # run after each test + end + + describe 'test an instance of OrderConfirm' do + it 'should create an instance of OrderConfirm' do + expect(@instance).to be_instance_of(Phrase::OrderConfirm) + end + end + describe 'test attribute "branch"' 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/order_create_spec.rb b/spec/models/order_create_spec.rb new file mode 100644 index 0000000..e55183c --- /dev/null +++ b/spec/models/order_create_spec.rb @@ -0,0 +1,107 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::OrderCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'OrderCreate' do + before do + # run before each test + @instance = Phrase::OrderCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of OrderCreate' do + it 'should create an instance of OrderCreate' do + expect(@instance).to be_instance_of(Phrase::OrderCreate) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "lsp"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "source_locale_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "target_locale_ids"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "translation_type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "tag"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + 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 "styleguide_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "unverify_translations_upon_delivery"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "include_untranslated_keys"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "include_unverified_translations"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "category"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "quality"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "priority"' 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/order_delete_spec.rb b/spec/models/order_delete_spec.rb new file mode 100644 index 0000000..a893e79 --- /dev/null +++ b/spec/models/order_delete_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::OrderDelete +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'OrderDelete' do + before do + # run before each test + @instance = Phrase::OrderDelete.new + end + + after do + # run after each test + end + + describe 'test an instance of OrderDelete' do + it 'should create an instance of OrderDelete' do + expect(@instance).to be_instance_of(Phrase::OrderDelete) + end + end + describe 'test attribute "branch"' 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/order_show_spec.rb b/spec/models/order_show_spec.rb new file mode 100644 index 0000000..faa9338 --- /dev/null +++ b/spec/models/order_show_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::OrderShow +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'OrderShow' do + before do + # run before each test + @instance = Phrase::OrderShow.new + end + + after do + # run after each test + end + + describe 'test an instance of OrderShow' do + it 'should create an instance of OrderShow' do + expect(@instance).to be_instance_of(Phrase::OrderShow) + end + end + describe 'test attribute "branch"' 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/orders_list_spec.rb b/spec/models/orders_list_spec.rb new file mode 100644 index 0000000..e5ff3cc --- /dev/null +++ b/spec/models/orders_list_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::OrdersList +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'OrdersList' do + before do + # run before each test + @instance = Phrase::OrdersList.new + end + + after do + # run after each test + end + + describe 'test an instance of OrdersList' do + it 'should create an instance of OrdersList' do + expect(@instance).to be_instance_of(Phrase::OrdersList) + end + end + describe 'test attribute "branch"' 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/project_create_spec.rb b/spec/models/project_create_spec.rb new file mode 100644 index 0000000..7823f38 --- /dev/null +++ b/spec/models/project_create_spec.rb @@ -0,0 +1,59 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::ProjectCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ProjectCreate' do + before do + # run before each test + @instance = Phrase::ProjectCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of ProjectCreate' do + it 'should create an instance of ProjectCreate' do + expect(@instance).to be_instance_of(Phrase::ProjectCreate) + end + end + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "main_format"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "shares_translation_memory"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "project_image"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "remove_project_image"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "account_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/project_short_spec.rb b/spec/models/project_short_spec.rb new file mode 100644 index 0000000..2cfb40b --- /dev/null +++ b/spec/models/project_short_spec.rb @@ -0,0 +1,53 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::ProjectShort +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ProjectShort' do + before do + # run before each test + @instance = Phrase::ProjectShort.new + end + + after do + # run after each test + end + + describe 'test an instance of ProjectShort' do + it 'should create an instance of ProjectShort' do + expect(@instance).to be_instance_of(Phrase::ProjectShort) + 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 + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "main_format"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' 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/project_spec.rb b/spec/models/project_spec.rb new file mode 100644 index 0000000..807916e --- /dev/null +++ b/spec/models/project_spec.rb @@ -0,0 +1,65 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Project +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Project' do + before do + # run before each test + @instance = Phrase::Project.new + end + + after do + # run after each test + end + + describe 'test an instance of Project' do + it 'should create an instance of Project' do + expect(@instance).to be_instance_of(Phrase::Project) + 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 + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "main_format"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "project_image_url"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "account"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' 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/project_update_spec.rb b/spec/models/project_update_spec.rb new file mode 100644 index 0000000..e6e6e03 --- /dev/null +++ b/spec/models/project_update_spec.rb @@ -0,0 +1,59 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::ProjectUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ProjectUpdate' do + before do + # run before each test + @instance = Phrase::ProjectUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of ProjectUpdate' do + it 'should create an instance of ProjectUpdate' do + expect(@instance).to be_instance_of(Phrase::ProjectUpdate) + end + end + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "main_format"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "shares_translation_memory"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "project_image"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "remove_project_image"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "account_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/release_create_spec.rb b/spec/models/release_create_spec.rb new file mode 100644 index 0000000..c644721 --- /dev/null +++ b/spec/models/release_create_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::ReleaseCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ReleaseCreate' do + before do + # run before each test + @instance = Phrase::ReleaseCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of ReleaseCreate' do + it 'should create an instance of ReleaseCreate' do + expect(@instance).to be_instance_of(Phrase::ReleaseCreate) + end + end + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "platforms"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "branch"' 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/release_preview_spec.rb b/spec/models/release_preview_spec.rb new file mode 100644 index 0000000..9b019bf --- /dev/null +++ b/spec/models/release_preview_spec.rb @@ -0,0 +1,89 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::ReleasePreview +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ReleasePreview' do + before do + # run before each test + @instance = Phrase::ReleasePreview.new + end + + after do + # run after each test + end + + describe 'test an instance of ReleasePreview' do + it 'should create an instance of ReleasePreview' do + expect(@instance).to be_instance_of(Phrase::ReleasePreview) + 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 + + describe 'test attribute "version"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "app_min_version"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "app_max_version"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "platforms"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "environments"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "locale_codes"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "project"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' 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/release_spec.rb b/spec/models/release_spec.rb new file mode 100644 index 0000000..033570c --- /dev/null +++ b/spec/models/release_spec.rb @@ -0,0 +1,89 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Release +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Release' do + before do + # run before each test + @instance = Phrase::Release.new + end + + after do + # run after each test + end + + describe 'test an instance of Release' do + it 'should create an instance of Release' do + expect(@instance).to be_instance_of(Phrase::Release) + 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 + + describe 'test attribute "version"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "app_min_version"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "app_max_version"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "platforms"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "environments"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "locales"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "project"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' 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/release_update_spec.rb b/spec/models/release_update_spec.rb new file mode 100644 index 0000000..273f810 --- /dev/null +++ b/spec/models/release_update_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::ReleaseUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ReleaseUpdate' do + before do + # run before each test + @instance = Phrase::ReleaseUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of ReleaseUpdate' do + it 'should create an instance of ReleaseUpdate' do + expect(@instance).to be_instance_of(Phrase::ReleaseUpdate) + end + end + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "platforms"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "branch"' 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/screenshot_create_spec.rb b/spec/models/screenshot_create_spec.rb new file mode 100644 index 0000000..0d187ac --- /dev/null +++ b/spec/models/screenshot_create_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::ScreenshotCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ScreenshotCreate' do + before do + # run before each test + @instance = Phrase::ScreenshotCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of ScreenshotCreate' do + it 'should create an instance of ScreenshotCreate' do + expect(@instance).to be_instance_of(Phrase::ScreenshotCreate) + end + end + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "filename"' 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/screenshot_marker_create_spec.rb b/spec/models/screenshot_marker_create_spec.rb new file mode 100644 index 0000000..078fd4d --- /dev/null +++ b/spec/models/screenshot_marker_create_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::ScreenshotMarkerCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ScreenshotMarkerCreate' do + before do + # run before each test + @instance = Phrase::ScreenshotMarkerCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of ScreenshotMarkerCreate' do + it 'should create an instance of ScreenshotMarkerCreate' do + expect(@instance).to be_instance_of(Phrase::ScreenshotMarkerCreate) + end + end + describe 'test attribute "key_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "presentation"' 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/screenshot_marker_spec.rb b/spec/models/screenshot_marker_spec.rb new file mode 100644 index 0000000..f783365 --- /dev/null +++ b/spec/models/screenshot_marker_spec.rb @@ -0,0 +1,59 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::ScreenshotMarker +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ScreenshotMarker' do + before do + # run before each test + @instance = Phrase::ScreenshotMarker.new + end + + after do + # run after each test + end + + describe 'test an instance of ScreenshotMarker' do + it 'should create an instance of ScreenshotMarker' do + expect(@instance).to be_instance_of(Phrase::ScreenshotMarker) + 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 + + describe 'test attribute "presentation"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "presentation_type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "translation_key"' 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/screenshot_marker_update_spec.rb b/spec/models/screenshot_marker_update_spec.rb new file mode 100644 index 0000000..3f096ba --- /dev/null +++ b/spec/models/screenshot_marker_update_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::ScreenshotMarkerUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ScreenshotMarkerUpdate' do + before do + # run before each test + @instance = Phrase::ScreenshotMarkerUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of ScreenshotMarkerUpdate' do + it 'should create an instance of ScreenshotMarkerUpdate' do + expect(@instance).to be_instance_of(Phrase::ScreenshotMarkerUpdate) + end + end + describe 'test attribute "key_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "presentation"' 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/screenshot_spec.rb b/spec/models/screenshot_spec.rb new file mode 100644 index 0000000..2c9b671 --- /dev/null +++ b/spec/models/screenshot_spec.rb @@ -0,0 +1,65 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Screenshot +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Screenshot' do + before do + # run before each test + @instance = Phrase::Screenshot.new + end + + after do + # run after each test + end + + describe 'test an instance of Screenshot' do + it 'should create an instance of Screenshot' do + expect(@instance).to be_instance_of(Phrase::Screenshot) + 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 + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "screenshot_url"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "markers_count"' 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/screenshot_update_spec.rb b/spec/models/screenshot_update_spec.rb new file mode 100644 index 0000000..1806175 --- /dev/null +++ b/spec/models/screenshot_update_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::ScreenshotUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ScreenshotUpdate' do + before do + # run before each test + @instance = Phrase::ScreenshotUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of ScreenshotUpdate' do + it 'should create an instance of ScreenshotUpdate' do + expect(@instance).to be_instance_of(Phrase::ScreenshotUpdate) + end + end + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "filename"' 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/space_create_spec.rb b/spec/models/space_create_spec.rb new file mode 100644 index 0000000..5aecff1 --- /dev/null +++ b/spec/models/space_create_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::SpaceCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'SpaceCreate' do + before do + # run before each test + @instance = Phrase::SpaceCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of SpaceCreate' do + it 'should create an instance of SpaceCreate' do + expect(@instance).to be_instance_of(Phrase::SpaceCreate) + end + end + describe 'test attribute "name"' 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/space_spec.rb b/spec/models/space_spec.rb new file mode 100644 index 0000000..e03343a --- /dev/null +++ b/spec/models/space_spec.rb @@ -0,0 +1,59 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Space +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Space' do + before do + # run before each test + @instance = Phrase::Space.new + end + + after do + # run after each test + end + + describe 'test an instance of Space' do + it 'should create an instance of Space' do + expect(@instance).to be_instance_of(Phrase::Space) + 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 + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "projects_count"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "projects"' 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/space_update_spec.rb b/spec/models/space_update_spec.rb new file mode 100644 index 0000000..52ce43c --- /dev/null +++ b/spec/models/space_update_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::SpaceUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'SpaceUpdate' do + before do + # run before each test + @instance = Phrase::SpaceUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of SpaceUpdate' do + it 'should create an instance of SpaceUpdate' do + expect(@instance).to be_instance_of(Phrase::SpaceUpdate) + end + end + describe 'test attribute "name"' 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/spaces_projects_create_spec.rb b/spec/models/spaces_projects_create_spec.rb new file mode 100644 index 0000000..e2fc1b0 --- /dev/null +++ b/spec/models/spaces_projects_create_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::SpacesProjectsCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'SpacesProjectsCreate' do + before do + # run before each test + @instance = Phrase::SpacesProjectsCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of SpacesProjectsCreate' do + it 'should create an instance of SpacesProjectsCreate' do + expect(@instance).to be_instance_of(Phrase::SpacesProjectsCreate) + 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/styleguide_create_spec.rb b/spec/models/styleguide_create_spec.rb new file mode 100644 index 0000000..2b959e9 --- /dev/null +++ b/spec/models/styleguide_create_spec.rb @@ -0,0 +1,101 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::StyleguideCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'StyleguideCreate' do + before do + # run before each test + @instance = Phrase::StyleguideCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of StyleguideCreate' do + it 'should create an instance of StyleguideCreate' do + expect(@instance).to be_instance_of(Phrase::StyleguideCreate) + end + end + describe 'test attribute "title"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "audience"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "target_audience"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "grammatical_person"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "vocabulary_type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "business"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "company_branding"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "formatting"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "glossary_terms"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "grammar_consistency"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "literal_translation"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "overall_tone"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "samples"' 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/styleguide_preview_spec.rb b/spec/models/styleguide_preview_spec.rb new file mode 100644 index 0000000..1102ef4 --- /dev/null +++ b/spec/models/styleguide_preview_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::StyleguidePreview +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'StyleguidePreview' do + before do + # run before each test + @instance = Phrase::StyleguidePreview.new + end + + after do + # run after each test + end + + describe 'test an instance of StyleguidePreview' do + it 'should create an instance of StyleguidePreview' do + expect(@instance).to be_instance_of(Phrase::StyleguidePreview) + 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 + + describe 'test attribute "title"' 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/styleguide_spec.rb b/spec/models/styleguide_spec.rb new file mode 100644 index 0000000..2c70339 --- /dev/null +++ b/spec/models/styleguide_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Styleguide +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Styleguide' do + before do + # run before each test + @instance = Phrase::Styleguide.new + end + + after do + # run after each test + end + + describe 'test an instance of Styleguide' do + it 'should create an instance of Styleguide' do + expect(@instance).to be_instance_of(Phrase::Styleguide) + 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 + + describe 'test attribute "title"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' 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/styleguide_update_spec.rb b/spec/models/styleguide_update_spec.rb new file mode 100644 index 0000000..04d8ad1 --- /dev/null +++ b/spec/models/styleguide_update_spec.rb @@ -0,0 +1,101 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::StyleguideUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'StyleguideUpdate' do + before do + # run before each test + @instance = Phrase::StyleguideUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of StyleguideUpdate' do + it 'should create an instance of StyleguideUpdate' do + expect(@instance).to be_instance_of(Phrase::StyleguideUpdate) + end + end + describe 'test attribute "title"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "audience"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "target_audience"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "grammatical_person"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "vocabulary_type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "business"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "company_branding"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "formatting"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "glossary_terms"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "grammar_consistency"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "literal_translation"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "overall_tone"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "samples"' 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/tag_create_spec.rb b/spec/models/tag_create_spec.rb new file mode 100644 index 0000000..9e71ae6 --- /dev/null +++ b/spec/models/tag_create_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TagCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TagCreate' do + before do + # run before each test + @instance = Phrase::TagCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of TagCreate' do + it 'should create an instance of TagCreate' do + expect(@instance).to be_instance_of(Phrase::TagCreate) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name"' 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/tag_delete_spec.rb b/spec/models/tag_delete_spec.rb new file mode 100644 index 0000000..e15968a --- /dev/null +++ b/spec/models/tag_delete_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TagDelete +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TagDelete' do + before do + # run before each test + @instance = Phrase::TagDelete.new + end + + after do + # run after each test + end + + describe 'test an instance of TagDelete' do + it 'should create an instance of TagDelete' do + expect(@instance).to be_instance_of(Phrase::TagDelete) + end + end + describe 'test attribute "branch"' 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/tag_show_spec.rb b/spec/models/tag_show_spec.rb new file mode 100644 index 0000000..3c11067 --- /dev/null +++ b/spec/models/tag_show_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TagShow +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TagShow' do + before do + # run before each test + @instance = Phrase::TagShow.new + end + + after do + # run after each test + end + + describe 'test an instance of TagShow' do + it 'should create an instance of TagShow' do + expect(@instance).to be_instance_of(Phrase::TagShow) + end + end + describe 'test attribute "branch"' 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/tag_spec.rb b/spec/models/tag_spec.rb new file mode 100644 index 0000000..cf87e38 --- /dev/null +++ b/spec/models/tag_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Tag +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Tag' do + before do + # run before each test + @instance = Phrase::Tag.new + end + + after do + # run after each test + end + + describe 'test an instance of Tag' do + it 'should create an instance of Tag' do + expect(@instance).to be_instance_of(Phrase::Tag) + end + end + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "keys_count"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' 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/tags_list_spec.rb b/spec/models/tags_list_spec.rb new file mode 100644 index 0000000..2d7388d --- /dev/null +++ b/spec/models/tags_list_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TagsList +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TagsList' do + before do + # run before each test + @instance = Phrase::TagsList.new + end + + after do + # run after each test + end + + describe 'test an instance of TagsList' do + it 'should create an instance of TagsList' do + expect(@instance).to be_instance_of(Phrase::TagsList) + end + end + describe 'test attribute "branch"' 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/translation_create_spec.rb b/spec/models/translation_create_spec.rb new file mode 100644 index 0000000..3e1ad24 --- /dev/null +++ b/spec/models/translation_create_spec.rb @@ -0,0 +1,71 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TranslationCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TranslationCreate' do + before do + # run before each test + @instance = Phrase::TranslationCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of TranslationCreate' do + it 'should create an instance of TranslationCreate' do + expect(@instance).to be_instance_of(Phrase::TranslationCreate) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "locale_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "key_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "content"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "plural_suffix"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "unverified"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "excluded"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "autotranslate"' 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/translation_exclude_spec.rb b/spec/models/translation_exclude_spec.rb new file mode 100644 index 0000000..b9c2207 --- /dev/null +++ b/spec/models/translation_exclude_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TranslationExclude +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TranslationExclude' do + before do + # run before each test + @instance = Phrase::TranslationExclude.new + end + + after do + # run after each test + end + + describe 'test an instance of TranslationExclude' do + it 'should create an instance of TranslationExclude' do + expect(@instance).to be_instance_of(Phrase::TranslationExclude) + end + end + describe 'test attribute "branch"' 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/translation_include_spec.rb b/spec/models/translation_include_spec.rb new file mode 100644 index 0000000..47c2797 --- /dev/null +++ b/spec/models/translation_include_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TranslationInclude +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TranslationInclude' do + before do + # run before each test + @instance = Phrase::TranslationInclude.new + end + + after do + # run after each test + end + + describe 'test an instance of TranslationInclude' do + it 'should create an instance of TranslationInclude' do + expect(@instance).to be_instance_of(Phrase::TranslationInclude) + end + end + describe 'test attribute "branch"' 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/translation_key_spec.rb b/spec/models/translation_key_spec.rb new file mode 100644 index 0000000..e8c6353 --- /dev/null +++ b/spec/models/translation_key_spec.rb @@ -0,0 +1,77 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TranslationKey +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TranslationKey' do + before do + # run before each test + @instance = Phrase::TranslationKey.new + end + + after do + # run after each test + end + + describe 'test an instance of TranslationKey' do + it 'should create an instance of TranslationKey' do + expect(@instance).to be_instance_of(Phrase::TranslationKey) + 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 + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name_hash"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "plural"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "tags"' 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_type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' 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/translation_order_spec.rb b/spec/models/translation_order_spec.rb new file mode 100644 index 0000000..7a1d2f3 --- /dev/null +++ b/spec/models/translation_order_spec.rb @@ -0,0 +1,125 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TranslationOrder +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TranslationOrder' do + before do + # run before each test + @instance = Phrase::TranslationOrder.new + end + + after do + # run after each test + end + + describe 'test an instance of TranslationOrder' do + it 'should create an instance of TranslationOrder' do + expect(@instance).to be_instance_of(Phrase::TranslationOrder) + 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 + + describe 'test attribute "lsp"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "amount_in_cents"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "currency"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + 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 "state"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "translation_type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "progress_percent"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "source_locale"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "target_locales"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "tag"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "styleguide"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "unverify_translations_upon_delivery"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "quality"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "priority"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' 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/translation_review_spec.rb b/spec/models/translation_review_spec.rb new file mode 100644 index 0000000..e93b6c7 --- /dev/null +++ b/spec/models/translation_review_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TranslationReview +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TranslationReview' do + before do + # run before each test + @instance = Phrase::TranslationReview.new + end + + after do + # run after each test + end + + describe 'test an instance of TranslationReview' do + it 'should create an instance of TranslationReview' do + expect(@instance).to be_instance_of(Phrase::TranslationReview) + end + end + describe 'test attribute "branch"' 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/translation_show_spec.rb b/spec/models/translation_show_spec.rb new file mode 100644 index 0000000..6b827bb --- /dev/null +++ b/spec/models/translation_show_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TranslationShow +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TranslationShow' do + before do + # run before each test + @instance = Phrase::TranslationShow.new + end + + after do + # run after each test + end + + describe 'test an instance of TranslationShow' do + it 'should create an instance of TranslationShow' do + expect(@instance).to be_instance_of(Phrase::TranslationShow) + end + end + describe 'test attribute "branch"' 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/translation_spec.rb b/spec/models/translation_spec.rb new file mode 100644 index 0000000..4b991c7 --- /dev/null +++ b/spec/models/translation_spec.rb @@ -0,0 +1,89 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Translation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Translation' do + before do + # run before each test + @instance = Phrase::Translation.new + end + + after do + # run after each test + end + + describe 'test an instance of Translation' do + it 'should create an instance of Translation' do + expect(@instance).to be_instance_of(Phrase::Translation) + 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 + + describe 'test attribute "content"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "unverified"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "excluded"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "plural_suffix"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "key"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "locale"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "placeholders"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "state"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' 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/translation_unverify_spec.rb b/spec/models/translation_unverify_spec.rb new file mode 100644 index 0000000..9f1ac47 --- /dev/null +++ b/spec/models/translation_unverify_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TranslationUnverify +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TranslationUnverify' do + before do + # run before each test + @instance = Phrase::TranslationUnverify.new + end + + after do + # run after each test + end + + describe 'test an instance of TranslationUnverify' do + it 'should create an instance of TranslationUnverify' do + expect(@instance).to be_instance_of(Phrase::TranslationUnverify) + end + end + describe 'test attribute "branch"' 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/translation_update_spec.rb b/spec/models/translation_update_spec.rb new file mode 100644 index 0000000..dcfeba6 --- /dev/null +++ b/spec/models/translation_update_spec.rb @@ -0,0 +1,59 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TranslationUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TranslationUpdate' do + before do + # run before each test + @instance = Phrase::TranslationUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of TranslationUpdate' do + it 'should create an instance of TranslationUpdate' do + expect(@instance).to be_instance_of(Phrase::TranslationUpdate) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "content"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "plural_suffix"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "unverified"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "excluded"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "autotranslate"' 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/translation_verify_spec.rb b/spec/models/translation_verify_spec.rb new file mode 100644 index 0000000..dd66839 --- /dev/null +++ b/spec/models/translation_verify_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TranslationVerify +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TranslationVerify' do + before do + # run before each test + @instance = Phrase::TranslationVerify.new + end + + after do + # run after each test + end + + describe 'test an instance of TranslationVerify' do + it 'should create an instance of TranslationVerify' do + expect(@instance).to be_instance_of(Phrase::TranslationVerify) + end + end + describe 'test attribute "branch"' 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/translation_version_spec.rb b/spec/models/translation_version_spec.rb new file mode 100644 index 0000000..ee002f7 --- /dev/null +++ b/spec/models/translation_version_spec.rb @@ -0,0 +1,71 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TranslationVersion +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TranslationVersion' do + before do + # run before each test + @instance = Phrase::TranslationVersion.new + end + + after do + # run after each test + end + + describe 'test an instance of TranslationVersion' do + it 'should create an instance of TranslationVersion' do + expect(@instance).to be_instance_of(Phrase::TranslationVersion) + 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 + + describe 'test attribute "content"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "plural_suffix"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "key"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "locale"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "changed_at"' 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/translations_by_key_spec.rb b/spec/models/translations_by_key_spec.rb new file mode 100644 index 0000000..0f79518 --- /dev/null +++ b/spec/models/translations_by_key_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TranslationsByKey +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TranslationsByKey' do + before do + # run before each test + @instance = Phrase::TranslationsByKey.new + end + + after do + # run after each test + end + + describe 'test an instance of TranslationsByKey' do + it 'should create an instance of TranslationsByKey' do + expect(@instance).to be_instance_of(Phrase::TranslationsByKey) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "order"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "q"' 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/translations_by_locale_spec.rb b/spec/models/translations_by_locale_spec.rb new file mode 100644 index 0000000..73db9fa --- /dev/null +++ b/spec/models/translations_by_locale_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TranslationsByLocale +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TranslationsByLocale' do + before do + # run before each test + @instance = Phrase::TranslationsByLocale.new + end + + after do + # run after each test + end + + describe 'test an instance of TranslationsByLocale' do + it 'should create an instance of TranslationsByLocale' do + expect(@instance).to be_instance_of(Phrase::TranslationsByLocale) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "order"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "q"' 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/translations_exclude_spec.rb b/spec/models/translations_exclude_spec.rb new file mode 100644 index 0000000..7fb631d --- /dev/null +++ b/spec/models/translations_exclude_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TranslationsExclude +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TranslationsExclude' do + before do + # run before each test + @instance = Phrase::TranslationsExclude.new + end + + after do + # run after each test + end + + describe 'test an instance of TranslationsExclude' do + it 'should create an instance of TranslationsExclude' do + expect(@instance).to be_instance_of(Phrase::TranslationsExclude) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "q"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "order"' 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/translations_include_spec.rb b/spec/models/translations_include_spec.rb new file mode 100644 index 0000000..9185319 --- /dev/null +++ b/spec/models/translations_include_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TranslationsInclude +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TranslationsInclude' do + before do + # run before each test + @instance = Phrase::TranslationsInclude.new + end + + after do + # run after each test + end + + describe 'test an instance of TranslationsInclude' do + it 'should create an instance of TranslationsInclude' do + expect(@instance).to be_instance_of(Phrase::TranslationsInclude) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "q"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "order"' 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/translations_list_spec.rb b/spec/models/translations_list_spec.rb new file mode 100644 index 0000000..4ccb9f0 --- /dev/null +++ b/spec/models/translations_list_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TranslationsList +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TranslationsList' do + before do + # run before each test + @instance = Phrase::TranslationsList.new + end + + after do + # run after each test + end + + describe 'test an instance of TranslationsList' do + it 'should create an instance of TranslationsList' do + expect(@instance).to be_instance_of(Phrase::TranslationsList) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "order"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "q"' 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/translations_review_spec.rb b/spec/models/translations_review_spec.rb new file mode 100644 index 0000000..f130d92 --- /dev/null +++ b/spec/models/translations_review_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TranslationsReview +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TranslationsReview' do + before do + # run before each test + @instance = Phrase::TranslationsReview.new + end + + after do + # run after each test + end + + describe 'test an instance of TranslationsReview' do + it 'should create an instance of TranslationsReview' do + expect(@instance).to be_instance_of(Phrase::TranslationsReview) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "q"' 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/translations_search_spec.rb b/spec/models/translations_search_spec.rb new file mode 100644 index 0000000..f6509ca --- /dev/null +++ b/spec/models/translations_search_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TranslationsSearch +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TranslationsSearch' do + before do + # run before each test + @instance = Phrase::TranslationsSearch.new + end + + after do + # run after each test + end + + describe 'test an instance of TranslationsSearch' do + it 'should create an instance of TranslationsSearch' do + expect(@instance).to be_instance_of(Phrase::TranslationsSearch) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "order"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "q"' 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/translations_unverify_spec.rb b/spec/models/translations_unverify_spec.rb new file mode 100644 index 0000000..72d3d8e --- /dev/null +++ b/spec/models/translations_unverify_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TranslationsUnverify +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TranslationsUnverify' do + before do + # run before each test + @instance = Phrase::TranslationsUnverify.new + end + + after do + # run after each test + end + + describe 'test an instance of TranslationsUnverify' do + it 'should create an instance of TranslationsUnverify' do + expect(@instance).to be_instance_of(Phrase::TranslationsUnverify) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "q"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "order"' 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/translations_verify_spec.rb b/spec/models/translations_verify_spec.rb new file mode 100644 index 0000000..da92070 --- /dev/null +++ b/spec/models/translations_verify_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::TranslationsVerify +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TranslationsVerify' do + before do + # run before each test + @instance = Phrase::TranslationsVerify.new + end + + after do + # run after each test + end + + describe 'test an instance of TranslationsVerify' do + it 'should create an instance of TranslationsVerify' do + expect(@instance).to be_instance_of(Phrase::TranslationsVerify) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "q"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "order"' 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/upload_create_spec.rb b/spec/models/upload_create_spec.rb new file mode 100644 index 0000000..edef4a5 --- /dev/null +++ b/spec/models/upload_create_spec.rb @@ -0,0 +1,113 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::UploadCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'UploadCreate' do + before do + # run before each test + @instance = Phrase::UploadCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of UploadCreate' do + it 'should create an instance of UploadCreate' do + expect(@instance).to be_instance_of(Phrase::UploadCreate) + end + end + describe 'test attribute "branch"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "file"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "file_format"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "locale_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "tags"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "update_translations"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "update_descriptions"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "convert_emoji"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "skip_upload_tags"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "skip_unverification"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "file_encoding"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "locale_mapping"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "format_options"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "autotranslate"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "mark_reviewed"' 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/upload_show_spec.rb b/spec/models/upload_show_spec.rb new file mode 100644 index 0000000..987194e --- /dev/null +++ b/spec/models/upload_show_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::UploadShow +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'UploadShow' do + before do + # run before each test + @instance = Phrase::UploadShow.new + end + + after do + # run after each test + end + + describe 'test an instance of UploadShow' do + it 'should create an instance of UploadShow' do + expect(@instance).to be_instance_of(Phrase::UploadShow) + end + end + describe 'test attribute "branch"' 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/upload_spec.rb b/spec/models/upload_spec.rb new file mode 100644 index 0000000..e9f0d1d --- /dev/null +++ b/spec/models/upload_spec.rb @@ -0,0 +1,71 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Upload +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Upload' do + before do + # run before each test + @instance = Phrase::Upload.new + end + + after do + # run after each test + end + + describe 'test an instance of Upload' do + it 'should create an instance of Upload' do + expect(@instance).to be_instance_of(Phrase::Upload) + 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 + + describe 'test attribute "filename"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "format"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "state"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "tag"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "summary"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' 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/upload_summary_spec.rb b/spec/models/upload_summary_spec.rb new file mode 100644 index 0000000..6f69ece --- /dev/null +++ b/spec/models/upload_summary_spec.rb @@ -0,0 +1,71 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::UploadSummary +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'UploadSummary' do + before do + # run before each test + @instance = Phrase::UploadSummary.new + end + + after do + # run after each test + end + + describe 'test an instance of UploadSummary' do + it 'should create an instance of UploadSummary' do + expect(@instance).to be_instance_of(Phrase::UploadSummary) + end + end + describe 'test attribute "locales_created"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "translation_keys_created"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "translation_keys_updated"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "translation_keys_unmentioned"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "translations_created"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "translations_updated"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "tags_created"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "translation_keys_ignored"' 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/uploads_list_spec.rb b/spec/models/uploads_list_spec.rb new file mode 100644 index 0000000..5c3417c --- /dev/null +++ b/spec/models/uploads_list_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::UploadsList +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'UploadsList' do + before do + # run before each test + @instance = Phrase::UploadsList.new + end + + after do + # run after each test + end + + describe 'test an instance of UploadsList' do + it 'should create an instance of UploadsList' do + expect(@instance).to be_instance_of(Phrase::UploadsList) + end + end + describe 'test attribute "branch"' 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/user_preview_spec.rb b/spec/models/user_preview_spec.rb new file mode 100644 index 0000000..b535753 --- /dev/null +++ b/spec/models/user_preview_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::UserPreview +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'UserPreview' do + before do + # run before each test + @instance = Phrase::UserPreview.new + end + + after do + # run after each test + end + + describe 'test an instance of UserPreview' do + it 'should create an instance of UserPreview' do + expect(@instance).to be_instance_of(Phrase::UserPreview) + 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 + + describe 'test attribute "username"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name"' 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/user_spec.rb b/spec/models/user_spec.rb new file mode 100644 index 0000000..cbcb51d --- /dev/null +++ b/spec/models/user_spec.rb @@ -0,0 +1,65 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::User +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'User' do + before do + # run before each test + @instance = Phrase::User.new + end + + after do + # run after each test + end + + describe 'test an instance of User' do + it 'should create an instance of User' do + expect(@instance).to be_instance_of(Phrase::User) + 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 + + describe 'test attribute "username"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "email"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "position"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' 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/version_show_spec.rb b/spec/models/version_show_spec.rb new file mode 100644 index 0000000..f2bdd78 --- /dev/null +++ b/spec/models/version_show_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::VersionShow +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'VersionShow' do + before do + # run before each test + @instance = Phrase::VersionShow.new + end + + after do + # run after each test + end + + describe 'test an instance of VersionShow' do + it 'should create an instance of VersionShow' do + expect(@instance).to be_instance_of(Phrase::VersionShow) + end + end + describe 'test attribute "branch"' 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/versions_list_spec.rb b/spec/models/versions_list_spec.rb new file mode 100644 index 0000000..43d6289 --- /dev/null +++ b/spec/models/versions_list_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::VersionsList +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'VersionsList' do + before do + # run before each test + @instance = Phrase::VersionsList.new + end + + after do + # run after each test + end + + describe 'test an instance of VersionsList' do + it 'should create an instance of VersionsList' do + expect(@instance).to be_instance_of(Phrase::VersionsList) + end + end + describe 'test attribute "branch"' 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/webhook_create_spec.rb b/spec/models/webhook_create_spec.rb new file mode 100644 index 0000000..b780c0d --- /dev/null +++ b/spec/models/webhook_create_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::WebhookCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'WebhookCreate' do + before do + # run before each test + @instance = Phrase::WebhookCreate.new + end + + after do + # run after each test + end + + describe 'test an instance of WebhookCreate' do + it 'should create an instance of WebhookCreate' do + expect(@instance).to be_instance_of(Phrase::WebhookCreate) + end + end + describe 'test attribute "callback_url"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "events"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "active"' 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/webhook_spec.rb b/spec/models/webhook_spec.rb new file mode 100644 index 0000000..41a47dc --- /dev/null +++ b/spec/models/webhook_spec.rb @@ -0,0 +1,65 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::Webhook +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'Webhook' do + before do + # run before each test + @instance = Phrase::Webhook.new + end + + after do + # run after each test + end + + describe 'test an instance of Webhook' do + it 'should create an instance of Webhook' do + expect(@instance).to be_instance_of(Phrase::Webhook) + 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 + + describe 'test attribute "callback_url"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "events"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "active"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' 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/webhook_update_spec.rb b/spec/models/webhook_update_spec.rb new file mode 100644 index 0000000..d4dfc16 --- /dev/null +++ b/spec/models/webhook_update_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::WebhookUpdate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'WebhookUpdate' do + before do + # run before each test + @instance = Phrase::WebhookUpdate.new + end + + after do + # run after each test + end + + describe 'test an instance of WebhookUpdate' do + it 'should create an instance of WebhookUpdate' do + expect(@instance).to be_instance_of(Phrase::WebhookUpdate) + end + end + describe 'test attribute "callback_url"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "events"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "active"' 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/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..24546de --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,99 @@ +# load the gem +require 'Phrase' + +# The following was generated by the `rspec --init` command. Conventionally, all +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. +# The generated `.rspec` file contains `--require spec_helper` which will cause +# this file to always be loaded, without a need to explicitly require it in any +# files. +# +# Given that it is always loaded, you are encouraged to keep this file as +# light-weight as possible. Requiring heavyweight dependencies from this file +# will add to the boot time of your test suite on EVERY test run, even for an +# individual file that may not need all of that loaded. Instead, consider making +# a separate helper file that requires the additional dependencies and performs +# the additional setup, and require it from the spec files that actually need +# it. +# +# The `.rspec` file also contains a few flags that are not defaults but that +# users commonly want. +# +# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration +RSpec.configure do |config| + # rspec-expectations config goes here. You can use an alternate + # assertion/expectation library such as wrong or the stdlib/minitest + # assertions if you prefer. + config.expect_with :rspec do |expectations| + # This option will default to `true` in RSpec 4. It makes the `description` + # and `failure_message` of custom matchers include text for helper methods + # defined using `chain`, e.g.: + # be_bigger_than(2).and_smaller_than(4).description + # # => "be bigger than 2 and smaller than 4" + # ...rather than: + # # => "be bigger than 2" + expectations.include_chain_clauses_in_custom_matcher_descriptions = true + end + + # rspec-mocks config goes here. You can use an alternate test double + # library (such as bogus or mocha) by changing the `mock_with` option here. + config.mock_with :rspec do |mocks| + # Prevents you from mocking or stubbing a method that does not exist on + # a real object. This is generally recommended, and will default to + # `true` in RSpec 4. + mocks.verify_partial_doubles = true + end + +# The settings below are suggested to provide a good initial experience +# with RSpec, but feel free to customize to your heart's content. +=begin + # These two settings work together to allow you to limit a spec run + # to individual examples or groups you care about by tagging them with + # `:focus` metadata. When nothing is tagged with `:focus`, all examples + # get run. + config.filter_run :focus + config.run_all_when_everything_filtered = true + + # Allows RSpec to persist some state between runs in order to support + # the `--only-failures` and `--next-failure` CLI options. We recommend + # you configure your source control system to ignore this file. + config.example_status_persistence_file_path = "spec/examples.txt" + + # Limits the available syntax to the non-monkey patched syntax that is + # recommended. For more details, see: + # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/ + # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ + # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode + config.disable_monkey_patching! + + # This setting enables warnings. It's recommended, but in some cases may + # be too noisy due to issues in dependencies. + config.warnings = true + + # Many RSpec users commonly either run the entire suite or an individual + # file, and it's useful to allow more verbose output when running an + # individual spec file. + if config.files_to_run.one? + # Use the documentation formatter for detailed output, + # unless a formatter has already been configured + # (e.g. via a command-line flag). + config.default_formatter = 'doc' + end + + # Print the 10 slowest examples and example groups at the + # end of the spec run, to help surface which specs are running + # particularly slow. + config.profile_examples = 10 + + # Run specs in random order to surface order dependencies. If you find an + # order dependency and want to debug it, you can fix the order by providing + # the seed, which is printed after each run. + # --seed 1234 + config.order = :random + + # Seed global randomization in this process using the `--seed` CLI option. + # Setting this allows you to use `--seed` to deterministically reproduce + # test failures related to randomization by passing the same `--seed` value + # as the one that triggered the failure. + Kernel.srand config.seed +=end +end