Skip to content

Instantly share code, notes, and snippets.

Created January 29, 2010 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/290194 to your computer and use it in GitHub Desktop.
Save anonymous/290194 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
require 'active_resource'
TOKEN = ''
ROOT = 'https://' + TOKEN + ':x@api.myintervals.com/'
class ActiveResource::Connection
def configure_http(http)
http = apply_ssl_options(http)
# Net::HTTP timeouts default to 60 seconds.
if @timeout
http.open_timeout = @timeout
http.read_timeout = @timeout
end
http.set_debug_output $stderr
http
end
end
ActiveSupport::Inflector.inflections do |inflect|
inflect.irregular 'task', 'task'
end
class Task < ActiveResource::Base
class << self
def element_path(id, prefix_options = {}, query_options = nil)
prefix_options, query_options = split_options(prefix_options) if query_options.nil?
"#{prefix(prefix_options)}#{collection_name}/#{id}#{query_string(query_options)}"
end
def collection_path(prefix_options = {}, query_options = nil)
prefix_options, query_options = split_options(prefix_options) if query_options.nil?
"#{prefix(prefix_options)}#{collection_name}#{query_string(query_options)}"
end
end
self.site = ROOT
end
Task.find(:all)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment