lib/nightcrawler_swift/command.rb in nightcrawler_swift-0.3.0 vs lib/nightcrawler_swift/command.rb in nightcrawler_swift-0.4.0
- old
+ new
@@ -1,12 +1,18 @@
module NightcrawlerSwift
class Command
def connection
- NightcrawlerSwift.connection
+ NightcrawlerSwift.connection.tap do |conn|
+ conn.connect! unless conn.connected?
+ end
end
+ def options
+ NightcrawlerSwift.options
+ end
+
def execute
raise NotImplemented.new
end
protected
@@ -30,10 +36,14 @@
end
private
def resource_for url
- RestClient::Resource.new url, verify_ssl: false
+ RestClient::Resource.new(
+ url,
+ verify_ssl: options.verify_ssl,
+ timeout: options.timeout
+ )
end
def prepare_params params
params[:headers] ||= {}
params[:headers]["X-Storage-Token"] = connection.token_id