tuiter 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +8 -7
- data/CHANGELOG +5 -0
- data/lib/tuiter/client.rb +11 -2
- data/lib/tuiter/data/direct_message.rb +2 -2
- data/lib/tuiter/data/status.rb +1 -1
- data/lib/tuiter/data/user.rb +16 -36
- data/lib/tuiter/methods/account.rb +1 -1
- data/lib/tuiter/methods/direct_message.rb +1 -1
- data/lib/tuiter/methods/social_graph.rb +8 -1
- data/lib/tuiter/methods/user.rb +1 -1
- metadata +3 -3
data/AUTHORS
CHANGED
@@ -7,11 +7,12 @@ Both projects were latter adopted by WebCo Internet (http://webcointernet.com -
|
|
7
7
|
|
8
8
|
The authors and contributors of Tuiter are:
|
9
9
|
|
10
|
-
* Manoel Lemos (manoel@lemos.net - http://
|
11
|
-
* Celestino Gomes (tinorj@gmail.com - http://
|
12
|
-
* Leandro Silva (leandrodoze@gmail.com - http://
|
13
|
-
* Lucas Fais (lfais@webcointernet.com - http://
|
14
|
-
* Lucas Húngaro (lucashungaro@gmail.com - http://
|
15
|
-
* Luis Cipriani (lfcipriani@talleye.com - http://
|
16
|
-
* Luiz Rocha (lsdr@lsdr.net - http://
|
10
|
+
* Manoel Lemos (manoel@lemos.net - http://github.com/mlemos) - initial work
|
11
|
+
* Celestino Gomes (tinorj@gmail.com - http://github.com/tinogomes)
|
12
|
+
* Leandro Silva (leandrodoze@gmail.com - http://github.com/leandrosilva)
|
13
|
+
* Lucas Fais (lfais@webcointernet.com - http://github.com/lucasfais)
|
14
|
+
* Lucas Húngaro (lucashungaro@gmail.com - http://github.com/lucashungaro)
|
15
|
+
* Luis Cipriani (lfcipriani@talleye.com - http://github.com/lfcipriani)
|
16
|
+
* Luiz Rocha (lsdr@lsdr.net - http://github.com/lsdr)
|
17
|
+
* Thomaz Leite (thomaz@leite.me - http://github.com/thomaz)
|
17
18
|
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== v0.0.7
|
2
|
+
* Updated User object. It no longer has Basic and Extended versions
|
3
|
+
* Small bugfix, to make username avaliable thru all Tuiter::CLient objects
|
4
|
+
* friends/ids API call implemented
|
5
|
+
|
1
6
|
== v0.0.6
|
2
7
|
* Added OAuth support
|
3
8
|
* Http Basic Authentication is still supported and old users won't need to change any code base
|
data/lib/tuiter/client.rb
CHANGED
@@ -7,7 +7,7 @@ module Tuiter
|
|
7
7
|
include Tuiter::FriendshipMethods
|
8
8
|
include Tuiter::SocialGraphMethods
|
9
9
|
include Tuiter::AccountMethods
|
10
|
-
|
10
|
+
|
11
11
|
def initialize(options = {})
|
12
12
|
@pid = Process.pid
|
13
13
|
@logger = options[:logger] || Logger.new('tuiter.log')
|
@@ -31,7 +31,16 @@ module Tuiter
|
|
31
31
|
|
32
32
|
def authorized?
|
33
33
|
oauth_response = @request_handler.get('/account/verify_credentials.json')
|
34
|
-
|
34
|
+
if oauth_response.class == Net::HTTPOK
|
35
|
+
@username = JSON.parse(oauth_response.body)[:username]
|
36
|
+
true
|
37
|
+
else
|
38
|
+
false
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def username
|
43
|
+
@username ||= account_verify_credentials?.screen_name
|
35
44
|
end
|
36
45
|
|
37
46
|
private
|
@@ -33,8 +33,8 @@ module Tuiter
|
|
33
33
|
def initialize(data = nil)
|
34
34
|
unless data.nil?
|
35
35
|
super(data)
|
36
|
-
@sender =
|
37
|
-
@recipient =
|
36
|
+
@sender = User.new(data['sender'])
|
37
|
+
@recipient = User.new(data['recipient'])
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
data/lib/tuiter/data/status.rb
CHANGED
data/lib/tuiter/data/user.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Tuiter
|
2
2
|
|
3
|
-
|
3
|
+
class User
|
4
4
|
attr_accessor :id
|
5
5
|
attr_accessor :name
|
6
6
|
attr_accessor :screen_name
|
@@ -10,24 +10,6 @@ module Tuiter
|
|
10
10
|
attr_accessor :url
|
11
11
|
attr_accessor :protected
|
12
12
|
attr_accessor :followers_count
|
13
|
-
|
14
|
-
def initialize(data = nil)
|
15
|
-
unless data.nil?
|
16
|
-
@id = data["id"]
|
17
|
-
@name = data["name"]
|
18
|
-
@screen_name = data["screen_name"]
|
19
|
-
@location = data["location"]
|
20
|
-
@description = data["description"]
|
21
|
-
@profile_image_url = data["profile_image_url"]
|
22
|
-
@url = data["url"]
|
23
|
-
@protected = data["protected"]
|
24
|
-
@followers_count = data["followers_count"]
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
class UserExtended < UserBasic
|
31
13
|
attr_accessor :profile_background_color
|
32
14
|
attr_accessor :profile_text_color
|
33
15
|
attr_accessor :profile_link_color
|
@@ -40,13 +22,22 @@ module Tuiter
|
|
40
22
|
attr_accessor :time_zone
|
41
23
|
attr_accessor :profile_background_image_url
|
42
24
|
attr_accessor :profile_background_tile
|
43
|
-
attr_accessor :following
|
44
|
-
attr_accessor :notifications
|
45
25
|
attr_accessor :statuses_count
|
26
|
+
attr_accessor :notifications
|
27
|
+
attr_accessor :following
|
28
|
+
attr_accessor :status
|
46
29
|
|
47
30
|
def initialize(data = nil)
|
48
31
|
unless data.nil?
|
49
|
-
|
32
|
+
@id = data["id"]
|
33
|
+
@name = data["name"]
|
34
|
+
@screen_name = data["screen_name"]
|
35
|
+
@location = data["location"]
|
36
|
+
@description = data["description"]
|
37
|
+
@profile_image_url = data["profile_image_url"]
|
38
|
+
@url = data["url"]
|
39
|
+
@protected = data["protected"]
|
40
|
+
@followers_count = data["followers_count"]
|
50
41
|
@profile_background_color = data["profile_background_color"]
|
51
42
|
@profile_text_color = data["profile_text_color"]
|
52
43
|
@profile_link_color = data["profile_link_color"]
|
@@ -59,9 +50,10 @@ module Tuiter
|
|
59
50
|
@time_zone = data["time_zone"]
|
60
51
|
@profile_background_image_url = data["profile_background_image_url"]
|
61
52
|
@profile_background_tile = data["profile_background_tile"]
|
62
|
-
@following = data["following"]
|
63
|
-
@notifications = data["notifications"]
|
64
53
|
@statuses_count = data["statuses_count"].to_i
|
54
|
+
@notifications = data["notifications"]
|
55
|
+
@following = data["following"]
|
56
|
+
@status = StatusBasic.new(data["status"])
|
65
57
|
else
|
66
58
|
@created_at = DateTime.now
|
67
59
|
end
|
@@ -69,17 +61,5 @@ module Tuiter
|
|
69
61
|
|
70
62
|
end
|
71
63
|
|
72
|
-
class User < UserBasic
|
73
|
-
attr_accessor :status
|
74
|
-
|
75
|
-
def initialize(data=nil)
|
76
|
-
unless data.nil?
|
77
|
-
super(data)
|
78
|
-
@status = StatusBasic.new(data["status"])
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|
83
|
-
|
84
64
|
end
|
85
65
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Social Graph Methods
|
2
|
-
# [
|
2
|
+
# [X] friends/ids
|
3
3
|
# [X] followers/ids
|
4
4
|
|
5
5
|
module Tuiter
|
@@ -14,6 +14,13 @@ module Tuiter
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
def friends_ids
|
18
|
+
if res = @request_handler.get("http://twitter.com/friends/ids/#{username}.json").body
|
19
|
+
return JSON.parse(res)
|
20
|
+
else
|
21
|
+
return nil
|
22
|
+
end
|
23
|
+
end
|
17
24
|
end
|
18
25
|
|
19
26
|
end
|
data/lib/tuiter/methods/user.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tuiter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manoel Lemos
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-05-
|
13
|
+
date: 2009-05-09 00:00:00 -03:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -31,7 +31,7 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.3.
|
34
|
+
version: 0.3.4
|
35
35
|
version:
|
36
36
|
description: Yet another Twitter API wrapper library in Ruby
|
37
37
|
email: opensource@webcointernet.com
|