lib/cloudally.rb in cloudally-0.2.0 vs lib/cloudally.rb in cloudally-0.2.1
- old
+ new
@@ -1,27 +1,29 @@
-require File.expand_path('cloudally/configuration', __dir__)
+require "wrapi"
+
require File.expand_path('cloudally/api', __dir__)
require File.expand_path('cloudally/client', __dir__)
require File.expand_path('cloudally/version', __dir__)
module CloudAlly
- extend Configuration
+ extend WrAPI::Configuration
+ extend WrAPI::RespondTo
+ DEFAULT_ENDPOINT = 'https://api.cloudally.com/v1/'.freeze
+ DEFAULT_USERAGENT = "CloudAlly Ruby API wrapper #{CloudAlly::VERSION}".freeze
+
# Alias for CloudAlly::Client.new
#
# @return [CloudAlly::Client]
def self.client(options = {})
- CloudAlly::Client.new(options)
+ CloudAlly::Client.new({
+ endpoint: DEFAULT_ENDPOINT,
+ user_agent: DEFAULT_USERAGENT
+ }.merge(options))
end
-
- # Delegate to CloudAlly::Client
- def self.method_missing(method, *args, &block)
- return super unless client.respond_to?(method)
-
- client.send(method, *args, &block)
- end
-
- # Delegate to CloudAlly::Client
- def self.respond_to?(method, include_all = false)
- client.respond_to?(method, include_all) || super
+
+ def self.reset
+ super
+ self.endpoint = DEFAULT_ENDPOINT
+ self.user_agent = DEFAULT_USERAGENT
end
end