Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6a51182
Showing
66 changed files
with
2,386 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.DS_Store | ||
._* | ||
.bundle/ | ||
coverage/ | ||
log/*.log | ||
pkg/ | ||
Gemfile.lock | ||
spec/dummy/db/*.sqlite3 | ||
spec/dummy/log/*.log | ||
spec/dummy/tmp/ | ||
spec/dummy/.sass-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--colour |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
language: ruby | ||
rvm: | ||
- 1.9.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
source "http://rubygems.org" | ||
|
||
gemspec | ||
|
||
gem "jquery-rails" | ||
gem "bootstrap-sass" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# ApiTaster [![Build Status](https://secure.travis-ci.org/fredwu/api_taster.png?branch=master)](http://travis-ci.org/fredwu/api_taster) [![Dependency Status](https://gemnasium.com/fredwu/api_taster.png)](https://gemnasium.com/fredwu/api_taster) | ||
|
||
A quick and easy way to visually test out your application's API. | ||
|
||
![](http://i.imgur.com/ZffbS.png) | ||
|
||
## Why? | ||
|
||
There are already many awesome API clients (such as [Postman](https://chrome.google.com/webstore/detail/fdmmgilgnpjigdojojpjoooidkmcomcm)), so why reinvent the wheel? | ||
|
||
API Taster compared to alternatives, have the following advantages: | ||
|
||
- API endpoints are automatically generated from your Rails routes definition | ||
- Defining post params is as easy as defining routes | ||
- Post params can be shared with your test factories | ||
|
||
## Usage | ||
|
||
Add API Taster in your gemfile: | ||
|
||
```ruby | ||
gem 'api_taster' | ||
``` | ||
Mount API Taster, this will allow you to visit API Taster from within your app. For example: | ||
|
||
```ruby | ||
Rails.application.routes.draw do | ||
mount ApiTaster::Engine => "/api_taster" | ||
end | ||
``` | ||
|
||
In `routes.rb`, define parameters for each API endpoint after the normal routes definition block. For example: | ||
|
||
```ruby | ||
ApiTaster.routes do | ||
get '/users' | ||
|
||
post '/users', { | ||
:user => { | ||
:name => 'Fred' | ||
} | ||
} | ||
|
||
get '/users/:id', { | ||
:id => 1 | ||
} | ||
|
||
put '/users/:id', { | ||
:id => 1, :user => { | ||
:name => 'Awesome' | ||
} | ||
} | ||
|
||
delete '/users/:id', { | ||
:id => 1 | ||
} | ||
end | ||
``` | ||
|
||
That's it! Enjoy! :) | ||
|
||
## License | ||
|
||
This gem is released under the [MIT License](http://www.opensource.org/licenses/mit-license.php). | ||
|
||
## Author | ||
|
||
[Fred Wu](https://github.com/fredwu), originally built for [Locomote](http://locomote.com.au). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env rake | ||
begin | ||
require 'bundler/setup' | ||
rescue LoadError | ||
puts 'You must `gem install bundler` and `bundle install` to run rake tasks' | ||
end | ||
begin | ||
require 'rdoc/task' | ||
rescue LoadError | ||
require 'rdoc/rdoc' | ||
require 'rake/rdoctask' | ||
RDoc::Task = Rake::RDocTask | ||
end | ||
|
||
RDoc::Task.new(:rdoc) do |rdoc| | ||
rdoc.rdoc_dir = 'rdoc' | ||
rdoc.title = 'ApiTaster' | ||
rdoc.options << '--line-numbers' | ||
rdoc.rdoc_files.include('README.rdoc') | ||
rdoc.rdoc_files.include('lib/**/*.rb') | ||
end | ||
|
||
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__) | ||
load 'rails/tasks/engine.rake' | ||
|
||
|
||
|
||
Bundler::GemHelper.install_tasks | ||
|
||
require 'rake/testtask' | ||
|
||
Rake::TestTask.new(:test) do |t| | ||
t.libs << 'lib' | ||
t.libs << 'spec' | ||
t.pattern = 'spec/**/*_spec.rb' | ||
t.verbose = false | ||
end | ||
|
||
|
||
task :default => :test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
$:.push File.expand_path("../lib", __FILE__) | ||
|
||
require "api_taster/version" | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "api_taster" | ||
s.version = ApiTaster::VERSION | ||
s.authors = ["Fred Wu"] | ||
s.email = ["ifredwu@gmail.com"] | ||
s.homepage = "https://github.com/fredwu/api_taster" | ||
s.summary = "A quick and easy way to visually test out your application's API." | ||
s.description = s.summary | ||
|
||
s.files = `git ls-files`.split($\) | ||
s.test_files = Dir["spec/**/*"] | ||
|
||
s.add_dependency 'rails', '>= 3.1.0' | ||
s.add_dependency 'jquery-rails' | ||
s.add_dependency 'sass-rails' | ||
s.add_dependency 'bootstrap-sass', '~> 2.0.3' | ||
|
||
s.add_development_dependency 'rake' | ||
s.add_development_dependency 'simplecov' | ||
s.add_development_dependency 'rspec-rails' | ||
s.add_development_dependency 'pry' | ||
s.add_development_dependency 'thin' | ||
end |
Empty file.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.