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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0c615511ec0a929d6e6a4f3864e6f7044c5101b
4
- data.tar.gz: 242ad47be6e4cc3da41dca598d986000ee79f3b7
3
+ metadata.gz: 0d1f68257e2b6b12db3d513f054a4adfbab283a9
4
+ data.tar.gz: 1feba4d9127211cbea42987ee720ee37cf233a41
5
5
  SHA512:
6
- metadata.gz: fc852c50244bec79788af1d27412e1f484d52adfa7fd8126a7a65eb63785c697bdd05684b05c7696224760c83ee49c9106b6efe62fb6566309e48dd9822e06b3
7
- data.tar.gz: e6c5bdd3b7fcc61e756e1eb9ae540a3fce5a9231099b73abf27d6c33f8d6b767baf813122a31f5f20ac6f1d6841369a12405265436b76dae315cd8d7d3e7093c
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.0...HEAD)
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)
@@ -5,5 +5,5 @@ module TwitterAnonymousClient
5
5
  # The last 2 digits (c,d) are this gem version.
6
6
  # c is a major update or any update that breaks this gem API.
7
7
  # d is minor or bugfix update.
8
- VERSION = "1.0.1.0"
8
+ VERSION = "1.0.2.0"
9
9
  end
@@ -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.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-05 00:00:00.000000000 Z
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