Permalink
Browse files

indent = 2 and clarification about 'include Rufus::RTM' in doc

  • Loading branch information...
1 parent c793437 commit a37d10222ced70acc2de289d6a669f24713efbec @jmettraux committed Jan 20, 2009
Showing with 396 additions and 398 deletions.
  1. +8 −6 README.txt
  2. +26 −26 Rakefile
  3. +3 −4 lib/rufus/rtm.rb
  4. +40 −41 lib/rufus/rtm/base.rb
  5. +51 −52 lib/rufus/rtm/credentials.rb
  6. +232 −233 lib/rufus/rtm/resources.rb
  7. +36 −36 test/tasks_test.rb
View
@@ -49,27 +49,29 @@ make then sure that all the 4 variables are set in the environment you use for r
require 'rubygems'
require 'rufus/rtm'
+ include Rufus::RTM
+
#
# listing tasks
tasks = Task.find
- # finding all the tasks
+ # finding all the tasks
tasks = Task.find :filter => "status:incomplete"
- # finding all the incomplete tasks
+ # finding all the incomplete tasks
tasks.each do |task|
- puts "task id #{task.task_id}"
- puts " #{task.name} (#{task.tags.join(",")})"
- puts
+ puts "task id #{task.task_id}"
+ puts " #{task.name} (#{task.tags.join(",")})"
+ puts
end
#
# adding a task
task = Task.add! "study this rufus-rtm gem"
- # gets added to the 'Inbox' by default
+ # gets added to the 'Inbox' by default
puts "task id is #{task.task_id}"
View
@@ -9,25 +9,25 @@ require 'rake/rdoctask'
require 'rake/testtask'
-RUFUS_RTM_VERSION = "0.1"
+RUFUS_RTM_VERSION = '0.1'
#
# GEM SPEC
spec = Gem::Specification.new do |s|
- s.name = "rufus-rtm"
+ s.name = 'rufus-rtm'
s.version = RUFUS_RTM_VERSION
- s.authors = [ "John Mettraux" ]
- s.email = "jmettraux@gmail.com"
- s.homepage = "http://rufus.rubyforge.org/rufus-rtm"
+ s.authors = [ 'John Mettraux' ]
+ s.email = 'jmettraux@gmail.com'
+ s.homepage = 'http://rufus.rubyforge.org/rufus-rtm'
s.platform = Gem::Platform::RUBY
- s.summary = "yet another RememberTheMilk wrapper"
- #s.license = "MIT"
+ s.summary = 'yet another RememberTheMilk wrapper'
+ #s.license = 'MIT'
- s.require_path = "lib"
- #s.autorequire = "rufus-rtm"
- s.test_file = "test/test.rb"
+ s.require_path = 'lib'
+ #s.autorequire = 'rufus-rtm'
+ s.test_file = 'test/test.rb'
s.has_rdoc = true
s.extra_rdoc_files = [ 'README.txt' ]
@@ -36,15 +36,15 @@ spec = Gem::Specification.new do |s|
s.add_dependency d
end
- files = FileList[ "{bin,docs,lib,test}/**/*" ]
- files.exclude "rdoc"
+ files = FileList[ '{bin,docs,lib,test}/**/*' ]
+ files.exclude 'rdoc'
s.files = files.to_a
end
#
# tasks
-CLEAN.include("pkg", "html", "rdoc")
+CLEAN.include('pkg', 'html', 'rdoc')
task :default => [ :clean, :repackage ]
@@ -53,7 +53,7 @@ task :default => [ :clean, :repackage ]
# TESTING
Rake::TestTask.new(:test) do |t|
- t.libs << "test"
+ t.libs << 'test'
t.test_files = FileList['test/test.rb']
t.verbose = true
end
@@ -65,14 +65,14 @@ Rake::GemPackageTask.new(spec) do |pkg|
#pkg.need_tar = true
end
-Rake::PackageTask.new("rufus-rtm", RUFUS_RTM_VERSION) do |pkg|
+Rake::PackageTask.new('rufus-rtm', RUFUS_RTM_VERSION) do |pkg|
pkg.need_zip = true
pkg.package_files = FileList[
- "Rakefile",
- "*.txt",
- "lib/**/*",
- "test/**/*"
+ 'Rakefile',
+ '*.txt',
+ 'lib/**/*',
+ 'test/**/*'
].to_a
#pkg.package_files.delete("MISC.txt")
class << pkg
@@ -87,18 +87,18 @@ end
# DOCUMENTATION
#ALLISON=`allison --path`
-ALLISON="/Library/Ruby/Gems/1.8/gems/allison-2.0.3/lib/allison.rb"
+ALLISON='/Library/Ruby/Gems/1.8/gems/allison-2.0.3/lib/allison.rb'
Rake::RDocTask.new do |rd|
- rd.main = "README.txt"
+ rd.main = 'README.txt'
- rd.rdoc_dir = "html/rufus-rtm"
+ rd.rdoc_dir = 'html/rufus-rtm'
rd.rdoc_files.include(
- "README.txt", "CHANGELOG.txt", "LICENSE.txt", "lib/**/*.rb")
+ 'README.txt', 'CHANGELOG.txt', 'LICENSE.txt', 'lib/**/*.rb')
- rd.title = "rufus-rtm rdoc"
+ rd.title = 'rufus-rtm rdoc'
rd.options << '-N' # line numbers
rd.options << '-S' # inline source
@@ -112,8 +112,8 @@ end
task :upload_website => [ :clean, :rdoc ] do
- account = "jmettraux@rubyforge.org"
- webdir = "/var/www/gforge-projects/rufus"
+ account = 'jmettraux@rubyforge.org'
+ webdir = '/var/www/gforge-projects/rufus'
sh "rsync -azv -e ssh html/rufus-rtm #{account}:#{webdir}/"
end
View
@@ -1,18 +1,17 @@
-
#
#--
-# Copyright (c) 2008, John Mettraux, jmettraux@gmail.com
+# Copyright (c) 2008-2009, John Mettraux, jmettraux@gmail.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
-#
+#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
-#
+#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
View
@@ -1,18 +1,17 @@
-
#
#--
-# Copyright (c) 2008, John Mettraux, jmettraux@gmail.com
+# Copyright (c) 2008-2009, John Mettraux, jmettraux@gmail.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
-#
+#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
-#
+#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -44,57 +43,57 @@
module Rufus
module RTM
-
- AUTH_ENDPOINT = "http://www.rememberthemilk.com/services/auth/"
- REST_ENDPOINT = "http://api.rememberthemilk.com/services/rest/"
- #
- # Signs the RTM request (sets the 'api_sig' parameter).
- #
- def self.sign (params) #:nodoc:
+ AUTH_ENDPOINT = "http://www.rememberthemilk.com/services/auth/"
+ REST_ENDPOINT = "http://api.rememberthemilk.com/services/rest/"
- sig = MD5.md5(SHARED_SECRET + params.sort.flatten.join)
- params['api_sig'] = sig.to_s
+ #
+ # Signs the RTM request (sets the 'api_sig' parameter).
+ #
+ def self.sign (params) #:nodoc:
- params
- end
+ sig = MD5.md5(SHARED_SECRET + params.sort.flatten.join)
+ params['api_sig'] = sig.to_s
- #
- # Calls an API method (milk the cow).
- #
- def self.milk (params={}) #:nodoc:
+ params
+ end
- sleep 1
+ #
+ # Calls an API method (milk the cow).
+ #
+ def self.milk (params={}) #:nodoc:
- endpoint = params.delete :endpoint
- endpoint = AUTH_ENDPOINT if endpoint == :auth
- endpoint = endpoint || REST_ENDPOINT
+ sleep 1
- ps = params.inject({}) do |r, (k, v)|
- r[k.to_s] = v
- r
- end
+ endpoint = params.delete :endpoint
+ endpoint = AUTH_ENDPOINT if endpoint == :auth
+ endpoint = endpoint || REST_ENDPOINT
- ps['api_key'] = API_KEY
- ps['format'] = "json"
+ ps = params.inject({}) do |r, (k, v)|
+ r[k.to_s] = v
+ r
+ end
- ps['frob'] = FROB if FROB
- ps['auth_token'] = AUTH_TOKEN if AUTH_TOKEN
+ ps['api_key'] = API_KEY
+ ps['format'] = 'json'
- sign ps
+ ps['frob'] = FROB if FROB
+ ps['auth_token'] = AUTH_TOKEN if AUTH_TOKEN
- res = get endpoint, :query => ps
+ sign ps
- JSON.parse(res.body)["rsp"]
- end
+ res = get endpoint, :query => ps
- #
- # Requests a timeline from RTM.
- #
- def self.get_timeline #:nodoc:
+ JSON.parse(res.body)["rsp"]
+ end
- milk(:method => "rtm.timelines.create")['timeline']
- end
+ #
+ # Requests a timeline from RTM.
+ #
+ def self.get_timeline #:nodoc:
+
+ milk(:method => 'rtm.timelines.create')['timeline']
+ end
end
end
Oops, something went wrong.

0 comments on commit a37d102

Please sign in to comment.