lib/nightcrawler_swift.rb in nightcrawler_swift-0.5.0 vs lib/nightcrawler_swift.rb in nightcrawler_swift-0.6.0
- old
+ new
@@ -1,13 +1,16 @@
+require "cgi"
require "date"
require "logger"
require "digest"
require "ostruct"
require "multi_mime"
require "rest_client"
require "nightcrawler_swift/version"
require "nightcrawler_swift/exceptions"
+require "nightcrawler_swift/ext/hash"
+require "nightcrawler_swift/options"
require "nightcrawler_swift/gateway"
require "nightcrawler_swift/connection"
require "nightcrawler_swift/command"
require "nightcrawler_swift/commands/upload"
require "nightcrawler_swift/commands/download"
@@ -32,23 +35,22 @@
# - username
# - password
# - auth_url
#
# - max_age (optional, default: nil)
- # - verify_ssl (optional, default: false)
# - timeout (in seconds. Optional, default: nil)
#
# - retries (default: 3)
# - max_retry_time (in seconds, default: 30)
#
+ # - verify_ssl (optional, default: false)
+ # - ssl_client_cert (optional, default: nil)
+ # - ssl_client_key (optional, default: nil)
+ # - ssl_ca_file (optional, default: nil)
+ #
def configure opts = {}
- defaults = {verify_ssl: false, retries: 5, max_retry_time: 30}
- @options = OpenStruct.new(defaults.merge(opts))
-
- if @options.max_age and not @options.max_age.is_a?(Numeric)
- raise Exceptions::ConfigurationError.new "max_age should be an Integer"
- end
-
+ opts.symbolize_keys!
+ @options = Options.new opts
@connection = Connection.new
end
def sync dir_path
Sync.new.execute(dir_path)