moocow 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +8 -0
- data/ext/{string_camelize.rb → string_rtmize.rb} +1 -1
- data/lib/moocow.rb +2 -1
- data/lib/moocow/auth.rb +4 -3
- data/lib/moocow/moocow.rb +7 -6
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -6,6 +6,14 @@ License:: Distributes under the Apache License, see LICENSE.txt in the source di
|
|
6
6
|
|
7
7
|
== Install
|
8
8
|
|
9
|
+
Note that the most up-to-date version of the gem is hosted at [http://www.gemcutter.org], so you'll need a one-time setup
|
10
|
+
if you aren't already using Gemcutter as your primary source for gems.
|
11
|
+
|
12
|
+
# Only if you aren't using gemcutter yet
|
13
|
+
sudo gem install gemcutter
|
14
|
+
sudo gem tumble
|
15
|
+
|
16
|
+
# Once Gemcutter is setup
|
9
17
|
sudo gem install moocow
|
10
18
|
|
11
19
|
== Overview
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
class String
|
3
3
|
# Stolen from sequel; gives String a camelize method
|
4
|
-
def
|
4
|
+
def rtmize(first_letter_in_uppercase = :lower)
|
5
5
|
s = gsub(/\/(.?)/){|x| "::#{x[-1..-1].upcase unless x == '/'}"}.gsub(/(^|_)(.)/){|x| x[-1..-1].upcase}
|
6
6
|
s[0...1] = s[0...1].downcase unless first_letter_in_uppercase == :upper
|
7
7
|
s
|
data/lib/moocow.rb
CHANGED
data/lib/moocow/auth.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require '
|
1
|
+
require 'string_rtmize'
|
2
2
|
module RTM
|
3
3
|
|
4
4
|
# Implements authorization related tasks. These are to be used one-time only
|
5
5
|
# when the user first uses your application.
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# auth = RTMAuth.new(api_key,secret)
|
8
8
|
# url = auth.get_auth_url
|
9
9
|
# # send user to url
|
@@ -17,7 +17,7 @@ module RTM
|
|
17
17
|
|
18
18
|
# Get the URL to allow the user to authorize the application
|
19
19
|
# [perms] the permissions you wish to get, either :read, :write, or :delete
|
20
|
-
# [application_type] if :desktop, a frob is gotten and the URL is suitable for a desktop application. if :web, a url suitable for the web is returned.
|
20
|
+
# [application_type] if :desktop, a frob is gotten and the URL is suitable for a desktop application. if :web, a url suitable for the web is returned.
|
21
21
|
# [callback_url] the callback URL you want the user sent to after they authorize. This will have the frob and you must call frob= before get_token with the frob that was given to you.
|
22
22
|
def url(perms = :delete, application_type=:desktop, callback_url=nil)
|
23
23
|
@frob = get_frob if application_type == :desktop
|
@@ -56,3 +56,4 @@ module RTM
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
59
|
+
|
data/lib/moocow/moocow.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require '
|
2
|
+
require 'string_rtmize'
|
3
3
|
require 'digest/md5'
|
4
4
|
require 'cgi'
|
5
5
|
require 'moocow/auth'
|
@@ -25,13 +25,13 @@ module RTM
|
|
25
25
|
# Also note that you can use Ruby-style method calls instead of filthy camel-case, e.g.
|
26
26
|
#
|
27
27
|
# response = rtm.tasks.get_list(:filter => 'location:Work and status:completed')
|
28
|
-
# # Same as
|
28
|
+
# # Same as
|
29
29
|
# response = rtm.tasks.getList(:filter => 'location:Work and status:completed')
|
30
30
|
#
|
31
31
|
class RTM
|
32
32
|
|
33
33
|
# Create access to RTM
|
34
|
-
#
|
34
|
+
#
|
35
35
|
# [endpoint] an Endpoint to RTM
|
36
36
|
def initialize(endpoint)
|
37
37
|
@endpoint = endpoint
|
@@ -77,7 +77,7 @@ module RTM
|
|
77
77
|
# method names are converted to camelcase.
|
78
78
|
def method_missing(symbol,*args)
|
79
79
|
if !args || args.empty?
|
80
|
-
rtm_object = symbol.to_s.
|
80
|
+
rtm_object = symbol.to_s.rtmize
|
81
81
|
return RTMMethodSpace.new(rtm_object,@endpoint)
|
82
82
|
else
|
83
83
|
return super(symbol,*args)
|
@@ -87,7 +87,7 @@ module RTM
|
|
87
87
|
end
|
88
88
|
|
89
89
|
# Generic means of calling an RTM method. This is returned by RTM.method_missing and, in most cases, is
|
90
|
-
# the end point that calls an RTM method.
|
90
|
+
# the end point that calls an RTM method.
|
91
91
|
class RTMMethodSpace
|
92
92
|
|
93
93
|
# Create an RTMMethodSpace
|
@@ -125,7 +125,7 @@ module RTM
|
|
125
125
|
if (@name == 'tasks' && symbol.to_s == 'notes')
|
126
126
|
return RTMMethodSpace.new("tasks.notes",@endpoint)
|
127
127
|
else
|
128
|
-
rtm_method = "rtm.#{@name}.#{symbol.to_s.
|
128
|
+
rtm_method = "rtm.#{@name}.#{symbol.to_s.rtmize}"
|
129
129
|
@endpoint.call_method(rtm_method,*args)
|
130
130
|
end
|
131
131
|
end
|
@@ -143,3 +143,4 @@ module RTM
|
|
143
143
|
class NoTokenException < Exception
|
144
144
|
end
|
145
145
|
end
|
146
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moocow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Copeland
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-11-09 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -42,7 +42,7 @@ extra_rdoc_files:
|
|
42
42
|
- README.rdoc
|
43
43
|
files:
|
44
44
|
- ext/hash_array.rb
|
45
|
-
- ext/
|
45
|
+
- ext/string_rtmize.rb
|
46
46
|
- lib/moocow/auth.rb
|
47
47
|
- lib/moocow/endpoint.rb
|
48
48
|
- lib/moocow/moocow.rb
|