pupil 0.4.1 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ 0.5.0
2
+ ----------------
3
+
4
+ * New method: Pupil#followers, Pupil#friends
5
+ * Some bug fixed
6
+
1
7
  0.4.1
2
8
  ----------------
3
9
 
data/README.ja.md CHANGED
@@ -6,7 +6,7 @@ Pupil はRuby 1.9.xのための"怠惰"なTwitter APIライブラリです。
6
6
  フューチャー
7
7
  -------------
8
8
 
9
- * Pupilは動的なAPIラッパーであり、Twitter APIの仕様変更に柔軟に対応することができます
9
+ * Pupilは動的なTwitterAPIラッパーであり、APIの突然の仕様変更に柔軟に対応することができます
10
10
  * Ruby on Railsライクな直感的で書きやすい文法
11
11
  * 殆どのREST APIをサポートしていますが、一部のAPIはサポートされていません
12
12
  * Twitter Streaming APIをサポート
@@ -16,6 +16,8 @@ Pupil はRuby 1.9.xのための"怠惰"なTwitter APIライブラリです。
16
16
  -------------
17
17
 
18
18
  * 一部のAPIをサポートしていません
19
+ * 不安定です
20
+ * ドキュメントがありません(誰か書いて!)
19
21
 
20
22
  動作環境
21
23
  -------------
@@ -85,10 +87,10 @@ Streaming API を使ってみる
85
87
 
86
88
  Eyedrops, the interactive Pupil
87
89
 
88
- > eyedrops -h
89
- > eyedrops -u [name] -i
90
- eyedrops> twitter.timeline :count => 10
91
- ...
90
+ > eyedrops -h
91
+ > eyedrops -u [name] -i
92
+ eyedrops> twitter.timeline :count => 10
93
+ ...
92
94
 
93
95
  協力
94
96
  -------------
data/README.md CHANGED
@@ -6,7 +6,7 @@ Pupil is "Lazy" Twitter API Library for Ruby 1.9.x.
6
6
  Features
7
7
  -------------
8
8
 
9
- * Pupil is Dynamic API Wrapper, can respond flexibly to change specifications of the Twitter API.
9
+ * Pupil is Dynamic Twitter API Wrapper, can respond flexibly to change specifications of the Twitter API.
10
10
  * Ruby on Rails like syntax.
11
11
  * Almost Twitter REST API are wrapped. However, some API does not support yet.
12
12
  * Twitter Streaming API are supported experimentally.
@@ -17,6 +17,7 @@ Problems
17
17
 
18
18
  * Some REST API are not supported.
19
19
  * Unstable
20
+ * No documents
20
21
 
21
22
  Requirement
22
23
  -------------
@@ -86,10 +87,10 @@ Making `oauth_key`
86
87
 
87
88
  Eyedrops, the interactive Pupil
88
89
 
89
- > eyedrops -h
90
- > eyedrops -u [name] -i
91
- eyedrops> twitter.timeline :count => 10
92
- ...
90
+ > eyedrops -h
91
+ > eyedrops -u [name] -i
92
+ eyedrops> twitter.timeline :count => 10
93
+ ...
93
94
 
94
95
  Contributing to pupil
95
96
  -------------
@@ -9,6 +9,17 @@ class Pupil
9
9
  end
10
10
  return ids
11
11
  end
12
+
13
+ alias_method :following_ids, :friends_ids
14
+
15
+ def friends(name=@screen_name)
16
+ name ||= self.profile.screen_name
17
+ ids = self.friends_ids(name)
18
+ users = self.lookup :users => ids
19
+ return users
20
+ end
21
+
22
+ alias_method :following, :friends
12
23
 
13
24
  def followers_ids(name=@screen_name)
14
25
  name ||= self.profile.screen_name
@@ -21,6 +32,13 @@ class Pupil
21
32
  return ids
22
33
  end
23
34
 
35
+ def followers(name=@screen_name)
36
+ name ||= self.profile.screen_name
37
+ ids = self.followers_ids(name)
38
+ users = self.lookup :users => ids
39
+ return users
40
+ end
41
+
24
42
  def no_retweet_ids()
25
43
  response = self.get("/1/friendships/no_retweet_ids.json")
26
44
  return false unless response
data/lib/pupil/general.rb CHANGED
@@ -3,21 +3,28 @@ class Pupil
3
3
  target, source = opts.to_a.first
4
4
  case target
5
5
  when :users
6
- response = self.get("/1/users/lookup.json", {guess_parameter(source[0]) => source.join(",")}.update(option))
7
- return false unless response
8
6
  users = Array.new
9
- response.each do |element|
10
- user = User.new(element, @access_token)
11
- users << user
7
+ source.each_slice(100) do |sliced|
8
+ response = self.get("/1/users/lookup.json", {guess_parameter(sliced[0]) => sliced.join(",")}.update(option))
9
+ return false unless response
10
+ response.each do |element|
11
+ user = User.new(element, @access_token)
12
+ users << user
13
+ end
12
14
  end
15
+
13
16
  return users
14
17
  when :friendships
15
- response = self.get("/1/friendships/lookup.json", {guess_parameter(source[0]) => source.join(",")}.update(option))
16
- return false unless response
17
18
  fs = Array.new
18
- response.each do |element|
19
- fs << element
19
+ source.each_slice(100) do |sliced|
20
+ response = self.get("/1/friendships/lookup.json", {guess_parameter(sliced[0]) => sliced.join(",")}.update(option))
21
+ return false unless response
22
+
23
+ response.each do |element|
24
+ fs << element
25
+ end
20
26
  end
27
+
21
28
  return fs
22
29
  else
23
30
  raise ArgumentError, "#{target} is invalid parameter"
@@ -25,6 +32,7 @@ class Pupil
25
32
  end
26
33
 
27
34
  def method_missing(action, *args)
35
+ puts "miss"
28
36
  # e.g. pupil.users_search("username", :method => :post)
29
37
  url = "/1/#{action.to_s.split('_').join('/')}.json"
30
38
  response = self.get(url, args)
data/lib/pupil/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Pupil
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pupil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: '0.5'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-18 00:00:00.000000000 Z
12
+ date: 2012-05-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth
16
- requirement: &70257046427060 !ruby/object:Gem::Requirement
16
+ requirement: &70162456784680 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70257046427060
24
+ version_requirements: *70162456784680
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json
27
- requirement: &70257046426580 !ruby/object:Gem::Requirement
27
+ requirement: &70162456784180 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70257046426580
35
+ version_requirements: *70162456784180
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70257046426140 !ruby/object:Gem::Requirement
38
+ requirement: &70162456783760 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70257046426140
46
+ version_requirements: *70162456783760
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: yard
49
- requirement: &70257046425720 !ruby/object:Gem::Requirement
49
+ requirement: &70162456783340 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70257046425720
57
+ version_requirements: *70162456783340
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: bundler
60
- requirement: &70257046425260 !ruby/object:Gem::Requirement
60
+ requirement: &70162456782900 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70257046425260
68
+ version_requirements: *70162456782900
69
69
  description: The "Lazy" Twitter API Library for Ruby 1.9.x. Easy to use.
70
70
  email:
71
71
  - oame@oameya.com