Files
openapi-generator/modules/swagger-codegen/src/main/resources/ruby
..
2016-03-09 17:40:27 +08:00
2016-03-10 17:19:18 +08:00

# {{gemName}}

{{moduleName}} - the Ruby gem for the {{appName}}

Version: {{gemVersion}}

Automatically generated by the Ruby Swagger Codegen project:

- Build date: {{generatedDate}}
- Build package: {{generatorClass}}

## Installation

### Build a gem

You can build the generated client into a gem:

```shell
gem build {{{gemName}}}.gemspec
```

Then you can either install the gem:

```shell
gem install ./{{{gemName}}}-{{{gemVersion}}}.gem
```

or publish the gem to a gem server like [RubyGems](https://rubygems.org/).

Finally add this to your Gemfile:

    gem '{{{gemName}}}', '~> {{{gemVersion}}}'

### Host as a git repository

You can also choose to host the generated client as a git repository, e.g. on github:
https://github.com/YOUR_USERNAME/YOUR_REPO

Then you can reference it in Gemfile:

    gem '{{{gemName}}}', :git => 'https://github.com/YOUR_USERNAME/YOUR_REPO.git'

### Use without installation

You can also use the client directly like this:

```shell
ruby -Ilib script.rb
```

## Getting Started

```ruby
require '{{{gemName}}}'

{{{moduleName}}}.configure do |config|
  # Use the line below to configure API key authorization if needed:
  #config.api_key['api_key'] = 'your api key'

  config.host = 'petstore.swagger.io'
  config.base_path = '/v2'
  # Enable debugging (default is disabled).
  config.debugging = true
end

# Assuming there's a `PetApi` containing a `get_pet_by_id` method
# which returns a model object:
pet_api = {{{moduleName}}}::PetApi.new
pet = pet_api.get_pet_by_id(5)
puts pet.to_body
```

## 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}}{{summary}}{{/summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}

## Documentation for Models

{{#models}}{{#model}} - [{{moduleName}}::{{classname}}]({{modelDocPath}}{{classname}}.md)
{{/model}}{{/models}}

## Documentation for Authorization

{{^authMethods}} All endpoints do not require authorization.
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
{{#authMethods}}### {{name}}

{{#isApiKey}}- **Type**: API key
- **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasic}}- **Type**: HTTP basic authentication
{{/isBasic}}
{{#isOAuth}}- **Type**: OAuth
- **Flow**: {{flow}}
- **Authorizatoin URL**: {{authorizationUrl}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}}-- {{scope}}: {{description}}
{{/scopes}}
{{/isOAuth}}

{{/authMethods}}