pupil 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -16,6 +16,5 @@ pkg
16
16
  rdoc
17
17
  spec/reports
18
18
  spec/keys/pupil_testkey.rb
19
- test/tmp
20
- test/version_tmp
19
+ test/
21
20
  tmp
@@ -1,3 +1,8 @@
1
+ 0.6.2
2
+ ----------------
3
+
4
+ * 一部API 1.1に対応
5
+
1
6
  0.6.1
2
7
  ----------------
3
8
 
@@ -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("/1/account/verify_credentials.json")
5
+ response = self.get("/1.1/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("/account/rate_limit_status.json")
15
+ response = self.get("/1.1/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("/account/end_session.json")
22
+ response = self.post("/1.1/account/end_session.json")
23
23
  return response
24
24
  end
25
25
 
@@ -12,8 +12,6 @@ class Pupil
12
12
 
13
13
  # @param [Hash] pupil_key
14
14
  def initialize key
15
- @screen_name = key[:screen_name] || nil
16
-
17
15
  @consumer = OAuth::Consumer.new(
18
16
  key[:consumer_key],
19
17
  key[:consumer_secret],
@@ -24,6 +22,8 @@ class Pupil
24
22
  key[:access_token],
25
23
  key[:access_token_secret]
26
24
  )
25
+
26
+ @screen_name = key[:screen_name] || self.profile.screen_name
27
27
  end
28
28
 
29
29
  include Essentials
@@ -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("/blocks/create.json", {guess_parameter(param) => param})
5
+ response = self.post("/1.1/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("/blocks/destroy.json", {guess_parameter(param) => param})
16
+ response = self.post("/1.1/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("/blocks/blocking.json")
26
+ response = self.get("/1.1/blocks/list.json")
27
27
  return [] if response["nilclasses"]
28
28
  users = Array.new
29
29
  response["users"].each do |element|
@@ -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("/1/statuses/home_timeline.json", param)
13
+ response = self.get("/1.1/statuses/home_timeline.json", param)
14
14
  return false unless response
15
15
  statuses = []
16
16
  response.each do |element|
@@ -19,13 +19,12 @@ class Pupil
19
19
  end
20
20
  return statuses
21
21
  end
22
-
23
22
  alias_method :home_timeline, :timeline
24
23
 
25
24
  # @return [Array] Mention
26
25
  # @param [Hash] param
27
26
  def mentions(param={})
28
- response = self.get("/1/statuses/mentions.json", param)
27
+ response = self.get("/1.1/statuses/mentions_timeline.json", param)
29
28
  return false unless response
30
29
  statuses = []
31
30
  response.each do |element|
@@ -54,7 +53,7 @@ class Pupil
54
53
  # puts "#{status.user.screen_name}: #{status.text}"
55
54
  # end
56
55
  def user_timeline(target, option={})
57
- response = self.get("/1/statuses/user_timeline.json", {guess_parameter(target) => target}.update(option))
56
+ response = self.get("/1.1/statuses/user_timeline.json", {guess_parameter(target) => target}.update(option))
58
57
  return false unless response
59
58
  statuses = []
60
59
  response.each do |element|
@@ -70,7 +69,7 @@ class Pupil
70
69
  # @return [Array] Timeline
71
70
  # @param [Hash] param
72
71
  def public_timeline(param={})
73
- response = self.get("/1/statuses/public_timeline.json", param)
72
+ response = self.get("/1.1/statuses/public_timeline.json", param)
74
73
  return false unless response
75
74
  statuses = Array.new
76
75
  response.each do |element|
@@ -81,7 +80,7 @@ class Pupil
81
80
  end
82
81
 
83
82
  def retweeted_by_me(param={})
84
- response = self.get("/1/statuses/retweeted_by_me.json", param)
83
+ response = self.get("/1.1/statuses/retweeted_by_me.json", param)
85
84
  return false unless response
86
85
  statuses = Array.new
87
86
  response.each do |element|
@@ -92,7 +91,7 @@ class Pupil
92
91
  end
93
92
 
94
93
  def retweeted_to_me(param={})
95
- response = self.get("/1/statuses/retweeted_to_me.json", param)
94
+ response = self.get("/1.1/statuses/retweeted_to_me.json", param)
96
95
  return false unless response
97
96
  statuses = Array.new
98
97
  response.each do |element|
@@ -103,7 +102,7 @@ class Pupil
103
102
  end
104
103
 
105
104
  def retweets_of_me(param={})
106
- response = self.get("/1/statuses/retweets_of_me.json", param)
105
+ response = self.get("/1.1/statuses/retweets_of_me.json", param)
107
106
  return false unless response
108
107
  statuses = Array.new
109
108
  response.each do |element|
@@ -114,7 +113,7 @@ class Pupil
114
113
  end
115
114
 
116
115
  def retweeted_to_user(param={})
117
- response = self.get("/1/statuses/retweeted_to_user.json", param)
116
+ response = self.get("/1.1/statuses/retweeted_to_user.json", param)
118
117
  return false unless response
119
118
  statuses = Array.new
120
119
  response.each do |element|
@@ -125,7 +124,7 @@ class Pupil
125
124
  end
126
125
 
127
126
  def retweeted_by_user(param={})
128
- response = self.get("/1/statuses/retweeted_by_user.json", param)
127
+ response = self.get("/1.1/statuses/retweeted_by_user.json", param)
129
128
  return false unless response
130
129
  statuses = Array.new
131
130
  response.each do |element|
@@ -136,12 +135,12 @@ class Pupil
136
135
  end
137
136
 
138
137
  def oembed(param={})
139
- response = self.get("/1/statuses/oembed.json", param)
138
+ response = self.get("/1.1/statuses/oembed.json", param)
140
139
  return response
141
140
  end
142
141
 
143
142
  def status(status_id, param={})
144
- response = self.get("/statuses/show/#{status_id}.json", param)
143
+ response = self.get("/1.1/statuses/show/#{status_id}.json", param)
145
144
  return false unless response
146
145
  status = Status.new(response, @access_token)
147
146
  return status
@@ -149,7 +148,7 @@ class Pupil
149
148
 
150
149
  def update(status, irt='')
151
150
  response = self.post(
152
- "/1/statuses/update.json",
151
+ "/1.1/statuses/update.json",
153
152
  "status"=> status,
154
153
  "in_reply_to_status_id" => irt
155
154
  )
@@ -160,7 +159,7 @@ class Pupil
160
159
  alias_method :tweet, :update
161
160
 
162
161
  def destroy(status_id)
163
- response = self.post("/1/statuses/destroy/#{status_id}.json")
162
+ response = self.post("/1.1/statuses/destroy/#{status_id}.json")
164
163
  return false unless response
165
164
  response
166
165
  end
@@ -1,3 +1,3 @@
1
1
  class Pupil
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
3
3
  end
@@ -22,7 +22,7 @@ end
22
22
  describe Pupil, "が #home_timeline を呼ぶ時は" do
23
23
  before do
24
24
  pupil = Pupil.new PUPIL_TESTKEY
25
- @home_timeline = pupil.home_timeline :count => 50
25
+ @home_timeline = pupil.home_timeline :count => 20
26
26
  end
27
27
 
28
28
  it "Array型を返すこと" do
@@ -30,7 +30,7 @@ describe Pupil, "が #home_timeline を呼ぶ時は" do
30
30
  end
31
31
 
32
32
  it "sizeが50であること" do
33
- @home_timeline.size.should == 50
33
+ @home_timeline.size.should == 20
34
34
  end
35
35
  end
36
36
 
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.6.1
4
+ version: 0.6.2
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-08-03 00:00:00.000000000Z
12
+ date: 2012-10-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth
16
- requirement: &70097868260460 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70097868260460
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: json
27
- requirement: &70097868259880 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70097868259880
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: rake
38
- requirement: &70097868259300 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: '0'
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *70097868259300
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: rspec
49
- requirement: &70097868258700 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ! '>='
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: '0'
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *70097868258700
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: yard
60
- requirement: &70097868258280 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ! '>='
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: '0'
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *70097868258280
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: bundler
71
- requirement: &70097868257780 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ! '>='
@@ -76,7 +101,12 @@ dependencies:
76
101
  version: '0'
77
102
  type: :development
78
103
  prerelease: false
79
- version_requirements: *70097868257780
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
80
110
  description: The "Lazy" Twitter API Library for Ruby 1.9.x. Easy to use.
81
111
  email:
82
112
  - oame@oameya.com
@@ -131,25 +161,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
131
161
  - - ! '>='
132
162
  - !ruby/object:Gem::Version
133
163
  version: '0'
134
- segments:
135
- - 0
136
- hash: -1341416482152180508
137
164
  required_rubygems_version: !ruby/object:Gem::Requirement
138
165
  none: false
139
166
  requirements:
140
167
  - - ! '>='
141
168
  - !ruby/object:Gem::Version
142
169
  version: '0'
143
- segments:
144
- - 0
145
- hash: -1341416482152180508
146
170
  requirements: []
147
171
  rubyforge_project:
148
- rubygems_version: 1.8.10
172
+ rubygems_version: 1.8.24
149
173
  signing_key:
150
174
  specification_version: 3
151
175
  summary: The "Lazy" Twitter API Library for Ruby 1.9.x
152
176
  test_files:
153
177
  - spec/pupil_spec.rb
154
178
  - spec/spec_helper.rb
155
- has_rdoc: