rubycious 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.rdoc +23 -0
- data/Manifest +5 -2
- data/README.rdoc +13 -0
- data/Rakefile +3 -3
- data/lib/client.rb +168 -0
- data/lib/errors.rb +27 -0
- data/lib/rubycious.rb +48 -152
- data/rubycious.gemspec +10 -7
- metadata +41 -10
- data/config/auth.yml +0 -2
data/LICENSE.rdoc
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
=Copyright (c) <2010> <Ratan Sebastian>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
4
|
+
obtaining a copy of this software and associated documentation
|
5
|
+
files (the "Software"), to deal in the Software without
|
6
|
+
restriction, including without limitation the rights to use,
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the
|
9
|
+
Software is furnished to do so, subject to the following
|
10
|
+
conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
data/Manifest
CHANGED
data/README.rdoc
CHANGED
@@ -1,3 +1,16 @@
|
|
1
1
|
= Rubycious
|
2
2
|
|
3
3
|
A Ruby gem wrapper to the del.icio.us API. nuff' said.
|
4
|
+
|
5
|
+
== Examples
|
6
|
+
|
7
|
+
require 'rubycious'
|
8
|
+
include Rubycious
|
9
|
+
|
10
|
+
post_client= Client::Post.new(:username => "delicious_username", :password => "delicious_password")
|
11
|
+
post_client.all(:tag => "testing")
|
12
|
+
post_client.recent
|
13
|
+
post_client.get(:tag => "tutorial+ruby")
|
14
|
+
|
15
|
+
tag_client= Rubycious::Client::Tag.new(:username => "delicious_username", :password => "delicious_password")
|
16
|
+
tag_client.all
|
data/Rakefile
CHANGED
@@ -2,13 +2,13 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('rubycious', '0.1.
|
5
|
+
Echoe.new('rubycious', '0.1.2') do |p|
|
6
6
|
p.description = "Ruby wrapper to the del.icio.us API"
|
7
|
-
p.url = "http://github.com/
|
7
|
+
p.url = "http://github.com/rjsvaljean/rubycious"
|
8
8
|
p.author = "Ratan Sebastian"
|
9
9
|
p.email = "rjsvaljean@gmail.com"
|
10
10
|
p.ignore_pattern = ["tmp/*", "script/*"]
|
11
|
-
p.development_dependencies = []
|
11
|
+
p.development_dependencies = ["httparty"]
|
12
12
|
end
|
13
13
|
|
14
14
|
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
data/lib/client.rb
ADDED
@@ -0,0 +1,168 @@
|
|
1
|
+
# @author Ratan Sebastian
|
2
|
+
# The Client module contains the Client classes Post, Tag and Bundle
|
3
|
+
module Rubycious::Client
|
4
|
+
|
5
|
+
|
6
|
+
# The Post Client class that is used to make post related requests
|
7
|
+
class Post
|
8
|
+
include ClientHelper
|
9
|
+
|
10
|
+
base_uri "#{base_uri}/posts"
|
11
|
+
|
12
|
+
# Get the time of the last request
|
13
|
+
# @return [Time] Returns the time of the last request in UTC
|
14
|
+
def self.last_update
|
15
|
+
response= self.new.handle_errors do
|
16
|
+
get('/update')
|
17
|
+
end
|
18
|
+
Time.parse(response["update"]["time"])
|
19
|
+
end
|
20
|
+
|
21
|
+
# Save a URL
|
22
|
+
# DO NOT call this method directly. To create a new URL call Rubycious::Post#save
|
23
|
+
# @param [Hash] options for creating the URL with
|
24
|
+
# @option options [String] :url |required| http://somelink.com/somepage
|
25
|
+
# @option options [String] :description |required| This is a really cool link
|
26
|
+
# @option options [String] :dt |optional| Format: Time#iso8601 filter by date
|
27
|
+
# @option options [String] :hash |optional| MD5+MD5+....+MD5 Fetch multiple
|
28
|
+
# bookmarks by one or more URL MD5s regardless of date,
|
29
|
+
# separated by URL-encoded spaces (ie. '+').
|
30
|
+
# @option options [String] :extended |optional| This is some further information
|
31
|
+
# @option options [String] :tags |optional| space separated list of tags
|
32
|
+
# @option options [String] :replace |optional| yes/no Replace URL if already exists
|
33
|
+
# @option options [String] :shared |optional| yes/no Public/Private
|
34
|
+
# @private
|
35
|
+
# @see Rubycious::Post#save
|
36
|
+
def save(options = {})
|
37
|
+
handle_errors { self.class.get('/add', :query => options) }
|
38
|
+
end
|
39
|
+
|
40
|
+
# Use for getting one or more URLs on a single day matching the arguments
|
41
|
+
# @param [Hash] options for searching for the URL (all optional)
|
42
|
+
# @option options [String] :tag "ruby+rails+httparty"
|
43
|
+
# @option options [String] :dt CCYY-MM-DDThh:mm:ssZ Time#iso8601
|
44
|
+
# @option options [String] :url URL
|
45
|
+
# @option options [String] :hashes "c0...d+2f970...fe+..+2f...9fe"
|
46
|
+
# @option options [String] :meta yes/no whether or not to get the meta hash tag
|
47
|
+
# @return [Array<Rubycious::Post>, Rubycious::Post]
|
48
|
+
# @see Time#iso8601
|
49
|
+
def get(options = {})
|
50
|
+
response= handle_errors { self.class.get('/get', :query => options)}
|
51
|
+
if response["posts"]["post"].is_a?(Hash)
|
52
|
+
Rubycious::Post.new response["posts"]["post"]
|
53
|
+
elsif response["posts"]["post"].is_a?(Array)
|
54
|
+
response["posts"]["post"].collect{|i| Rubycious::Post.new(i)}
|
55
|
+
else
|
56
|
+
nil
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# Use for searching all URLs
|
61
|
+
# NOTE: Use Sparingly. Call the update function to see if you need to fetch this at all.
|
62
|
+
# @todo Look into caching these results
|
63
|
+
# check the last update time before performing
|
64
|
+
# @param [Hash] options for searching for the URL (all optional)
|
65
|
+
# @option options [String] :tag |optional| "ruby"
|
66
|
+
# @option options [String] :start |optional| Integer: Start returning posts this
|
67
|
+
# many results into the set
|
68
|
+
# @option options [String] :results |optional| Integer: Return these many results
|
69
|
+
# @option options [String] :fromdt |optional| Format: Time#iso8601: On this date or later
|
70
|
+
# @option options [String] :todt |optional| Format: Time#iso8601: On this date or earlier
|
71
|
+
# @option options [String] :meta |optional| yes/no: Include change detection signatures
|
72
|
+
# on each item in a 'meta' attribute. Clients wishing to maintain a
|
73
|
+
# synchronized local store of bookmarks should retain the
|
74
|
+
# value of this attribute - its value will change when any
|
75
|
+
# significant field of the bookmark changes.
|
76
|
+
# @return [Array<Rubycious::Post>]
|
77
|
+
# @see Time#iso8601
|
78
|
+
def all(options = {})
|
79
|
+
response= handle_errors { self.class.get('/all', :query => options)}
|
80
|
+
response["posts"]["post"].collect{|i| Rubycious::Post.new(i)}
|
81
|
+
end
|
82
|
+
|
83
|
+
# Use to get recent URLs
|
84
|
+
# @param [Hash] options to filter recent URLs(all optional)
|
85
|
+
# @option options [String] :tag |optional| "httparty"
|
86
|
+
# @option options [String] :count (15) |optional| Default: 15 Max: 100
|
87
|
+
# @return [Array<Rubycious::Post>]
|
88
|
+
def recent(options = {})
|
89
|
+
response= handle_errors { self.class.get('/recent', :query => options)}
|
90
|
+
response["posts"]["post"].collect{|i| Rubycious::Post.new(i)}
|
91
|
+
end
|
92
|
+
|
93
|
+
# Use to get a list of dates and number of posts on that date
|
94
|
+
# @param [Hash] options to filter URLs(all optional)
|
95
|
+
# @option options [String] :tag |optional| "tutorial"
|
96
|
+
# @return [Array<Rubycious::PostDate>]
|
97
|
+
def dates(options = {})
|
98
|
+
response= handle_errors{ self.class.get('/dates', :query => options)}
|
99
|
+
response["dates"]["date"].collect{|i| Rubycious::PostDate.new(i)}
|
100
|
+
end
|
101
|
+
|
102
|
+
# Use to get a list of Suggested tags for a URL
|
103
|
+
# @param [Hash] options containing the URL
|
104
|
+
# @option options [String] :url =|required| URL
|
105
|
+
# @return [Hash]
|
106
|
+
# @example Sample returned hash:
|
107
|
+
# Rubycious::Client::Post.suggest("http://google.com")
|
108
|
+
# #=> {"recommended"=>["search", "google", "web", "reference",
|
109
|
+
# "internet", "tools", "research", "imported",
|
110
|
+
# "news", "images", "resources"],
|
111
|
+
# "popular"=>["search", "google", "searchengine", "engine"],
|
112
|
+
# "network"=>["google", "searchengineo"]}
|
113
|
+
|
114
|
+
def suggest(options = {})
|
115
|
+
response= handle_errors{ self.class.get('/suggest', :query => options)}
|
116
|
+
response["suggest"]
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
# The Rubycious::Client::Tag class handles all requests, tag related
|
121
|
+
class Tag
|
122
|
+
include ClientHelper
|
123
|
+
|
124
|
+
base_uri "#{base_uri}/tags"
|
125
|
+
|
126
|
+
# Use to get all tags
|
127
|
+
# @return [Array<Rubycious::Tag>]
|
128
|
+
def all
|
129
|
+
response= handle_errors{ self.class.get('/get')}
|
130
|
+
response["tags"]["tag"].collect do |tag|
|
131
|
+
t= Rubycious::Tag.new(tag)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
# @param [Hash] options to identify the tag to delete
|
136
|
+
# @option options [String] :tag |required|
|
137
|
+
# @return [TrueClass, FalseClass]
|
138
|
+
def delete(options)
|
139
|
+
response= handle_errors{ self.class.get('/delete', :query => options)}
|
140
|
+
if response["result"] == "done"
|
141
|
+
true
|
142
|
+
else
|
143
|
+
false
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# @param [Hash] options of the old and the new name for a tag
|
148
|
+
# @option options [String] :old |required|
|
149
|
+
# @option options [String] :new |required|
|
150
|
+
# @return [TrueClass, FalseClass]
|
151
|
+
def rename(options)
|
152
|
+
response= handle_errors{ self.class.get('/rename', :query => options)}
|
153
|
+
if response["result"] == "done"
|
154
|
+
true
|
155
|
+
else
|
156
|
+
false
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
# Will Implement the bundles part of the API when done
|
162
|
+
# @todo To Be Implemented
|
163
|
+
class Bundles
|
164
|
+
include ClientHelper
|
165
|
+
|
166
|
+
base_uri "#{base_uri}/tags/bundles"
|
167
|
+
end
|
168
|
+
end
|
data/lib/errors.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
module Rubycious::Errors
|
2
|
+
|
3
|
+
# Raised whenever there is some sort of failure on the remote end
|
4
|
+
class DeliciousError < StandardError
|
5
|
+
end
|
6
|
+
|
7
|
+
# Raised when del.icio.us returns an access denied
|
8
|
+
class AuthenticationError < StandardError
|
9
|
+
end
|
10
|
+
|
11
|
+
# surrounds all HTTParty#get calls to check for failure or throttling by del.icio.us
|
12
|
+
# @yield The block contains and network calls to the del.icio.us API
|
13
|
+
# @todo Make more stringent and give better error messages
|
14
|
+
# @raise [DeliciousError]
|
15
|
+
def handle_errors
|
16
|
+
response= yield
|
17
|
+
if response.keys.include?("result")
|
18
|
+
if response["result"].match("done")
|
19
|
+
response
|
20
|
+
else
|
21
|
+
raise DeliciousError, response["result"]["code"]
|
22
|
+
end
|
23
|
+
else
|
24
|
+
response
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/rubycious.rb
CHANGED
@@ -1,171 +1,53 @@
|
|
1
1
|
require 'httparty'
|
2
2
|
|
3
3
|
ROOT_DIR= File.join(File.dirname(__FILE__),'..')
|
4
|
-
# load File.join(ROOT_DIR, 'lib', 'errors.rb')
|
5
|
-
load File.join(ROOT_DIR, 'lib', 'client_helper.rb')
|
6
|
-
# load File.join(ROOT_DIR, 'lib', 'client.rb')
|
7
4
|
|
8
5
|
module Rubycious
|
9
|
-
|
10
|
-
|
11
|
-
module Errors
|
12
|
-
|
13
|
-
class DeliciousError < StandardError
|
14
|
-
end
|
15
|
-
|
16
|
-
class AuthenticationError < StandardError
|
17
|
-
end
|
18
|
-
|
19
|
-
def handle_errors
|
20
|
-
response= yield
|
21
|
-
if response.keys.include?("result")
|
22
|
-
if response["result"].match("done")
|
23
|
-
response
|
24
|
-
else
|
25
|
-
raise DeliciousError, response["result"]["code"]
|
26
|
-
end
|
27
|
-
else
|
28
|
-
response
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
module Client
|
34
|
-
def self.last_update
|
35
|
-
response= self.new.handle_errors do
|
36
|
-
get('/posts/update')
|
37
|
-
end
|
38
|
-
Time.parse(response["update"]["time"])
|
39
|
-
end
|
40
|
-
|
41
|
-
class Post
|
42
|
-
include ClientHelper
|
43
|
-
|
44
|
-
base_uri "#{base_uri}/posts"
|
45
|
-
|
46
|
-
# Options
|
47
|
-
# :url => (required) http://somelink.com/somepage
|
48
|
-
# :description => (required) This is a really cool link that I found
|
49
|
-
# :dt => (optional) CCYY-MM-DDThh:mm:ssZ filter by date
|
50
|
-
# :hash => (optional) MD5+MD5+....+MD5 Fetch multiple bookmarks by one or more URL MD5s regardless of date, separated by URL-encoded spaces (ie. '+').
|
51
|
-
# :extended => (optional) This is some further information about the link
|
52
|
-
# :tags => (optional) space seporated list of tags
|
53
|
-
# :replace => (optional) yes/no
|
54
|
-
# :shared => (optional) yes/no
|
55
|
-
def save
|
56
|
-
handle_errors { self.class.get('/add', :query => @options) }
|
57
|
-
end
|
58
|
-
|
59
|
-
# Options:
|
60
|
-
# :tag => "ruby+rails+httparty"
|
61
|
-
# :dt => CCYY-MM-DDThh:mm:ssZ
|
62
|
-
# :url => URL
|
63
|
-
# :hashes => "c0238dc0c44f07daedd9a1fd9bbdeebd+2f9704c729e7ed3b41647b7d0ad649fe+..+2f9704c729e7ed3b41647b7d0ad649fe"
|
64
|
-
# :meta => yes/no to indicate whether or not to retreive the meta hash tag
|
65
|
-
# METHOD DEPRECATED due to uselessness
|
66
|
-
def find_latest(options)
|
67
|
-
response= handle_errors { self.class.get('/get', :query => options)}
|
68
|
-
response["posts"]
|
69
|
-
end
|
70
|
-
|
71
|
-
# Options:
|
72
|
-
# :tag =>(optional) "ruby"
|
73
|
-
# :start =>(optional) Integer: Start returning posts this many results into the set
|
74
|
-
# :results =>(optional) Integer: Return these many results
|
75
|
-
# :fromdt =>(optional) {Time#iso8601}: On this date or later
|
76
|
-
# :todt =>(optional) {Time#iso8601}: On this date or earlier
|
77
|
-
# :meta =>(optional) yes/no: Include change detection signatures on each item in a 'meta' attribute. Clients wishing to maintain a synchronized local store of bookmarks should retain the value of this attribute - its value will change when any significant field of the bookmark changes.
|
78
|
-
# NOTE: Use Sparingly. Call the update function to see if you need to fetch this at all.
|
79
|
-
def find(options)
|
80
|
-
response= handle_errors { self.class.get('/all', :query => options)}
|
81
|
-
response["posts"]["post"].collect{|i| Rubycious::Post.new(i)}
|
82
|
-
end
|
83
|
-
|
84
|
-
# Options:
|
85
|
-
# :tag => (optional) "httparty"
|
86
|
-
# :count => (optional) Integer // Default: 15 Max: 100
|
87
|
-
def recent(options = nil)
|
88
|
-
response= handle_errors { self.class.get('/recent', :query => options)}
|
89
|
-
response["posts"]["post"].collect{|i| Rubycious::Post.new(i)}
|
90
|
-
end
|
91
|
-
|
92
|
-
# Options:
|
93
|
-
# :tag => (optional) "tutorial"
|
94
|
-
def dates(options = nil)
|
95
|
-
response= handle_errors{ self.class.get('/dates', :query => options)}
|
96
|
-
response["dates"]["date"].collect{|i| Rubycious::PostDate.new(i)}
|
97
|
-
end
|
98
|
-
|
99
|
-
# Options:
|
100
|
-
# :url => (required) URL
|
101
|
-
def suggest(options)
|
102
|
-
response= handle_errors{ self.class.get('/suggest', :query => options)}
|
103
|
-
response["suggest"]
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
class Tag
|
108
|
-
include ClientHelper
|
109
|
-
|
110
|
-
base_uri "#{base_uri}/tags"
|
111
|
-
|
112
|
-
def all
|
113
|
-
response= handle_errors{ self.class.get('/get')}
|
114
|
-
response["tags"]["tag"].collect do |tag|
|
115
|
-
t= Rubycious::Tag.new(tag)
|
116
|
-
end
|
117
|
-
end
|
118
|
-
#Options:
|
119
|
-
# :tag => (required)
|
120
|
-
def delete(options)
|
121
|
-
response= handle_errors{ self.class.get('/delete', :query => options)}
|
122
|
-
true if response["result"] == "done"
|
123
|
-
end
|
124
|
-
|
125
|
-
#Options:
|
126
|
-
# :old => (required)
|
127
|
-
# :new => (required)
|
128
|
-
def rename(options)
|
129
|
-
response= handle_errors{ self.class.get('/rename', :query => options)}
|
130
|
-
true if response["result"] == "done"
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
class Bundles
|
135
|
-
include ClientHelper
|
136
|
-
|
137
|
-
base_uri "#{base_uri}/tags/bundles"
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
6
|
+
# This is type for calls to Rubycious::Client::Post#dates
|
141
7
|
class PostDate
|
142
|
-
# Attributes:
|
143
|
-
# date: Date
|
144
|
-
# count: Integer
|
145
8
|
|
146
|
-
|
9
|
+
# @return [Date]
|
10
|
+
attr_accessor :date
|
11
|
+
# @return [Integer]
|
12
|
+
attr_accessor :count
|
147
13
|
|
14
|
+
# @param [Hash] options to create the PostDate
|
15
|
+
# @option options [String] Format: "yyyy-mm-dd"
|
16
|
+
# @option options [String] Integer as a string
|
148
17
|
def initialize(options)
|
149
18
|
@date= Date.parse(options["date"])
|
150
19
|
@count= options["count"].to_i
|
151
20
|
end
|
152
21
|
end
|
153
22
|
|
23
|
+
# This is the class that will model an URL returned by the API
|
154
24
|
class Post
|
155
|
-
# Attributes
|
156
|
-
# :href => (required) http://somelink.com/somepage
|
157
|
-
# :description => (required) This is a really cool link that I found
|
158
|
-
# :time => (optional) CCYY-MM-DDThh:mm:ssZ filter by date
|
159
|
-
# :hash => (optional) (only for find) MD5+MD5+....+MD5 Fetch multiple bookmarks by one or more URL MD5s regardless of date, separated by URL-encoded spaces (ie. '+').
|
160
|
-
# :extended => (optional) This is some further information about the link
|
161
|
-
# :tag => (optional) space seporated list of tags
|
162
|
-
# :meta => (optional) meta hash
|
163
25
|
|
26
|
+
# The methods [:href, :description, :time, :hash, :extended, :tag, :meta]
|
27
|
+
# can be called on a Post object
|
28
|
+
# @param [Hash] options to create the Post
|
29
|
+
# @option options [String] :href |required for #save| http://somelink.com/somepage
|
30
|
+
# @option options [String] :description |required for #save| This is a really cool link that I found
|
31
|
+
# @option options [String] :time |optional| CCYY-MM-DDThh:mm:ssZ filter by date
|
32
|
+
# @option options [String] :hash |optional| (only for find) MD5+MD5+....+MD5
|
33
|
+
# Fetch multiple bookmarks by one or more URL MD5s
|
34
|
+
# regardless of date, separated by URL-encoded spaces (ie. '+').
|
35
|
+
# @option options [String] :extended |optional| This is some further information about the link
|
36
|
+
# @option options [String] :tag |optional| space seporated list of tags
|
37
|
+
# @option options [String] :meta |optional| meta hash
|
164
38
|
def initialize(params = nil)
|
165
39
|
@params= params
|
166
40
|
@attributes= [:href, :description, :time, :hash, :extended, :tag, :meta]
|
167
41
|
end
|
168
42
|
|
43
|
+
# Use to create a new URL
|
44
|
+
# @todo check for url and description before saving and raise errors
|
45
|
+
def save
|
46
|
+
Rubycious::Client::Post.new.save(@params)
|
47
|
+
end
|
48
|
+
|
49
|
+
# The methods [:href, :description, :time, :hash, :extended, :tag, :meta]
|
50
|
+
# can be called on a Post object
|
169
51
|
def method_missing(name, *args, &block)
|
170
52
|
if @attributes.include?(name)
|
171
53
|
if name == :time
|
@@ -179,22 +61,36 @@ module Rubycious
|
|
179
61
|
end
|
180
62
|
end
|
181
63
|
|
64
|
+
# Models Tags returned by the API
|
182
65
|
class Tag
|
183
|
-
|
184
|
-
|
66
|
+
|
67
|
+
# @return [String] name of the tag
|
68
|
+
# @return [Integer] number of times the tag has been used
|
69
|
+
attr_accessor :name
|
70
|
+
attr_accessor :count
|
71
|
+
|
72
|
+
# @param [Hash] options for creating the Tag
|
73
|
+
# @option options [String] "tag" |required| The name of the tag
|
74
|
+
# @option options [String] "count" |optional| The number of times the tag has been used
|
185
75
|
def initialize(options = {"tag" => nil})
|
186
76
|
@name= options["tag"]
|
187
|
-
@count= options["count"]
|
77
|
+
@count= options["count"].to_i
|
78
|
+
@client= Rubycious::Client::Tag.new
|
188
79
|
end
|
189
80
|
|
81
|
+
# @return [TrueClass, FalseClass]
|
190
82
|
def delete
|
191
|
-
client= Rubycious::Client::Tag.new
|
192
83
|
client.delete(:tag => @name)
|
193
84
|
end
|
194
85
|
|
86
|
+
# @param [String] The new name of the tag
|
87
|
+
# @return [TrueClass, FalseClass]
|
195
88
|
def rename(new_name)
|
196
|
-
client= Rubycious::Client::Tag.new
|
197
89
|
client.rename(:old => @name, :new => new_name)
|
198
90
|
end
|
199
91
|
end
|
200
92
|
end
|
93
|
+
|
94
|
+
load File.join(ROOT_DIR, 'lib', 'errors.rb')
|
95
|
+
load File.join(ROOT_DIR, 'lib', 'client_helper.rb')
|
96
|
+
load File.join(ROOT_DIR, 'lib', 'client.rb')
|
data/rubycious.gemspec
CHANGED
@@ -2,29 +2,32 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{rubycious}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Ratan Sebastian"]
|
9
|
-
s.date = %q{2010-
|
9
|
+
s.date = %q{2010-06-15}
|
10
10
|
s.description = %q{Ruby wrapper to the del.icio.us API}
|
11
11
|
s.email = %q{rjsvaljean@gmail.com}
|
12
|
-
s.extra_rdoc_files = ["README.rdoc", "lib/client_helper.rb", "lib/rubycious.rb"]
|
13
|
-
s.files = ["
|
14
|
-
s.homepage = %q{http://github.com/
|
12
|
+
s.extra_rdoc_files = ["LICENSE.rdoc", "README.rdoc", "lib/client.rb", "lib/client_helper.rb", "lib/errors.rb", "lib/rubycious.rb"]
|
13
|
+
s.files = ["LICENSE.rdoc", "README.rdoc", "Rakefile", "lib/client.rb", "lib/client_helper.rb", "lib/errors.rb", "lib/rubycious.rb", "rubycious.gemspec", "Manifest"]
|
14
|
+
s.homepage = %q{http://github.com/rjsvaljean/rubycious}
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rubycious", "--main", "README.rdoc"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = %q{rubycious}
|
18
|
-
s.rubygems_version = %q{1.3.
|
18
|
+
s.rubygems_version = %q{1.3.7}
|
19
19
|
s.summary = %q{Ruby wrapper to the del.icio.us API}
|
20
20
|
|
21
21
|
if s.respond_to? :specification_version then
|
22
22
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
23
23
|
s.specification_version = 3
|
24
24
|
|
25
|
-
if Gem::Version.new(Gem::
|
25
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
+
s.add_development_dependency(%q<httparty>, [">= 0"])
|
26
27
|
else
|
28
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
27
29
|
end
|
28
30
|
else
|
31
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
29
32
|
end
|
30
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubycious
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 31
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Ratan Sebastian
|
@@ -9,10 +15,23 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2010-
|
18
|
+
date: 2010-06-15 00:00:00 +05:30
|
13
19
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: httparty
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
16
35
|
description: Ruby wrapper to the del.icio.us API
|
17
36
|
email: rjsvaljean@gmail.com
|
18
37
|
executables: []
|
@@ -20,19 +39,24 @@ executables: []
|
|
20
39
|
extensions: []
|
21
40
|
|
22
41
|
extra_rdoc_files:
|
42
|
+
- LICENSE.rdoc
|
23
43
|
- README.rdoc
|
44
|
+
- lib/client.rb
|
24
45
|
- lib/client_helper.rb
|
46
|
+
- lib/errors.rb
|
25
47
|
- lib/rubycious.rb
|
26
48
|
files:
|
27
|
-
-
|
49
|
+
- LICENSE.rdoc
|
28
50
|
- README.rdoc
|
29
51
|
- Rakefile
|
30
|
-
-
|
52
|
+
- lib/client.rb
|
31
53
|
- lib/client_helper.rb
|
54
|
+
- lib/errors.rb
|
32
55
|
- lib/rubycious.rb
|
33
56
|
- rubycious.gemspec
|
57
|
+
- Manifest
|
34
58
|
has_rdoc: true
|
35
|
-
homepage: http://github.com/
|
59
|
+
homepage: http://github.com/rjsvaljean/rubycious
|
36
60
|
licenses: []
|
37
61
|
|
38
62
|
post_install_message:
|
@@ -46,21 +70,28 @@ rdoc_options:
|
|
46
70
|
require_paths:
|
47
71
|
- lib
|
48
72
|
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
49
74
|
requirements:
|
50
75
|
- - ">="
|
51
76
|
- !ruby/object:Gem::Version
|
77
|
+
hash: 3
|
78
|
+
segments:
|
79
|
+
- 0
|
52
80
|
version: "0"
|
53
|
-
version:
|
54
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
55
83
|
requirements:
|
56
84
|
- - ">="
|
57
85
|
- !ruby/object:Gem::Version
|
86
|
+
hash: 11
|
87
|
+
segments:
|
88
|
+
- 1
|
89
|
+
- 2
|
58
90
|
version: "1.2"
|
59
|
-
version:
|
60
91
|
requirements: []
|
61
92
|
|
62
93
|
rubyforge_project: rubycious
|
63
|
-
rubygems_version: 1.3.
|
94
|
+
rubygems_version: 1.3.7
|
64
95
|
signing_key:
|
65
96
|
specification_version: 3
|
66
97
|
summary: Ruby wrapper to the del.icio.us API
|
data/config/auth.yml
DELETED