Permalink
Browse files

Initial commit :)

  • Loading branch information...
0 parents commit 6a51182fa84928dce5d82f670509d11a2c12e1f9 @fredwu committed Jun 20, 2012
Showing with 2,386 additions and 0 deletions.
  1. +11 −0 .gitignore
  2. +1 −0 .rspec
  3. +3 −0 .travis.yml
  4. +6 −0 Gemfile
  5. +68 −0 README.md
  6. +40 −0 Rakefile
  7. +27 −0 api_taster.gemspec
  8. 0 app/assets/images/api_taster/.gitkeep
  9. +28 −0 app/assets/javascripts/api_taster/01-prettify.js
  10. +1,076 −0 app/assets/javascripts/api_taster/02-jquery.form.js
  11. +88 −0 app/assets/javascripts/api_taster/app.js
  12. +16 −0 app/assets/javascripts/api_taster/application.js
  13. +1 −0 app/assets/stylesheets/api_taster/01-prettify.css
  14. +51 −0 app/assets/stylesheets/api_taster/02-prettify-sunburst.css
  15. +13 −0 app/assets/stylesheets/api_taster/application.css
  16. +51 −0 app/assets/stylesheets/api_taster/layout.css.scss
  17. +5 −0 app/controllers/api_taster/application_controller.rb
  18. +12 −0 app/controllers/api_taster/routes_controller.rb
  19. +4 −0 app/helpers/api_taster/application_helper.rb
  20. +6 −0 app/views/api_taster/routes/_param_form_element.html.erb
  21. +1 −0 app/views/api_taster/routes/_param_form_legend.html.erb
  22. +7 −0 app/views/api_taster/routes/_undefined_route.html.erb
  23. +24 −0 app/views/api_taster/routes/index.html.erb
  24. +55 −0 app/views/api_taster/routes/show.html.erb
  25. +29 −0 app/views/layouts/api_taster/application.html.erb
  26. +5 −0 config/routes.rb
  27. +13 −0 lib/api_taster.rb
  28. +17 −0 lib/api_taster/engine.rb
  29. +49 −0 lib/api_taster/form_builder.rb
  30. +30 −0 lib/api_taster/mapper.rb
  31. +63 −0 lib/api_taster/route.rb
  32. +3 −0 lib/api_taster/version.rb
  33. 0 lib/tasks/api_taster_tasks.rake
  34. +8 −0 script/rails
  35. +21 −0 spec/controllers/api_taster/routes_controller_spec.rb
  36. +7 −0 spec/dummy/Rakefile
  37. +13 −0 spec/dummy/app/assets/javascripts/application.js
  38. +13 −0 spec/dummy/app/assets/stylesheets/application.css
  39. +4 −0 spec/dummy/app/controllers/application_controller.rb
  40. +21 −0 spec/dummy/app/controllers/users_controller.rb
  41. +2 −0 spec/dummy/app/helpers/application_helper.rb
  42. 0 spec/dummy/app/mailers/.gitkeep
  43. 0 spec/dummy/app/models/.gitkeep
  44. +14 −0 spec/dummy/app/views/layouts/application.html.erb
  45. +4 −0 spec/dummy/config.ru
  46. +67 −0 spec/dummy/config/application.rb
  47. +10 −0 spec/dummy/config/boot.rb
  48. +5 −0 spec/dummy/config/environment.rb
  49. +37 −0 spec/dummy/config/environments/development.rb
  50. +67 −0 spec/dummy/config/environments/production.rb
  51. +37 −0 spec/dummy/config/environments/test.rb
  52. +7 −0 spec/dummy/config/initializers/backtrace_silencers.rb
  53. +15 −0 spec/dummy/config/initializers/inflections.rb
  54. +5 −0 spec/dummy/config/initializers/mime_types.rb
  55. +7 −0 spec/dummy/config/initializers/secret_token.rb
  56. +8 −0 spec/dummy/config/initializers/session_store.rb
  57. +14 −0 spec/dummy/config/initializers/wrap_parameters.rb
  58. +5 −0 spec/dummy/config/locales/en.yml
  59. +33 −0 spec/dummy/config/routes.rb
  60. 0 spec/dummy/lib/assets/.gitkeep
  61. 0 spec/dummy/log/.gitkeep
  62. +6 −0 spec/dummy/script/rails
  63. +29 −0 spec/form_builder_spec.rb
  64. +41 −0 spec/mapper_spec.rb
  65. +71 −0 spec/route_spec.rb
  66. +12 −0 spec/spec_helper.rb
@@ -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
1 .rspec
@@ -0,0 +1 @@
+--colour
@@ -0,0 +1,3 @@
+language: ruby
+rvm:
+ - 1.9.3
@@ -0,0 +1,6 @@
+source "http://rubygems.org"
+
+gemspec
+
+gem "jquery-rails"
+gem "bootstrap-sass"
@@ -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).
@@ -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
@@ -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
No changes.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 6a51182

Please sign in to comment.