pupil 0.6.3 → 0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +5 -3
- data/.travis.yml +2 -1
- data/CHANGELOG.md +5 -0
- data/lib/pupil/account.rb +5 -5
- data/lib/pupil/base.rb +1 -1
- data/lib/pupil/blocks.rb +3 -3
- data/lib/pupil/direct_messages.rb +3 -3
- data/lib/pupil/essentials.rb +3 -1
- data/lib/pupil/friendships.rb +7 -7
- data/lib/pupil/general.rb +2 -2
- data/lib/pupil/help.rb +1 -1
- data/lib/pupil/keygen/base.rb +6 -5
- data/lib/pupil/lists.rb +3 -3
- data/lib/pupil/schemes.rb +14 -14
- data/lib/pupil/search.rb +2 -2
- data/lib/pupil/statuses.rb +13 -13
- data/lib/pupil/users.rb +2 -2
- data/lib/pupil/version.rb +1 -1
- data/pupil.gemspec +3 -3
- data/spec/pupil_spec.rb +4 -4
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a83b6ea368e8cee4148580901d15cef0dc96ddb
|
4
|
+
data.tar.gz: c0a8355ac82b77155a40cfcabf92bbba1295de8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5adf552f71ea91ad3438dd3d2b20967b7d2da6caf7d3a546f3b20b6c750b00071c66aad939aae403ed2e977733a9d209ae41ac088d3bba2b9c7a5aa4ac48242
|
7
|
+
data.tar.gz: 0c7553af3621ddda70b5192d44c34cde48d6724a56b835d3d399045d05c4ee12044a4078533b71f8d244b6b3e4c52f6c0ee073823365bc0952ae71f44dbf1544
|
data/.gitignore
CHANGED
@@ -13,8 +13,6 @@ lib/bundler/man
|
|
13
13
|
pkg
|
14
14
|
rdoc
|
15
15
|
spec/reports
|
16
|
-
spec/keys/pupil_testkey.rb
|
17
|
-
test/
|
18
16
|
tmp/
|
19
17
|
|
20
18
|
# bundler
|
@@ -23,4 +21,8 @@ tmp/
|
|
23
21
|
|
24
22
|
# OS specific
|
25
23
|
.DS_Store
|
26
|
-
Thumbs.db
|
24
|
+
Thumbs.db
|
25
|
+
|
26
|
+
# Testing
|
27
|
+
test/
|
28
|
+
spec/keys/pupil_testkey.rb
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/lib/pupil/account.rb
CHANGED
@@ -2,7 +2,7 @@ class Pupil
|
|
2
2
|
# Verify credentials
|
3
3
|
# @return [Pupil::User] User credentials
|
4
4
|
def verify_credentials
|
5
|
-
response = self.get("
|
5
|
+
response = self.get("account/verify_credentials.json")
|
6
6
|
user = User.new response
|
7
7
|
return user
|
8
8
|
end
|
@@ -12,14 +12,14 @@ class Pupil
|
|
12
12
|
# Rate limit statuses
|
13
13
|
# @return [Hash] Rate limit statuses
|
14
14
|
def rate_limit
|
15
|
-
response = self.get("
|
15
|
+
response = self.get("account/rate_limit_status.json")
|
16
16
|
return response
|
17
17
|
end
|
18
18
|
|
19
19
|
# End oauth session
|
20
20
|
# @return [Hash] Result
|
21
21
|
def end_session
|
22
|
-
response = self.post("
|
22
|
+
response = self.post("account/end_session.json")
|
23
23
|
return response
|
24
24
|
end
|
25
25
|
|
@@ -44,10 +44,10 @@ class Pupil
|
|
44
44
|
opt.update({:profile_sidebar_fill => param[:colors][:sidebar_fill]}) if param[:colors][:sidebar_fill]
|
45
45
|
oot.update({:profile_text_color => param[:colors][:text]}) if param[:colors][:text]
|
46
46
|
param.delete :colors
|
47
|
-
response = self.post("
|
47
|
+
response = self.post("account/update_profile_colors.json", opt)
|
48
48
|
return User.new response if param.size <= 0
|
49
49
|
end
|
50
|
-
response2 = self.post("
|
50
|
+
response2 = self.post("account/update_profile.json", param)
|
51
51
|
return User.new response2
|
52
52
|
end
|
53
53
|
end
|
data/lib/pupil/base.rb
CHANGED
data/lib/pupil/blocks.rb
CHANGED
@@ -2,7 +2,7 @@ class Pupil
|
|
2
2
|
# @param [Fixnum] id id
|
3
3
|
# @return [Pupil::User] response
|
4
4
|
def block(param)
|
5
|
-
response = self.post("
|
5
|
+
response = self.post("blocks/create.json", {guess_parameter(param) => param})
|
6
6
|
|
7
7
|
if response.class == Hash && response["id"]
|
8
8
|
return User.new response
|
@@ -13,7 +13,7 @@ class Pupil
|
|
13
13
|
# @param [Fixnum] id id
|
14
14
|
# @return [Pupil::User] response
|
15
15
|
def unblock(param)
|
16
|
-
response = self.post("
|
16
|
+
response = self.post("blocks/destroy.json", {guess_parameter(param) => param})
|
17
17
|
|
18
18
|
if response.class == Hash && response["id"]
|
19
19
|
return User.new response
|
@@ -23,7 +23,7 @@ class Pupil
|
|
23
23
|
|
24
24
|
# @return [Array] list of blocking users
|
25
25
|
def blocking
|
26
|
-
response = self.get("
|
26
|
+
response = self.get("blocks/list.json")
|
27
27
|
return [] if response["nilclasses"]
|
28
28
|
users = Array.new
|
29
29
|
response["users"].each do |element|
|
@@ -3,7 +3,7 @@ class Pupil
|
|
3
3
|
# @param [Hash] param
|
4
4
|
# @return [Hash] directmessages
|
5
5
|
def direct_messages(param = {})
|
6
|
-
response = self.get("
|
6
|
+
response = self.get("direct_messages.json", param)
|
7
7
|
return false unless response
|
8
8
|
directmessages = Array.new
|
9
9
|
response.each do |element|
|
@@ -18,7 +18,7 @@ class Pupil
|
|
18
18
|
# @param [Hash] param
|
19
19
|
# @return [Hash] directmessage you sent
|
20
20
|
def sent_direct_messages(param = {})
|
21
|
-
response = self.get("
|
21
|
+
response = self.get("direct_messages/sent.json", param)
|
22
22
|
return false unless response
|
23
23
|
directmessages = Array.new
|
24
24
|
response.each do |element|
|
@@ -31,7 +31,7 @@ class Pupil
|
|
31
31
|
|
32
32
|
def send_direct_message(sentence, opts)
|
33
33
|
raise ArgumentError, ":to parameter not given" unless opts[:to]
|
34
|
-
response = self.post("
|
34
|
+
response = self.post("direct_messages/new.json", {:text => sentence, guess_parameter(opts[:to]) => opts[:to]})
|
35
35
|
return false unless response
|
36
36
|
response
|
37
37
|
end
|
data/lib/pupil/essentials.rb
CHANGED
@@ -44,11 +44,13 @@ class Pupil
|
|
44
44
|
|
45
45
|
def get(url, param={})
|
46
46
|
param_s = serialize_parameter(param)
|
47
|
+
puts "/1.1/"+url+param_s
|
47
48
|
begin
|
48
|
-
response = @access_token.get(url+param_s).body
|
49
|
+
response = @access_token.get("/1.1/"+url+param_s).body
|
49
50
|
rescue => vars
|
50
51
|
raise NetworkError, vars
|
51
52
|
end
|
53
|
+
|
52
54
|
result = JSON.parse(response)
|
53
55
|
return (result["errors"].nil? rescue true)? result : false
|
54
56
|
end
|
data/lib/pupil/friendships.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class Pupil
|
2
2
|
def friends_ids(name=@screen_name)
|
3
3
|
name ||= self.profile.screen_name
|
4
|
-
response = self.get("
|
4
|
+
response = self.get("friends/ids.json", {guess_parameter(name) => name})
|
5
5
|
return false unless response
|
6
6
|
ids = []
|
7
7
|
response["ids"].each do |element|
|
@@ -23,7 +23,7 @@ class Pupil
|
|
23
23
|
|
24
24
|
def followers_ids(name=@screen_name)
|
25
25
|
name ||= self.profile.screen_name
|
26
|
-
response = self.get("
|
26
|
+
response = self.get("followers/ids.json", {guess_parameter(name) => name})
|
27
27
|
return false unless response
|
28
28
|
ids = []
|
29
29
|
response["ids"].each do |element|
|
@@ -40,13 +40,13 @@ class Pupil
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def no_retweet_ids()
|
43
|
-
response = self.get("
|
43
|
+
response = self.get("friendships/no_retweet_ids.json")
|
44
44
|
return false unless response
|
45
45
|
return response
|
46
46
|
end
|
47
47
|
|
48
48
|
def outgoing(param={})
|
49
|
-
response = self.get("
|
49
|
+
response = self.get("friendships/outgoing.json")
|
50
50
|
return false unless response
|
51
51
|
ids = []
|
52
52
|
response["ids"].each do |element|
|
@@ -56,7 +56,7 @@ class Pupil
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def incoming(param={})
|
59
|
-
response = self.get("
|
59
|
+
response = self.get("friendships/incoming.json")
|
60
60
|
return false unless response
|
61
61
|
ids = []
|
62
62
|
response["ids"].each do |element|
|
@@ -71,7 +71,7 @@ class Pupil
|
|
71
71
|
# @return [Boolean] return true if paired users have friendship, or ruturn false
|
72
72
|
def friendship?(src, dst)
|
73
73
|
param = {"source_#{guess_parameter(src)}" => src, "target_#{guess_parameter(dst)}" => dst}
|
74
|
-
response = self.get("
|
74
|
+
response = self.get("friendships/show.json", param)
|
75
75
|
return nil unless response
|
76
76
|
if response["relationship"]["source"]["following"] == true && response["relationship"]["target"]["following"] == true then
|
77
77
|
return true
|
@@ -85,7 +85,7 @@ class Pupil
|
|
85
85
|
alias_method "friendships_exists?", "friendship?"
|
86
86
|
|
87
87
|
def update_friendships(target, param)
|
88
|
-
response = self.post("
|
88
|
+
response = self.post("friendships/update.json", param)
|
89
89
|
return false unless response
|
90
90
|
return response
|
91
91
|
end
|
data/lib/pupil/general.rb
CHANGED
@@ -5,7 +5,7 @@ class Pupil
|
|
5
5
|
when :users
|
6
6
|
users = Array.new
|
7
7
|
source.each_slice(100) do |sliced|
|
8
|
-
response = self.get("
|
8
|
+
response = self.get("users/lookup.json", {guess_parameter(sliced[0]) => sliced.join(",")}.update(option))
|
9
9
|
return false unless response
|
10
10
|
response.each do |element|
|
11
11
|
user = User.new(element, @access_token)
|
@@ -17,7 +17,7 @@ class Pupil
|
|
17
17
|
when :friendships
|
18
18
|
fs = Array.new
|
19
19
|
source.each_slice(100) do |sliced|
|
20
|
-
response = self.get("
|
20
|
+
response = self.get("friendships/lookup.json", {guess_parameter(sliced[0]) => sliced.join(",")}.update(option))
|
21
21
|
return false unless response
|
22
22
|
|
23
23
|
response.each do |element|
|
data/lib/pupil/help.rb
CHANGED
data/lib/pupil/keygen/base.rb
CHANGED
@@ -4,6 +4,7 @@ class Pupil
|
|
4
4
|
attr_reader :consumer_secret
|
5
5
|
attr_reader :access_token
|
6
6
|
attr_reader :access_token_secret
|
7
|
+
TWITTER_API_URL = "https://api.twitter.com"
|
7
8
|
class MissingRequiredTokens < StandardError; end
|
8
9
|
|
9
10
|
def initialize(opts={})
|
@@ -13,16 +14,18 @@ class Pupil
|
|
13
14
|
@access_token_secret = opts[:access_token_secret] rescue nil
|
14
15
|
end
|
15
16
|
|
17
|
+
def consumer
|
18
|
+
OAuth::Consumer.new(@consumer_key, @consumer_secret, :site => TWITTER_API_URL)
|
19
|
+
end
|
20
|
+
|
16
21
|
def auth_url
|
17
22
|
raise MissingRequiredTokens, "Pupil::Keygen#auth_url require consumer_key and consumer_secret" unless @consumer_key || @consumer_secret
|
18
|
-
consumer = OAuth::Consumer.new(@consumer_key, @consumer_secret, :site => 'http://twitter.com')
|
19
23
|
request_token = consumer.get_request_token
|
20
24
|
return request_token.authorize_url
|
21
25
|
end
|
22
26
|
|
23
27
|
def issue_token verifier
|
24
28
|
raise MissingRequiredTokens, "Pupil::Keygen#issue_token require consumer_key and consumer_secret" unless @consumer_key || @consumer_secret
|
25
|
-
consumer = OAuth::Consumer.new(@consumer_key, @consumer_secret, :site => 'http://twitter.com')
|
26
29
|
request_token = consumer.get_request_token
|
27
30
|
access_token = request_token.get_access_token(:oauth_verifier => verifier)
|
28
31
|
@access_token = access_token.token
|
@@ -45,8 +48,6 @@ class Pupil
|
|
45
48
|
print unless @consumer_secret
|
46
49
|
@consumer_secret = Readline.readline("Enter OAuth Consumer Secret: ", true) unless @consumer_secret
|
47
50
|
|
48
|
-
consumer = OAuth::Consumer.new(@consumer_key, @consumer_secret, :site => 'http://twitter.com')
|
49
|
-
|
50
51
|
request_token = consumer.get_request_token
|
51
52
|
|
52
53
|
puts "Access to this URL and approve: #{request_token.authorize_url}"
|
@@ -60,4 +61,4 @@ class Pupil
|
|
60
61
|
return {:consumer_key => @consumer_key, :consumer_secret => @consumer_secret, :access_token => access_token.token, :access_token_secret => access_token.secret, :screen_name => access_token.params[:screen_name]}
|
61
62
|
end
|
62
63
|
end
|
63
|
-
end
|
64
|
+
end
|
data/lib/pupil/lists.rb
CHANGED
@@ -2,10 +2,10 @@ class Pupil
|
|
2
2
|
# @return [Hash] lists
|
3
3
|
def lists(param={})
|
4
4
|
if param[:contains]
|
5
|
-
response = self.get("
|
5
|
+
response = self.get("lists/memberships.json", param.reject{|p|p==:contains}.update(guess_parameter(param[:contains]) => param[:contains]))
|
6
6
|
response = response["lists"]
|
7
7
|
else
|
8
|
-
response = self.get("
|
8
|
+
response = self.get("lists/all.json", param)
|
9
9
|
end
|
10
10
|
return [] unless response
|
11
11
|
lists = Array.new
|
@@ -16,7 +16,7 @@ class Pupil
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def create_list(name, option={})
|
19
|
-
response = self.post("
|
19
|
+
response = self.post("lists/create.json", {:name => name}.update(option))
|
20
20
|
return List.new(response, @access_token)
|
21
21
|
end
|
22
22
|
end
|
data/lib/pupil/schemes.rb
CHANGED
@@ -25,7 +25,7 @@ class Pupil
|
|
25
25
|
|
26
26
|
def reply(sentence, status=nil)
|
27
27
|
response = self.post(
|
28
|
-
"
|
28
|
+
"statuses/update.json",
|
29
29
|
"status"=> "@#{@element[:screen_name]} #{sentence}",
|
30
30
|
"in_reply_to_status_id" => status
|
31
31
|
)
|
@@ -44,17 +44,17 @@ class Pupil
|
|
44
44
|
def entities() Pupil::Entities.new(@element["entities"]) rescue nil; end
|
45
45
|
|
46
46
|
def destroy(param={})
|
47
|
-
self.post("
|
47
|
+
self.post("statuses/destroy/#{@element["id"]}.json", param)
|
48
48
|
end
|
49
49
|
|
50
50
|
alias_method :delete, :destroy
|
51
51
|
|
52
52
|
def retweet(param={})
|
53
|
-
self.post("
|
53
|
+
self.post("statuses/retweet/#{@element["id"]}.json", param)
|
54
54
|
end
|
55
55
|
|
56
56
|
def retweets(param={})
|
57
|
-
response = self.get("
|
57
|
+
response = self.get("statuses/retweets/#{@element["id"]}.json", param)
|
58
58
|
return false unless response
|
59
59
|
statuses = []
|
60
60
|
response.each do |status|
|
@@ -64,7 +64,7 @@ class Pupil
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def retweeted_by(param={})
|
67
|
-
response = self.get("
|
67
|
+
response = self.get("statuses/#{@element["id"]}/retweeted_by.json", param)
|
68
68
|
return false unless response
|
69
69
|
users = []
|
70
70
|
response.each do |user|
|
@@ -74,7 +74,7 @@ class Pupil
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def retweeted_by_user_ids(param={})
|
77
|
-
response = self.get("
|
77
|
+
response = self.get("statuses/#{@element["id"]}/retweeted_by/ids.json", param)
|
78
78
|
return false unless response
|
79
79
|
return response
|
80
80
|
end
|
@@ -84,7 +84,7 @@ class Pupil
|
|
84
84
|
def user() Pupil::User.new(@element["user"], @access_token) rescue nil; end
|
85
85
|
|
86
86
|
def statuses(param={})
|
87
|
-
response = self.get("
|
87
|
+
response = self.get("lists/statuses.json", {:list_id => @element["id_str"]}.update(param))
|
88
88
|
return false unless response
|
89
89
|
statuses = []
|
90
90
|
response.each do |status|
|
@@ -94,7 +94,7 @@ class Pupil
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def subscribers(param={})
|
97
|
-
response = self.get("
|
97
|
+
response = self.get("lists/subscribers.json", {:list_id => @element["id_str"]}.update(param))
|
98
98
|
return false unless response
|
99
99
|
users = []
|
100
100
|
response["users"].each do |user|
|
@@ -104,13 +104,13 @@ class Pupil
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def members(param={})
|
107
|
-
response = self.get("
|
107
|
+
response = self.get("lists/members.json", {:list_id => @element["id_str"]}.update(param))
|
108
108
|
return false unless response
|
109
109
|
users = []
|
110
110
|
response["users"].each do |u|
|
111
111
|
user = User.new(u.update("_list_id" => @element["id_str"]), @access_token)
|
112
112
|
def user.destroy()
|
113
|
-
response = self.post("
|
113
|
+
response = self.post("lists/members/destroy.json", {:list_id => @element["_list_id"], :user_id => @element["id_str"]})
|
114
114
|
end
|
115
115
|
users << user
|
116
116
|
end
|
@@ -118,19 +118,19 @@ class Pupil
|
|
118
118
|
end
|
119
119
|
|
120
120
|
def add(param)
|
121
|
-
response = self.post("
|
121
|
+
response = self.post("lists/members/create.json", {:list_id => @element["id_str"], guess_parameter(param) => param})
|
122
122
|
return List.new(response)
|
123
123
|
end
|
124
124
|
|
125
125
|
def strike(param, opts={})
|
126
|
-
response = self.post("
|
126
|
+
response = self.post("lists/members/destroy.json", {guess_parameter(param) => param, :list_id => @element["id_str"]}.update(opts))
|
127
127
|
return response
|
128
128
|
end
|
129
129
|
|
130
130
|
alias_method :off, :strike
|
131
131
|
|
132
132
|
def destroy()
|
133
|
-
response = self.post("
|
133
|
+
response = self.post("lists/destroy.json", {:list_id => @element["id_str"]})
|
134
134
|
return List.new(response)
|
135
135
|
end
|
136
136
|
|
@@ -182,7 +182,7 @@ class Pupil
|
|
182
182
|
# @return [Hash] response
|
183
183
|
def destroy()
|
184
184
|
begin
|
185
|
-
response = self.post("
|
185
|
+
response = self.post("direct_messages/destroy/#{@element["id"]}.json")
|
186
186
|
rescue
|
187
187
|
return false
|
188
188
|
end
|
data/lib/pupil/search.rb
CHANGED
@@ -3,9 +3,9 @@ class Pupil
|
|
3
3
|
# @param [Hash] option
|
4
4
|
# @return [Array] Tweets
|
5
5
|
def search(keyword, option={})
|
6
|
-
response = self.get("
|
6
|
+
response = self.get("search/tweets.json", {:q => keyword}.update(option))
|
7
7
|
statuses = Array.new
|
8
|
-
response["
|
8
|
+
response["statuses"].each do |element|
|
9
9
|
status = Status.new element
|
10
10
|
statuses << status
|
11
11
|
end
|
data/lib/pupil/statuses.rb
CHANGED
@@ -10,7 +10,7 @@ class Pupil
|
|
10
10
|
# @option param [Symbol] :exclude #=> [:replies]
|
11
11
|
# @option param [Symbol] :contributor_details
|
12
12
|
def timeline(param={})
|
13
|
-
response = self.get("
|
13
|
+
response = self.get("statuses/home_timeline.json", param)
|
14
14
|
return false unless response
|
15
15
|
statuses = []
|
16
16
|
response.each do |element|
|
@@ -24,7 +24,7 @@ class Pupil
|
|
24
24
|
# @return [Array] Mention
|
25
25
|
# @param [Hash] param
|
26
26
|
def mentions(param={})
|
27
|
-
response = self.get("
|
27
|
+
response = self.get("statuses/mentions_timeline.json", param)
|
28
28
|
return false unless response
|
29
29
|
statuses = []
|
30
30
|
response.each do |element|
|
@@ -53,7 +53,7 @@ class Pupil
|
|
53
53
|
# puts "#{status.user.screen_name}: #{status.text}"
|
54
54
|
# end
|
55
55
|
def user_timeline(target, option={})
|
56
|
-
response = self.get("
|
56
|
+
response = self.get("statuses/user_timeline.json", {guess_parameter(target) => target}.update(option))
|
57
57
|
return false unless response
|
58
58
|
statuses = []
|
59
59
|
response.each do |element|
|
@@ -69,7 +69,7 @@ class Pupil
|
|
69
69
|
# @return [Array] Timeline
|
70
70
|
# @param [Hash] param
|
71
71
|
def public_timeline(param={})
|
72
|
-
response = self.get("
|
72
|
+
response = self.get("statuses/public_timeline.json", param)
|
73
73
|
return false unless response
|
74
74
|
statuses = Array.new
|
75
75
|
response.each do |element|
|
@@ -80,7 +80,7 @@ class Pupil
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def retweeted_by_me(param={})
|
83
|
-
response = self.get("
|
83
|
+
response = self.get("statuses/retweeted_by_me.json", param)
|
84
84
|
return false unless response
|
85
85
|
statuses = Array.new
|
86
86
|
response.each do |element|
|
@@ -91,7 +91,7 @@ class Pupil
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def retweeted_to_me(param={})
|
94
|
-
response = self.get("
|
94
|
+
response = self.get("statuses/retweeted_to_me.json", param)
|
95
95
|
return false unless response
|
96
96
|
statuses = Array.new
|
97
97
|
response.each do |element|
|
@@ -102,7 +102,7 @@ class Pupil
|
|
102
102
|
end
|
103
103
|
|
104
104
|
def retweets_of_me(param={})
|
105
|
-
response = self.get("
|
105
|
+
response = self.get("statuses/retweets_of_me.json", param)
|
106
106
|
return false unless response
|
107
107
|
statuses = Array.new
|
108
108
|
response.each do |element|
|
@@ -113,7 +113,7 @@ class Pupil
|
|
113
113
|
end
|
114
114
|
|
115
115
|
def retweeted_to_user(param={})
|
116
|
-
response = self.get("
|
116
|
+
response = self.get("statuses/retweeted_to_user.json", param)
|
117
117
|
return false unless response
|
118
118
|
statuses = Array.new
|
119
119
|
response.each do |element|
|
@@ -124,7 +124,7 @@ class Pupil
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def retweeted_by_user(param={})
|
127
|
-
response = self.get("
|
127
|
+
response = self.get("statuses/retweeted_by_user.json", param)
|
128
128
|
return false unless response
|
129
129
|
statuses = Array.new
|
130
130
|
response.each do |element|
|
@@ -135,12 +135,12 @@ class Pupil
|
|
135
135
|
end
|
136
136
|
|
137
137
|
def oembed(param={})
|
138
|
-
response = self.get("
|
138
|
+
response = self.get("statuses/oembed.json", param)
|
139
139
|
return response
|
140
140
|
end
|
141
141
|
|
142
142
|
def status(status_id, param={})
|
143
|
-
response = self.get("
|
143
|
+
response = self.get("statuses/show/#{status_id}.json", param)
|
144
144
|
return false unless response
|
145
145
|
status = Status.new(response, @access_token)
|
146
146
|
return status
|
@@ -148,7 +148,7 @@ class Pupil
|
|
148
148
|
|
149
149
|
def update(status, irt='')
|
150
150
|
response = self.post(
|
151
|
-
"
|
151
|
+
"statuses/update.json",
|
152
152
|
"status"=> status,
|
153
153
|
"in_reply_to_status_id" => irt
|
154
154
|
)
|
@@ -159,7 +159,7 @@ class Pupil
|
|
159
159
|
alias_method :tweet, :update
|
160
160
|
|
161
161
|
def destroy(status_id)
|
162
|
-
response = self.post("
|
162
|
+
response = self.post("statuses/destroy/#{status_id}.json")
|
163
163
|
return false unless response
|
164
164
|
response
|
165
165
|
end
|
data/lib/pupil/users.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
class Pupil
|
2
2
|
def user(target, option={})
|
3
|
-
response = self.get("
|
3
|
+
response = self.get("users/show.json", {guess_parameter(target) => target}.update(option))
|
4
4
|
return false unless response
|
5
5
|
user = User.new(response, @access_token)
|
6
6
|
return user
|
7
7
|
end
|
8
8
|
|
9
9
|
def search_user(keyword, option={})
|
10
|
-
response = self.get("
|
10
|
+
response = self.get("users/search.json", {:q => keyword}.update(option))
|
11
11
|
users = Array.new
|
12
12
|
response.each do |element|
|
13
13
|
user = User.new(element, @access_token)
|
data/lib/pupil/version.rb
CHANGED
data/pupil.gemspec
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
require File.expand_path('../lib/pupil/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
|
-
gem.authors = ["
|
5
|
+
gem.authors = ["o_ame"]
|
6
6
|
gem.email = ["oame@oameya.com"]
|
7
|
-
gem.description = %q{The "Lazy" Twitter API Library for Ruby
|
8
|
-
gem.summary = %q{The "Lazy" Twitter API Library for Ruby
|
7
|
+
gem.description = %q{The "Lazy" Twitter API Library for Ruby. Easy to use.}
|
8
|
+
gem.summary = %q{The "Lazy" Twitter API Library for Ruby}
|
9
9
|
gem.homepage = "http://oame.github.com/pupil"
|
10
10
|
|
11
11
|
gem.files = `git ls-files`.split($\)
|
data/spec/pupil_spec.rb
CHANGED
@@ -54,7 +54,7 @@ end
|
|
54
54
|
describe Pupil, "が #user_timeline を呼ぶ時は" do
|
55
55
|
before do
|
56
56
|
pupil = Pupil.new PUPIL_TESTKEY
|
57
|
-
@user_timeline = pupil.user_timeline pupil.
|
57
|
+
@user_timeline = pupil.user_timeline pupil.screen_name
|
58
58
|
end
|
59
59
|
|
60
60
|
it "Array型を返すこと" do
|
@@ -65,8 +65,8 @@ end
|
|
65
65
|
describe Pupil, "が #friendship? を呼ぶ時は" do
|
66
66
|
before do
|
67
67
|
pupil = Pupil.new PUPIL_TESTKEY
|
68
|
-
@nonfriendship = pupil.friendship? pupil.
|
69
|
-
@friendship = pupil.friendship? pupil.
|
68
|
+
@nonfriendship = pupil.friendship? pupil.screen_name, KNOWN_NONFOLLOWED_USER
|
69
|
+
@friendship = pupil.friendship? pupil.screen_name, KNOWN_USER
|
70
70
|
end
|
71
71
|
|
72
72
|
it "フォロー関係に無い場合はFalseClass型を返すこと" do
|
@@ -92,7 +92,7 @@ end
|
|
92
92
|
describe Pupil, "が #search を呼ぶ時は" do
|
93
93
|
before do
|
94
94
|
pupil = Pupil.new PUPIL_TESTKEY
|
95
|
-
@search = pupil.search("Twitter", :
|
95
|
+
@search = pupil.search("Twitter", :count => 1)
|
96
96
|
end
|
97
97
|
|
98
98
|
it "Array型を返すこと" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pupil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.7'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- o_ame
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth
|
@@ -108,7 +108,7 @@ dependencies:
|
|
108
108
|
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
description: The "Lazy" Twitter API Library for Ruby
|
111
|
+
description: The "Lazy" Twitter API Library for Ruby. Easy to use.
|
112
112
|
email:
|
113
113
|
- oame@oameya.com
|
114
114
|
executables:
|
@@ -121,7 +121,6 @@ files:
|
|
121
121
|
- .travis.yml
|
122
122
|
- CHANGELOG.md
|
123
123
|
- Gemfile
|
124
|
-
- Gemfile.lock
|
125
124
|
- LICENSE
|
126
125
|
- README.ja.md
|
127
126
|
- README.md
|
@@ -175,7 +174,8 @@ rubyforge_project:
|
|
175
174
|
rubygems_version: 2.0.3
|
176
175
|
signing_key:
|
177
176
|
specification_version: 4
|
178
|
-
summary: The "Lazy" Twitter API Library for Ruby
|
177
|
+
summary: The "Lazy" Twitter API Library for Ruby
|
179
178
|
test_files:
|
180
179
|
- spec/pupil_spec.rb
|
181
180
|
- spec/spec_helper.rb
|
181
|
+
has_rdoc:
|