rubycious 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/lib/client_helper.rb +3 -22
- data/lib/errors.rb +5 -0
- data/lib/rubycious.rb +3 -3
- data/rubycious.gemspec +5 -4
- metadata +22 -6
data/Rakefile
CHANGED
|
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
|
2
2
|
require 'rake'
|
|
3
3
|
require 'echoe'
|
|
4
4
|
|
|
5
|
-
Echoe.new('rubycious', '0.1.
|
|
5
|
+
Echoe.new('rubycious', '0.1.4') do |p|
|
|
6
6
|
p.description = "Ruby wrapper to the del.icio.us API"
|
|
7
7
|
p.url = "http://github.com/rjsvaljean/rubycious"
|
|
8
8
|
p.author = "Ratan Sebastian"
|
data/lib/client_helper.rb
CHANGED
|
@@ -5,36 +5,17 @@ module ClientHelper
|
|
|
5
5
|
include Rubycious::Errors
|
|
6
6
|
|
|
7
7
|
base_uri "https://api.del.icio.us/v1"
|
|
8
|
-
basic_auth base.new.username, base.new.password
|
|
9
8
|
format :xml
|
|
10
9
|
|
|
10
|
+
attr_accessor :username, :password
|
|
11
|
+
|
|
11
12
|
def initialize(auth_options = {:username => nil, :password => nil})
|
|
12
13
|
@username, @password= auth_options[:username], auth_options[:password]
|
|
14
|
+
self.class.basic_auth @username, @password
|
|
13
15
|
end
|
|
14
16
|
end
|
|
15
17
|
end
|
|
16
18
|
|
|
17
|
-
def config
|
|
18
|
-
@config= YAML::load(File.read(File.join(ROOT_DIR,'config','auth.yml')))
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def username
|
|
22
|
-
if username = self.instance_variable_get('@username') || config["username"]
|
|
23
|
-
instance_variable_set('@username', username)
|
|
24
|
-
username
|
|
25
|
-
else
|
|
26
|
-
raise AuthenticationError, "Couldn't find username"
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def password
|
|
31
|
-
if password = self.instance_variable_get('@username') || config["password"]
|
|
32
|
-
instance_variable_set('@password', password)
|
|
33
|
-
password
|
|
34
|
-
else
|
|
35
|
-
raise AuthenticationError, "Couldn't find password"
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
19
|
|
|
39
20
|
end
|
|
40
21
|
|
data/lib/errors.rb
CHANGED
|
@@ -15,6 +15,11 @@ module Rubycious::Errors
|
|
|
15
15
|
def handle_errors
|
|
16
16
|
response= yield
|
|
17
17
|
if response.keys.include?("result")
|
|
18
|
+
if response["result"].keys.include?("code")
|
|
19
|
+
if response["result"]["code"].match("access denied")
|
|
20
|
+
raise AuthenticationError, "Access denied to the API"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
18
23
|
if response["result"].match("done")
|
|
19
24
|
response
|
|
20
25
|
else
|
data/lib/rubycious.rb
CHANGED
|
@@ -91,6 +91,6 @@ module Rubycious
|
|
|
91
91
|
end
|
|
92
92
|
end
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
require File.join(ROOT_DIR, 'lib', 'errors.rb')
|
|
95
|
+
require File.join(ROOT_DIR, 'lib', 'client_helper.rb')
|
|
96
|
+
require File.join(ROOT_DIR, 'lib', 'client.rb')
|
data/rubycious.gemspec
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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.4"
|
|
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"]
|
|
@@ -17,17 +17,18 @@ Gem::Specification.new do |s|
|
|
|
17
17
|
s.rubyforge_project = %q{rubycious}
|
|
18
18
|
s.rubygems_version = %q{1.3.7}
|
|
19
19
|
s.summary = %q{Ruby wrapper to the del.icio.us API}
|
|
20
|
+
s.add_dependency(%q<httparty>, [">= 0.5"])
|
|
20
21
|
|
|
21
22
|
if s.respond_to? :specification_version then
|
|
22
23
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
23
24
|
s.specification_version = 3
|
|
24
25
|
|
|
25
26
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
26
|
-
s.add_development_dependency(%q<httparty>, [">= 0"])
|
|
27
|
+
s.add_development_dependency(%q<httparty>, [">= 0.5"])
|
|
27
28
|
else
|
|
28
|
-
s.add_dependency(%q<httparty>, [">= 0"])
|
|
29
|
+
s.add_dependency(%q<httparty>, [">= 0.5"])
|
|
29
30
|
end
|
|
30
31
|
else
|
|
31
|
-
s.add_dependency(%q<httparty>, [">= 0"])
|
|
32
|
+
s.add_dependency(%q<httparty>, [">= 0.5"])
|
|
32
33
|
end
|
|
33
34
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rubycious
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 19
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 1
|
|
9
|
-
-
|
|
10
|
-
version: 0.1.
|
|
9
|
+
- 4
|
|
10
|
+
version: 0.1.4
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Ratan Sebastian
|
|
@@ -26,12 +26,28 @@ dependencies:
|
|
|
26
26
|
requirements:
|
|
27
27
|
- - ">="
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
|
-
hash:
|
|
29
|
+
hash: 1
|
|
30
30
|
segments:
|
|
31
31
|
- 0
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
- 5
|
|
33
|
+
version: "0.5"
|
|
34
|
+
type: :runtime
|
|
34
35
|
version_requirements: *id001
|
|
36
|
+
- !ruby/object:Gem::Dependency
|
|
37
|
+
name: httparty
|
|
38
|
+
prerelease: false
|
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
|
40
|
+
none: false
|
|
41
|
+
requirements:
|
|
42
|
+
- - ">="
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
hash: 1
|
|
45
|
+
segments:
|
|
46
|
+
- 0
|
|
47
|
+
- 5
|
|
48
|
+
version: "0.5"
|
|
49
|
+
type: :development
|
|
50
|
+
version_requirements: *id002
|
|
35
51
|
description: Ruby wrapper to the del.icio.us API
|
|
36
52
|
email: rjsvaljean@gmail.com
|
|
37
53
|
executables: []
|