github.com/phrase/openapi@v0.0.0-20240514140800-49e8a106740e/openapi-generator/templates/ruby-client/README.mustache (about)

     1  # {{gemName}}
     2  
     3  {{moduleName}} - the Ruby gem for the {{appName}}
     4  
     5  Phrase Strings 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 Strings for your account.
     6  
     7  ## This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
     8  
     9  - API version: {{appVersion}}
    10  - Package version: {{gemVersion}}
    11  {{^hideGenerationTimestamp}}
    12  - Build date: {{generatedDate}}
    13  {{/hideGenerationTimestamp}}
    14  - Build package: {{generatorClass}}
    15  {{#infoUrl}}
    16  For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
    17  {{/infoUrl}}
    18  
    19  ## Installation
    20  
    21  ### Install from [rubygems.org](https://rubygems.org/)
    22  
    23  Install from the command line:
    24  
    25  ```shell
    26  $ gem install phrase
    27  ```
    28  
    29  Install via Gemfile:
    30  
    31      gem "phrase"
    32  
    33  ### Install from GitHub Packages
    34  
    35  Install from the command line:
    36  
    37  ```shell
    38  $ gem install phrase-ruby --source "https://rubygems.pkg.github.com/phrase"
    39  ```
    40  
    41  Install via Gemfile:
    42  
    43      source "https://rubygems.pkg.github.com/phrase" do
    44        gem "phrase-ruby"
    45      end
    46  
    47  ### Install from Git
    48  
    49  Add the following in the Gemfile:
    50  
    51      gem '{{{gemName}}}', git: 'https://{{gitHost}}/{{#gitUserId}}{{.}}{{/gitUserId}}{{^gitUserId}}YOUR_GIT_USERNAME{{/gitUserId}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}YOUR_GIT_REPO{{/gitRepoId}}.git'
    52  
    53  ### Build and install a gem on your own
    54  
    55  To build the Ruby code into a gem:
    56  
    57  ```shell
    58  gem build {{{gemName}}}.gemspec
    59  ```
    60  
    61  Then install the gem locally:
    62  
    63  ```shell
    64  gem install ./{{{gemName}}}-{{{gemVersion}}}.gem
    65  ```
    66  
    67  (for development, run `gem install --dev ./{{{gemName}}}-{{{gemVersion}}}.gem` to install the development dependencies)
    68  
    69  ## Getting Started
    70  
    71  Please follow the [installation](#installation) procedure and then run the following code:
    72  
    73  ```ruby
    74  # Load the gem
    75  require '{{{gemName}}}'
    76  {{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}
    77  # Setup authorization
    78  {{{moduleName}}}.configure do |config|{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
    79    # Configure HTTP basic authorization: {{{name}}}
    80    config.username = 'YOUR_USERNAME'
    81    config.password = 'YOUR_PASSWORD'{{/isBasicBasic}}{{#isBasicBearer}}
    82    # Or configure Bearer authorization{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}: {{{name}}}
    83    config.access_token = 'YOUR_BEARER_TOKEN'{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
    84    # Or configure API key authorization: {{{name}}}
    85    config.api_key['{{{keyParamName}}}'] = 'YOUR API KEY'
    86    config.api_key_prefix['{{{keyParamName}}}'] = 'token'{{/isApiKey}}{{#isOAuth}}
    87    # Or configure OAuth2 access token for authorization: {{{name}}}
    88    config.access_token = 'YOUR ACCESS TOKEN'{{/isOAuth}}
    89  {{/authMethods}}end
    90  {{/hasAuthMethods}}
    91  
    92  api_instance = {{{moduleName}}}::{{{classname}}}.new
    93  {{#requiredParams}}
    94  {{{paramName}}} = {{{example}}} # {{{dataType}}} | {{{description}}}
    95  {{/requiredParams}}
    96  {{#optionalParams}}
    97  {{#-first}}
    98  opts = {
    99  {{/-first}}
   100    {{{paramName}}}: {{{example}}}{{^-last}},{{/-last}} # {{{dataType}}} | {{{description}}}
   101  {{#-last}}
   102  }
   103  {{/-last}}
   104  {{/optionalParams}}
   105  
   106  begin
   107  {{#summary}}  #{{{.}}}
   108  {{/summary}}  {{#returnType}}result = {{/returnType}}api_instance.{{{operationId}}}{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}{{#returnType}}
   109    pp result{{/returnType}}
   110    pp result.next_page?
   111    pp result.next_page
   112  rescue {{{moduleName}}}::ApiError => e
   113    puts "Exception when calling {{classname}}->{{{operationId}}}: #{e}"
   114  end
   115  {{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
   116  ```
   117  
   118  ## Datacenters
   119  
   120  The API is only accessible via HTTPS and the current version is <code>v2</code>, which results in a base URL like: <code>{{{basePath}}}</code> depending on the datacenter.
   121  
   122  ### EU Datacenter
   123  ```
   124  {{{basePath}}}
   125  ```
   126  
   127  This is the default datacenter.
   128  
   129  ### US Datacenter
   130  ```
   131  https://api.us.app.phrase.com/v2/
   132  ```
   133  
   134  ### Specifying US Datacenter
   135  You can use the US datacenter by setting the following:
   136  ```
   137  config.host = "api.us.app.phrase.com"
   138  ```
   139  
   140  ## Get help / support
   141  
   142  Please contact [support@phrase.com](mailto:support@phrase.com?subject=[GitHub]%20phrase-go) and we can take more direct action toward finding a solution.
   143  
   144  ## Documentation for API Endpoints
   145  
   146  All URIs are relative to *{{basePath}}*
   147  
   148  Class | Method | HTTP request | Description
   149  ------------ | ------------- | ------------- | -------------
   150  {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{moduleName}}::{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}}
   151  {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
   152  
   153  ## Documentation for Models
   154  
   155  {{#models}}{{#model}} - [{{moduleName}}::{{classname}}]({{modelDocPath}}{{classname}}.md)
   156  {{/model}}{{/models}}
   157  
   158  ## Documentation for Authorization
   159  
   160  {{^authMethods}} All endpoints do not require authorization.
   161  {{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
   162  {{#authMethods}}### {{name}}
   163  
   164  {{#isApiKey}}
   165  
   166  - **Type**: API key
   167  - **API key parameter name**: {{keyParamName}}
   168  - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
   169  {{/isApiKey}}
   170  {{#isBasic}}
   171  {{#isBasicBasic}}- **Type**: HTTP basic authentication
   172  {{/isBasicBasic}}{{#isBasicBearer}}- **Type**: Bearer authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
   173  {{/isBasicBearer}}
   174  {{/isBasic}}
   175  {{#isOAuth}}
   176  
   177  - **Type**: OAuth
   178  - **Flow**: {{flow}}
   179  - **Authorization URL**: {{authorizationUrl}}
   180  - **Scopes**: {{^scopes}}N/A{{/scopes}}
   181  {{#scopes}}  - {{scope}}: {{description}}
   182  {{/scopes}}
   183  {{/isOAuth}}
   184  
   185  {{/authMethods}}