From 817a74d4df12e1e4d2b035ea1328fecfe3e51833 Mon Sep 17 00:00:00 2001 From: xhh Date: Thu, 9 Apr 2015 11:32:10 +0800 Subject: [PATCH] Add README.md file containing instructions on Ruby petstore sample --- samples/client/petstore/ruby/README.md | 57 ++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 samples/client/petstore/ruby/README.md diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md new file mode 100644 index 000000000000..29a7ce844ce6 --- /dev/null +++ b/samples/client/petstore/ruby/README.md @@ -0,0 +1,57 @@ +## Installation + +### Build a gem + +You can build the generated client into a gem: + +```shell +gem build swagger-client.gemspec +``` + +Then you can either install the gem: + +```shell +gem install ./swagger-client-4.06.08.gem +``` + +or publish the gem to a gem server like [RubyGems](https://rubygems.org/). + +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: + +```shell +ruby -Ilib script.rb +``` + +## Configuration + +```ruby +require 'swagger-client' + +Swagger.configure do |config| + config.api_key = 'special-key' + config.host = 'petstore.swagger.io' + config.base_path = '/v2' +end +``` + +## Getting Started + +```ruby +pet = PetApi.getPetById(5) +puts pet.to_body +```