# {{gemName}} [![Gem Version](https://badge.fury.io/rb/bandwidth-sdk.svg)](https://badge.fury.io/rb/bandwidth-sdk) [![Tests](https://github.com/Bandwidth/ruby-sdk/actions/workflows/test-nightly.yml/badge.svg)](https://github.com/Bandwidth/ruby-sdk/actions/workflows/test-nightly.yml) [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop) | **OS** | **Ruby** | |:---:|:---:| | Windows 2019 | 2.7, 3.0, 3.1, 3.2 | | Windows 2022 | 2.7, 3.0, 3.1, 3.2 | | Ubuntu 20.04 | 2.7, 3.0, 3.1, 3.2 | | Ubuntu 22.04 | 2.7, 3.0, 3.1, 3.2 | {{moduleName}} - the Ruby gem for the {{appName}} # Generated with the command: `openapi-generator generate -g ruby -i bandwidth.yml -c openapi-config.yml -o ./` {{#appDescriptionWithNewLines}} {{{.}}} {{/appDescriptionWithNewLines}} This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: {{appVersion}} - Package version: {{gemVersion}} {{^hideGenerationTimestamp}} - Build date: {{generatedDate}} {{/hideGenerationTimestamp}} - Build package: {{generatorClass}} {{#infoUrl}} For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) {{/infoUrl}} ## Installation ### Build a gem To build the Ruby code into a gem: ```shell gem build {{{gemName}}}.gemspec ``` Then either install the gem locally: ```shell gem install ./{{{gemName}}}-{{{gemVersion}}}.gem ``` (for development, run `gem install --dev ./{{{gemName}}}-{{{gemVersion}}}.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 '{{{gemName}}}', '~> {{{gemVersion}}}' ### Install from Git If the Ruby gem is hosted at a git repository: https://{{gitHost}}/{{gitUserId}}{{^gitUserId}}YOUR_GIT_USERNAME{{/gitUserId}}/{{gitRepoId}}{{^gitRepoId}}YOUR_GIT_REPO{{/gitRepoId}}, then add the following in the Gemfile: gem '{{{gemName}}}', :git => 'https://{{gitHost}}/{{gitUserId}}{{^gitUserId}}YOUR_GIT_USERNAME{{/gitUserId}}/{{gitRepoId}}{{^gitRepoId}}YOUR_GIT_REPO{{/gitRepoId}}.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 '{{{gemName}}}' {{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}} # Setup authorization {{{moduleName}}}.configure do |config|{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} # Configure HTTP basic authorization: {{{name}}} config.username = 'YOUR_USERNAME' config.password = 'YOUR_PASSWORD'{{/isBasicBasic}}{{#isBasicBearer}} # Configure Bearer authorization{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}: {{{name}}} config.access_token = 'YOUR_BEARER_TOKEN' # Configure a proc to get access tokens in lieu of the static access_token configuration config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } {{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} # Configure API key authorization: {{{name}}} config.api_key['{{{name}}}'] = '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['{{{name}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}} # Configure OAuth2 access token for authorization: {{{name}}} config.access_token = 'YOUR ACCESS TOKEN' # Configure a proc to get access tokens in lieu of the static access_token configuration config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } {{/isOAuth}} {{#isFaraday}} # Configure faraday connection config.configure_faraday_connection { |connection| 'YOUR CONNECTION CONFIG PROC' } {{/isFaraday}} {{/authMethods}}end {{/hasAuthMethods}} api_instance = {{{moduleName}}}::{{{classname}}}.new {{#requiredParams}} {{{paramName}}} = {{{vendorExtensions.x-ruby-example}}} # {{{dataType}}} | {{{description}}} {{/requiredParams}} {{#optionalParams}} {{#-first}} opts = { {{/-first}} {{{paramName}}}: {{{vendorExtensions.x-ruby-example}}}{{^-last}},{{/-last}} # {{{dataType}}} | {{{description}}} {{#-last}} } {{/-last}} {{/optionalParams}} begin {{#summary}} #{{{.}}} {{/summary}} {{#returnType}}result = {{/returnType}}api_instance.{{{operationId}}}{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}{{#returnType}} p result{{/returnType}} rescue {{{moduleName}}}::ApiError => e puts "Exception when calling {{classname}}->{{{operationId}}}: #{e}" end {{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} ``` ## Documentation for API Endpoints All URIs are relative to *{{basePath}}* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{moduleName}}::{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{{summary}}} {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} ## Documentation for Models {{#models}}{{#model}} - [{{moduleName}}::{{classname}}]({{modelDocPath}}{{classname}}.md) {{/model}}{{/models}} ## Documentation for Authorization {{^authMethods}}Endpoints do not require authorization.{{/authMethods}} {{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}} {{#authMethods}} ### {{name}} {{#isApiKey}} - **Type**: API key - **API key parameter name**: {{keyParamName}} - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} {{/isApiKey}} {{#isBasic}} {{#isBasicBasic}}- **Type**: HTTP basic authentication {{/isBasicBasic}}{{#isBasicBearer}}- **Type**: Bearer authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} {{/isBasicBearer}}{{#isHttpSignature}}- **Type**: HTTP signature authentication {{/isHttpSignature}} {{/isBasic}} {{#isOAuth}} - **Type**: OAuth - **Flow**: {{flow}} - **Authorization URL**: {{authorizationUrl}} - **Scopes**: {{^scopes}}N/A{{/scopes}} {{#scopes}} - {{scope}}: {{description}} {{/scopes}} {{/isOAuth}} {{/authMethods}}