mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 19:08:52 +00:00
822e640e0a
Conflicts: modules/swagger-codegen/src/main/resources/ruby/swagger/configuration.mustache modules/swagger-codegen/src/main/resources/ruby/swagger/request.mustache samples/client/petstore/ruby/lib/petstore/swagger/request.rb samples/client/petstore/ruby/lib/swagger_client.rb samples/client/petstore/ruby/lib/swagger_client/swagger/configuration.rb |
||
---|---|---|
.. | ||
lib | ||
spec | ||
Gemfile | ||
Gemfile.lock | ||
petstore.gemspec | ||
pom.xml | ||
Rakefile | ||
README.md |
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
Configuration
require 'petstore'
Petstore::Swagger.configure do |config|
config.api_key['api_key'] = 'special-key'
config.host = 'petstore.swagger.io'
config.base_path = '/v2'
# enable debugging (default is false)
config.debug = true
end
Getting Started
pet = Petstore::PetApi.get_pet_by_id(5)
puts pet.to_body