class Dropbox::API::Raw

Attributes

connection[RW]

Public Class Methods

add_method(method, action, options = {}) click to toggle source
# File lib/dropbox-api/client/raw.rb, line 12
      def self.add_method(method, action, options = {})
        # Add the default root bit, but allow it to be disabled by a config option
        root = options[:root] == false ? '' : "options[:root] ||= Dropbox::API::Config.mode"
        self.class_eval <<-STR
          def #{options[:as] || action}(options = {})
            #{root}
            request(:#{options[:endpoint] || 'main'}, :#{method}, "#{action}", options)
          end
        STR
      end
new(options = {}) click to toggle source
# File lib/dropbox-api/client/raw.rb, line 8
def initialize(options = {})
  @connection = options[:connection]
end

Public Instance Methods

request(endpoint, method, action, data = {}) click to toggle source
# File lib/dropbox-api/client/raw.rb, line 23
def request(endpoint, method, action, data = {})
  action.sub! ':root', data.delete(:root) if action.match ':root'
  action.sub! ':path', Dropbox::API::Util.escape(data.delete(:path)) if action.match ':path'
  action = Dropbox::API::Util.remove_double_slashes(action)
  connection.send(method, endpoint, action, data)
end