Permalink
Browse files

no more system calls

  • Loading branch information...
1 parent 2c444f0 commit edcc6a5f7a402ee4c33ecab54a3bd5ed06c9af62 @adelevie committed Feb 25, 2012
Showing with 14 additions and 4 deletions.
  1. +2 −0 Gemfile
  2. +6 −0 Gemfile.lock
  3. +1 −1 examples/banks/Gemfile
  4. +1 −1 examples/banks/Gemfile.lock
  5. +4 −2 lib/restivus.rb
View
@@ -16,3 +16,5 @@ gem "sinatra", :require => "sinatra/base"
gem "sinatra-respond_to"
gem "json"
gem "active_support"
+gem "fastercsv"
+gem "rest-client"
View
@@ -4,17 +4,21 @@ GEM
active_support (3.0.0)
activesupport (= 3.0.0)
activesupport (3.0.0)
+ fastercsv (1.5.4)
git (1.2.5)
jeweler (1.6.4)
bundler (~> 1.0)
git (>= 1.2.5)
rake
json (1.6.5)
+ mime-types (1.17.2)
rack (1.4.1)
rack-protection (1.2.0)
rack
rake (0.9.2.2)
rcov (0.9.11)
+ rest-client (1.6.7)
+ mime-types (>= 1.16)
shoulda (3.0.0)
shoulda-context (~> 1.0.0)
shoulda-matchers (~> 1.0.0)
@@ -34,9 +38,11 @@ PLATFORMS
DEPENDENCIES
active_support
bundler (~> 1.0.0)
+ fastercsv
jeweler (~> 1.6.4)
json
rcov
+ rest-client
shoulda
sinatra
sinatra-respond_to
View
@@ -1,3 +1,3 @@
source :rubygems
-gem "restivus", :path => "../.." #you should change this to a rubygems hosted version
+gem "restivus", :path => "../.."#"~> 0.0.2"
@@ -1,7 +1,7 @@
PATH
remote: ../..
specs:
- restivus (0.0.1)
+ restivus (0.0.2)
active_support
json
sinatra
View
@@ -2,6 +2,7 @@
require 'csv'
require 'uri'
require 'sinatra'
+require 'rest-client'
class Restivus < Sinatra::Base
@@ -10,7 +11,8 @@ class Restivus < Sinatra::Base
# ------------
def curl_req(url)
- `curl #{url}`
+ #`curl #{url}`
+ RestClient.get(url)
end
def truncated_response(url)
@@ -29,7 +31,7 @@ def format_curl_req(url, description="TODO", http="TODO", url_schema="TODO", div
result = {
:cmd => "$ curl #{url}",
:raw_response => curl_req(url),
- :pretty_response => truncated_response(url),#JSON.pretty_generate(JSON.parse(curl_req(url))),
+ :pretty_response => truncated_response(url),
:description => description,
:http_verb => http,
:url_schema => url_schema,

0 comments on commit edcc6a5

Please sign in to comment.