twitter_anonymous_client 1.0.1.0 → 1.0.2.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -1
- data/lib/twitter/api/timelines.rb +16 -0
- data/lib/twitter_anonymous_client/version.rb +1 -1
- data/spec/last_tweet_spec.rb +34 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d1f68257e2b6b12db3d513f054a4adfbab283a9
|
4
|
+
data.tar.gz: 1feba4d9127211cbea42987ee720ee37cf233a41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b433f04bd1d8a6ea0c4a89ad5300add3297ba7d95a4d2d7ddc452ff5309007eb375bcb6643532bf7dfc1f1b1cd1011fed38125e58f4c46789dac740af8537d71
|
7
|
+
data.tar.gz: e8de67ad020c3d8cc30c9bb31f9d28d2a3429d8398921f6d7020f1c3978a9fefe56a7afcd17914ddc085efa1c3ab9991152548c97ede54d83846b6b2d464df49
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
## [In git](https://github.com/elgalu/twitter_anonymous_client/compare/v1.0.
|
1
|
+
## [In git](https://github.com/elgalu/twitter_anonymous_client/compare/v1.0.2.0...HEAD)
|
2
2
|
|
3
3
|
### New Features
|
4
4
|
* n/a
|
@@ -9,6 +9,17 @@
|
|
9
9
|
### Chores
|
10
10
|
* n/a
|
11
11
|
|
12
|
+
## [v1.0.2.0](https://github.com/elgalu/twitter_anonymous_client/tree/v1.0.2.0)
|
13
|
+
|
14
|
+
### New Features
|
15
|
+
* Added Client#last_tweet to get the last tweet given a screen name. (Leo Gallucci)
|
16
|
+
|
17
|
+
### Bugfixes
|
18
|
+
* n/a
|
19
|
+
|
20
|
+
### Chores
|
21
|
+
* n/a
|
22
|
+
|
12
23
|
## [v1.0.1.0](https://github.com/elgalu/twitter_anonymous_client/tree/v1.0.1.0)
|
13
24
|
|
14
25
|
### New Features
|
@@ -12,6 +12,8 @@ module Twitter
|
|
12
12
|
# @param [Hash] opts the options to retrieve the statuses
|
13
13
|
# @option opts [Integer] :count The number of statuses to retrieve
|
14
14
|
#
|
15
|
+
# @return [Array<Tweet>] the tweets collection array
|
16
|
+
#
|
15
17
|
# @example
|
16
18
|
# Twitter::Client.new.user_timeline('DolarBlue', count: 1)
|
17
19
|
# #=> [#<Twitter::Tweet:0x011.. @id="308609..., @text="Dolar Paralelo: $7,84.....
|
@@ -24,6 +26,20 @@ module Twitter
|
|
24
26
|
Twitter::Tweet.build_tweets(results)
|
25
27
|
end
|
26
28
|
|
29
|
+
# Get the last tweet given a twitter screen name (the last status)
|
30
|
+
#
|
31
|
+
# @param [String] screen_name the twitter user slug
|
32
|
+
#
|
33
|
+
# @return [Tweet] the Tweet object
|
34
|
+
#
|
35
|
+
# @example
|
36
|
+
# Twitter::Client.new.last_tweet('DolarBlue')
|
37
|
+
# #=> #<Twitter::Tweet:0x011.. @id="308609..., @text="Dolar Paralelo: $7,84.....
|
38
|
+
def last_tweet(screen_name)
|
39
|
+
tweets = user_timeline(screen_name, count: 1)
|
40
|
+
tweets.first
|
41
|
+
end
|
42
|
+
|
27
43
|
private
|
28
44
|
|
29
45
|
# (see #user_timeline)
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'support/spec_helper'
|
2
|
+
|
3
|
+
describe Twitter::Client do
|
4
|
+
let(:screen_name) { 'elgalu' }
|
5
|
+
let(:latest_tweet_text) { /Console Ruby debug is easy/ }
|
6
|
+
let(:url) { "http://api.twitter.com/1/statuses/user_timeline.json?screen_name=#{screen_name}&count=1" }
|
7
|
+
|
8
|
+
let(:client) { Twitter::Client.new }
|
9
|
+
let(:last_tweet) { client.last_tweet(screen_name) }
|
10
|
+
|
11
|
+
before do
|
12
|
+
WebMock.reset!
|
13
|
+
stub_request(:get, url).to_return(:body => fixture("#{screen_name}_statuses.json"))
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#last_tweet' do
|
17
|
+
it 'should be a Tweet' do
|
18
|
+
last_tweet.should be_a(Twitter::Tweet)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should respond to id' do
|
22
|
+
last_tweet.should respond_to(:id)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should contain proper text' do
|
26
|
+
last_tweet.should respond_to(:text)
|
27
|
+
last_tweet.text.should match(latest_tweet_text)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should produce a status url' do
|
31
|
+
last_tweet.status_url.should == "https://twitter.com/elgalu/status/307606752055148545"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitter_anonymous_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leo Gallucci
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-03-
|
11
|
+
date: 2013-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: strongly_typed
|
@@ -160,6 +160,7 @@ files:
|
|
160
160
|
- lib/twitter_anonymous_client.rb
|
161
161
|
- lib/twitter_anonymous_client/version.rb
|
162
162
|
- spec/fixtures/elgalu_statuses.json
|
163
|
+
- spec/last_tweet_spec.rb
|
163
164
|
- spec/support/spec_helper.rb
|
164
165
|
- spec/tweet_spec.rb
|
165
166
|
- spec/twitter_anonymous_client_spec.rb
|
@@ -191,6 +192,7 @@ specification_version: 4
|
|
191
192
|
summary: Twitter public (anonymous) client for old v1.0 API
|
192
193
|
test_files:
|
193
194
|
- spec/fixtures/elgalu_statuses.json
|
195
|
+
- spec/last_tweet_spec.rb
|
194
196
|
- spec/support/spec_helper.rb
|
195
197
|
- spec/tweet_spec.rb
|
196
198
|
- spec/twitter_anonymous_client_spec.rb
|