Installation

Build a gem

You can build the generated client into a gem:

gem build swagger-client.gemspec

Then you can either install the gem:

gem install ./swagger-client-4.06.08.gem

or publish the gem to a gem server like RubyGems.

Finally add this to your Gemfile:

gem 'swagger-client', '~> 4.06.08'

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/xhh/swagger-petstore-ruby

Then you can reference it in Gemfile:

gem 'swagger-client', :git => 'https://github.com/xhh/swagger-petstore-ruby.git'

Use without installation

You can also use the client directly like this:

ruby -Ilib script.rb

Configuration

require 'swagger-client'

Swagger.configure do |config|
  config.api_key = 'special-key'
  config.host = 'petstore.swagger.io'
  config.base_path = '/v2'
end

Getting Started

pet = PetApi.getPetById(5)
puts pet.to_body