openapi-generator/samples/client/petstore/ruby
2016-02-25 12:20:17 +08:00
..
lib Update petstore spec and fix tests 2016-02-25 12:20:17 +08:00
spec Update petstore spec and fix tests 2016-02-25 12:20:17 +08:00
Gemfile added ruby sample 2012-09-26 13:02:27 -07:00
Gemfile.lock Minimal update for Ruby testing on El Capitan. 2016-01-07 18:17:07 -05:00
hello.txt Add file used in test: hello.txt 2015-08-20 11:18:05 +08:00
petstore_profiling.output Add profiling script and results for Ruby Petstore sample 2015-12-11 23:24:19 +08:00
petstore_profiling.rb Add profiling script and results for Ruby Petstore sample 2015-12-11 23:24:19 +08:00
petstore.gemspec Ruby: IO improvements on file downloading 2016-01-12 11:59:41 +08:00
pom.xml Code reformatting 2015-06-07 11:56:08 -04:00
press_anykey_to_continue.sh add delay script, update CI test to run ruby test first 2016-02-12 18:46:19 +08:00
Rakefile added ruby sample 2012-09-26 13:02:27 -07:00
README.md Update readme of ruby client 2015-08-18 14:35:54 +08:00

Installation

Build a gem

You can build the generated client into a gem:

gem build petstore.gemspec

Then you can either install the gem:

gem install ./petstore-1.0.0.gem

or publish the gem to a gem server like RubyGems.

Finally add this to your Gemfile:

gem 'petstore', '~> 1.0.0'

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 'petstore', :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

Getting Started

require 'petstore'

Petstore.configure do |config|
  config.api_key['api_key'] = 'special-key'
  config.host = 'petstore.swagger.io'
  config.base_path = '/v2'
  # enable debugging (default is disabled)
  config.debugging = true
end

pet_api = Petstore::PetApi.new
pet = pet_api.get_pet_by_id(5)
puts pet.to_body