lib/smartdc.rb in smartdc-1.3.0 vs lib/smartdc.rb in smartdc-2.0.0
- old
+ new
@@ -1,24 +1,32 @@
require 'smartdc/version'
+require 'smartdc/configure'
+require 'smartdc/default'
require 'smartdc/client'
-require 'smartdc/request'
-require 'smartdc/response'
-require 'smartdc/error'
module Smartdc
- def self.new(options={})
- Smartdc::Client.new(options)
- end
+ class << self
+ def configure
+ yield Smartdc::Configure
+ end
- def self.config=(options={})
- @cli = Smartdc::Client.new(options)
- @config = options
- end
+ def config
+ Smartdc::Configure
+ end
- def self.config
- @config
- end
+ def client(options={})
+ @client = nil unless options.empty?
+ @client ||= Smartdc::Client.new(options)
+ end
- def self.cli
- @cli
+ def root
+ @root ||= File.expand_path('..', File.dirname(__FILE__))
+ end
+
+ def method_missing(method, *args, &block)
+ return super unless client.respond_to?(method)
+ client.send(method, *args, &block)
+ end
end
end
+
+Smartdc::Configure.setup