summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorZack Hobson2014-04-21 12:56:40 -0700
committerZack Hobson2014-04-21 13:06:14 -0700
commit3bc51e96c7a88dfdf8d003c669d4af33d92ab90c (patch)
tree8f996ddf2773482e3d0cddcbabcb77ab15819009 /lib
parent92974b1fa9d8a975a8583eba967a346de1e20781 (diff)
downloadhcl-3bc51e96c7a88dfdf8d003c669d4af33d92ab90c.tar.bz2
remove dependency on fakeweb and net::http
By using pure faraday for the test and error handling code, the way is cleared for dropping in alternative http clients.
Diffstat (limited to 'lib')
-rw-r--r--lib/hcl/app.rb2
-rw-r--r--lib/hcl/net.rb6
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/hcl/app.rb b/lib/hcl/app.rb
index 0cda7b4..14f626d 100644
--- a/lib/hcl/app.rb
+++ b/lib/hcl/app.rb
@@ -66,7 +66,7 @@ module HCl
rescue RuntimeError => e
$stderr.puts "Error: #{e}"
exit 1
- rescue SocketError => e
+ rescue Faraday::Error => e
$stderr.puts "Connection failed. (#{e.message})"
exit 1
rescue HarvestMiddleware::ThrottleFailure => e
diff --git a/lib/hcl/net.rb b/lib/hcl/net.rb
index 730e5b4..ac794d6 100644
--- a/lib/hcl/net.rb
+++ b/lib/hcl/net.rb
@@ -19,7 +19,11 @@ module HCl
"https://#{subdomain}.harvestapp.com"
) do |f|
f.use :harvest, login, password
- f.adapter Faraday.default_adapter
+ if opts['test_adapter']
+ f.adapter :test, opts['test_adapter']
+ else
+ f.adapter Faraday.default_adapter
+ end
end
end