twitter 4.1.0 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/README.md +11 -9
- data/lib/twitter/api.rb +3 -5
- data/lib/twitter/base.rb +1 -4
- data/lib/twitter/geo/point.rb +2 -2
- data/lib/twitter/request/multipart_with_file.rb +1 -1
- data/lib/twitter/tweet.rb +9 -1
- data/lib/twitter/user.rb +2 -0
- data/lib/twitter/version.rb +1 -1
- data/spec/fixtures/status.json +1 -1
- data/spec/helper.rb +6 -0
- data/spec/twitter/action/favorite_spec.rb +6 -6
- data/spec/twitter/action/follow_spec.rb +6 -6
- data/spec/twitter/action/list_member_added_spec.rb +9 -9
- data/spec/twitter/action/mention_spec.rb +11 -11
- data/spec/twitter/action/reply_spec.rb +9 -9
- data/spec/twitter/action/retweet_spec.rb +9 -9
- data/spec/twitter/action_factory_spec.rb +7 -9
- data/spec/twitter/action_spec.rb +2 -2
- data/spec/twitter/api/account_spec.rb +38 -66
- data/spec/twitter/api/activity_spec.rb +6 -10
- data/spec/twitter/api/blocks_spec.rb +38 -83
- data/spec/twitter/api/direct_messages_spec.rb +33 -55
- data/spec/twitter/api/friendships_spec.rb +124 -266
- data/spec/twitter/api/geo_spec.rb +18 -36
- data/spec/twitter/api/help_spec.rb +15 -23
- data/spec/twitter/api/lists_spec.rb +172 -402
- data/spec/twitter/api/report_spam_spec.rb +5 -9
- data/spec/twitter/api/saved_searches_spec.rb +23 -35
- data/spec/twitter/api/search_spec.rb +15 -25
- data/spec/twitter/api/statuses_spec.rb +137 -235
- data/spec/twitter/api/trends_spec.rb +17 -29
- data/spec/twitter/api/users_spec.rb +90 -181
- data/spec/twitter/base_spec.rb +38 -40
- data/spec/twitter/basic_user_spec.rb +3 -3
- data/spec/twitter/client_spec.rb +28 -46
- data/spec/twitter/configuration_spec.rb +3 -3
- data/spec/twitter/cursor_spec.rb +16 -32
- data/spec/twitter/direct_message_spec.rb +9 -9
- data/spec/twitter/error/client_error_spec.rb +4 -12
- data/spec/twitter/error/server_error_spec.rb +2 -6
- data/spec/twitter/error_spec.rb +2 -2
- data/spec/twitter/geo/point_spec.rb +6 -6
- data/spec/twitter/geo/polygon_spec.rb +4 -4
- data/spec/twitter/geo_factory_spec.rb +3 -5
- data/spec/twitter/geo_spec.rb +4 -4
- data/spec/twitter/identifiable_spec.rb +9 -13
- data/spec/twitter/list_spec.rb +7 -7
- data/spec/twitter/media/photo_spec.rb +6 -6
- data/spec/twitter/media_factory_spec.rb +2 -4
- data/spec/twitter/oembed_spec.rb +24 -24
- data/spec/twitter/place_spec.rb +13 -13
- data/spec/twitter/rate_limit_spec.rb +16 -16
- data/spec/twitter/relationship_spec.rb +5 -5
- data/spec/twitter/saved_search_spec.rb +5 -5
- data/spec/twitter/search_results_spec.rb +21 -21
- data/spec/twitter/settings_spec.rb +2 -2
- data/spec/twitter/size_spec.rb +6 -6
- data/spec/twitter/source_user_spec.rb +3 -3
- data/spec/twitter/suggestion_spec.rb +9 -9
- data/spec/twitter/target_user_spec.rb +3 -3
- data/spec/twitter/trend_spec.rb +6 -6
- data/spec/twitter/tweet_spec.rb +69 -69
- data/spec/twitter/user_spec.rb +43 -43
- data/spec/twitter_spec.rb +12 -16
- metadata +2 -2
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
4.1.1
|
2
|
+
-----
|
3
|
+
* [Fix bug in `Twitter::Tweet#full_text`](https://github.com/sferik/twitter/commit/cc432b68c7487c7e946298a1ba07e6206b83086b)
|
4
|
+
* [Add `Twitter::Tweet#favouriters`, `Twitter::User#favoriters_count`, and `Twitter::User#favouriters_count` aliases](https://github.com/sferik/twitter/commit/9e00a7459e9a276a978d2945b5e1cdaa9e02a46f)
|
5
|
+
|
1
6
|
4.1.0
|
2
7
|
-----
|
3
8
|
* [Handle new API v1.1 list response format](https://github.com/sferik/twitter/commit/2aace25fcf946de995e5ce1788f24ad35bc79438)
|
data/README.md
CHANGED
@@ -2,10 +2,12 @@
|
|
2
2
|
[![Build Status](https://secure.travis-ci.org/sferik/twitter.png?branch=master)][travis]
|
3
3
|
[![Dependency Status](https://gemnasium.com/sferik/twitter.png?travis)][gemnasium]
|
4
4
|
[![Code Climate](https://codeclimate.com/badge.png)][codeclimate]
|
5
|
+
[![Click here to make a donation](http://www.pledgie.com/campaigns/18388.png)][pledgie]
|
5
6
|
|
6
7
|
[travis]: http://travis-ci.org/sferik/twitter
|
7
8
|
[gemnasium]: https://gemnasium.com/sferik/twitter
|
8
9
|
[codeclimate]: https://codeclimate.com/github/sferik/twitter
|
10
|
+
[pledgie]: http://pledgie.com/campaigns/18388
|
9
11
|
|
10
12
|
A Ruby interface to the Twitter API.
|
11
13
|
|
@@ -47,7 +49,7 @@ wiki][apps]!
|
|
47
49
|
|
48
50
|
## What's new in version 4?
|
49
51
|
|
50
|
-
|
52
|
+
#### Twitter API v1.1
|
51
53
|
|
52
54
|
Version 4 of this library targets Twitter API v1.1. To understand the
|
53
55
|
implications of this change, please read the following announcements from
|
@@ -77,7 +79,7 @@ discussion][discussion].
|
|
77
79
|
[user_timeline]: https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline
|
78
80
|
[discussion]: https://dev.twitter.com/discussions/10644
|
79
81
|
|
80
|
-
|
82
|
+
#### Rate Limiting
|
81
83
|
|
82
84
|
Another consequence of Twitter API v1.1 is that the
|
83
85
|
`Twitter::Client#rate_limit` method has been removed, since the concept of a
|
@@ -105,7 +107,7 @@ rescue Twitter::Error::TooManyRequests => error
|
|
105
107
|
end
|
106
108
|
end
|
107
109
|
```
|
108
|
-
|
110
|
+
#### Methods Missing
|
109
111
|
|
110
112
|
As a consequence of moving to Twitter API v1.1, the following methods from
|
111
113
|
version 3 are no longer available in version 4:
|
@@ -126,7 +128,7 @@ version 3 are no longer available in version 4:
|
|
126
128
|
* `Twitter::Client#rate_limit`
|
127
129
|
* `Twitter::RateLimit#class`
|
128
130
|
|
129
|
-
|
131
|
+
#### Custom Endpoints
|
130
132
|
|
131
133
|
The `Twitter::API#update_with_media` method no longer uses the custom
|
132
134
|
`upload.twitter.com` endpoint, so `media_endpoint` configuration has been
|
@@ -134,7 +136,7 @@ removed. Likewise, the `Twitter::API#search` method no longer uses the custom
|
|
134
136
|
`search.twitter.com` endpoint, so `search_endpoint` configuration has also been
|
135
137
|
removed.
|
136
138
|
|
137
|
-
|
139
|
+
#### Errors
|
138
140
|
|
139
141
|
It's worth mentioning new error classes:
|
140
142
|
|
@@ -149,7 +151,7 @@ library will raise `Twitter::Error::TooManyRequests` for all rate limit errors.
|
|
149
151
|
The `Twitter::Error::EnhanceYourCalm` class has been aliased to
|
150
152
|
`Twitter::Error::TooManyRequests`.
|
151
153
|
|
152
|
-
|
154
|
+
#### Identity Map
|
153
155
|
|
154
156
|
In version 4, the identity map is [disabled by default][disabled]. If you want
|
155
157
|
to enable this feature, you can use the [default identity map][default] or
|
@@ -209,7 +211,7 @@ After configuration, requests can be made like so:
|
|
209
211
|
Twitter.update("I'm tweeting with @gem!")
|
210
212
|
```
|
211
213
|
|
212
|
-
|
214
|
+
#### Thread Safety
|
213
215
|
|
214
216
|
Applications that make requests on behalf of multiple Twitter users should
|
215
217
|
avoid using global configuration. In this case, you may still specify the
|
@@ -259,7 +261,7 @@ a `Twitter::Client`:
|
|
259
261
|
|
260
262
|
This may be useful if you're using multiple consumer key/secret pairs.
|
261
263
|
|
262
|
-
|
264
|
+
#### Middleware
|
263
265
|
|
264
266
|
The Faraday middleware stack is fully configurable and is exposed as a
|
265
267
|
`Faraday::Builder` object. You can modify the default middleware in-place:
|
@@ -354,7 +356,7 @@ recommend [Oj][].
|
|
354
356
|
Here are some fun facts about this library:
|
355
357
|
|
356
358
|
* It is implemented in just 2,000 lines of Ruby code
|
357
|
-
* With over
|
359
|
+
* With over 4,000 lines of specs, the spec-to-code ratio is over 2:1
|
358
360
|
* The spec suite contains over 600 examples and runs in under 2 seconds
|
359
361
|
* It has 100% C0 code coverage (the tests execute every line of
|
360
362
|
source code at least once)
|
data/lib/twitter/api.rb
CHANGED
@@ -1358,8 +1358,7 @@ module Twitter
|
|
1358
1358
|
#
|
1359
1359
|
# @see https://dev.twitter.com/docs/api/1.1/get/search/tweets
|
1360
1360
|
# @see https://dev.twitter.com/docs/using-search
|
1361
|
-
# @
|
1362
|
-
# @note As of April 1st 2010, the Search API provides an option to retrieve "popular tweets" in addition to real-time search results. In an upcoming release, this will become the default and clients that don't want to receive popular tweets in their search results will have to explicitly opt-out. See the result_type parameter below for more information.
|
1361
|
+
# @note Please note that Twitter's search service and, by extension, the Search API is not meant to be an exhaustive source of Tweets. Not all Tweets will be indexed or made available via the search interface.
|
1363
1362
|
# @rate_limited Yes
|
1364
1363
|
# @authentication_required Requires user context
|
1365
1364
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
@@ -1368,13 +1367,12 @@ module Twitter
|
|
1368
1367
|
# @option options [String] :geocode Returns tweets by users located within a given radius of the given latitude/longitude. The location is preferentially taking from the Geotagging API, but will fall back to their Twitter profile. The parameter value is specified by "latitude,longitude,radius", where radius units must be specified as either "mi" (miles) or "km" (kilometers). Note that you cannot use the near operator via the API to geocode arbitrary locations; however you can use this geocode parameter to search near geocodes directly.
|
1369
1368
|
# @option options [String] :lang Restricts tweets to the given language, given by an ISO 639-1 code.
|
1370
1369
|
# @option options [String] :locale Specify the language of the query you are sending (only ja is currently effective). This is intended for language-specific clients and the default should work in the majority of cases.
|
1371
|
-
# @option options [Integer] :page The page number (starting at 1) to return, up to a max of roughly 1500 results (based on rpp * page).
|
1372
1370
|
# @option options [String] :result_type Specifies what type of search results you would prefer to receive. Options are "mixed", "recent", and "popular". The current default is "mixed."
|
1373
|
-
# @option options [Integer] :
|
1371
|
+
# @option options [Integer] :count The number of tweets to return per page, up to a maximum of 100.
|
1374
1372
|
# @option options [String] :until Optional. Returns tweets generated before the given date. Date should be formatted as YYYY-MM-DD.
|
1375
1373
|
# @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occured since the since_id, the since_id will be forced to the oldest ID available.
|
1376
1374
|
# @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
|
1377
|
-
# @option options [Boolean, String, Integer] :
|
1375
|
+
# @option options [Boolean, String, Integer] :include_entities Specifies that each tweet should include an 'entities' node including metadata about the tweet such as: user_mentions, urls, and hashtags.
|
1378
1376
|
# @return [Twitter::SearchResults] Return tweets that match a specified query with search metadata
|
1379
1377
|
# @example Returns tweets related to twitter
|
1380
1378
|
# Twitter.search('twitter')
|
data/lib/twitter/base.rb
CHANGED
@@ -8,10 +8,7 @@ module Twitter
|
|
8
8
|
|
9
9
|
# Define methods that retrieve the value from an initialized instance variable Hash, using the attribute as a key
|
10
10
|
#
|
11
|
-
# @
|
12
|
-
# @param attr [Symbol]
|
13
|
-
# @overload self.attr_reader(attrs)
|
14
|
-
# @param attrs [Array<Symbol>]
|
11
|
+
# @param attrs [Array, Set, Symbol]
|
15
12
|
def self.attr_reader(*attrs)
|
16
13
|
attrs.each do |attribute|
|
17
14
|
class_eval do
|
data/lib/twitter/geo/point.rb
CHANGED
@@ -6,13 +6,13 @@ module Twitter
|
|
6
6
|
|
7
7
|
# @return [Integer]
|
8
8
|
def latitude
|
9
|
-
|
9
|
+
coordinates[0]
|
10
10
|
end
|
11
11
|
alias lat latitude
|
12
12
|
|
13
13
|
# @return [Integer]
|
14
14
|
def longitude
|
15
|
-
|
15
|
+
coordinates[1]
|
16
16
|
end
|
17
17
|
alias long longitude
|
18
18
|
alias lng longitude
|
data/lib/twitter/tweet.rb
CHANGED
@@ -22,6 +22,7 @@ module Twitter
|
|
22
22
|
alias favorited? favorited
|
23
23
|
alias favourited favorited
|
24
24
|
alias favourited? favorited
|
25
|
+
alias favouriters favoriters
|
25
26
|
alias retweeted? retweeted
|
26
27
|
alias truncated? truncated
|
27
28
|
|
@@ -31,7 +32,9 @@ module Twitter
|
|
31
32
|
favoriters_count.to_i if favoriters_count
|
32
33
|
end
|
33
34
|
alias favorite_count favoriters_count
|
35
|
+
alias favorites_count favoriters_count
|
34
36
|
alias favourite_count favoriters_count
|
37
|
+
alias favourites_count favoriters_count
|
35
38
|
alias favouriters_count favoriters_count
|
36
39
|
|
37
40
|
# @return [String]
|
@@ -42,7 +45,12 @@ module Twitter
|
|
42
45
|
# @return [String]
|
43
46
|
# @note May be > 140 characters.
|
44
47
|
def full_text
|
45
|
-
|
48
|
+
if retweeted_status
|
49
|
+
prefix = text[/\A(RT @[a-z0-9_]{1,20}: )/i, 1]
|
50
|
+
[prefix, retweeted_status.text].compact.join
|
51
|
+
else
|
52
|
+
text
|
53
|
+
end
|
46
54
|
end
|
47
55
|
|
48
56
|
# @return [Twitter::Geo]
|
data/lib/twitter/user.rb
CHANGED
@@ -22,8 +22,10 @@ module Twitter
|
|
22
22
|
alias default_profile_image? default_profile_image
|
23
23
|
alias follow_request_sent? follow_request_sent
|
24
24
|
alias favorite_count favourites_count
|
25
|
+
alias favoriters_count favourites_count
|
25
26
|
alias favorites_count favourites_count
|
26
27
|
alias favourite_count favourites_count
|
28
|
+
alias favouriters_count favourites_count
|
27
29
|
alias follower_count followers_count
|
28
30
|
alias friend_count friends_count
|
29
31
|
alias geo_enabled? geo_enabled
|
data/lib/twitter/version.rb
CHANGED
data/spec/fixtures/status.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"
|
1
|
+
{"created_at":"Wed Apr 06 19:13:37 +0000 2011","id":55709764298092545,"id_str":"55709764298092545","text":"The problem with your code is that it's doing exactly what you told it to do.","source":"\u003ca href=\"http:\/\/twitter.com\/download\/iphone\" rel=\"nofollow\"\u003eTwitter for iPhone\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":7505382,"id_str":"7505382","name":"Erik Michaels-Ober","screen_name":"sferik","location":"San Francisco","description":"Write code. Not too much. Mostly Ruby.","url":"https:\/\/github.com\/sferik","entities":{"url":{"urls":[{"url":"https:\/\/github.com\/sferik","expanded_url":null,"indices":[0,25]}]},"description":{"urls":[]}},"protected":false,"followers_count":2479,"friends_count":200,"listed_count":132,"created_at":"Mon Jul 16 12:59:01 +0000 2007","favourites_count":4421,"utc_offset":-28800,"time_zone":"Pacific Time (US & Canada)","geo_enabled":true,"verified":false,"statuses_count":8730,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"000000","profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/677717672\/bb0b3653dcf0644e344823e0a2eb3382.png","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/677717672\/bb0b3653dcf0644e344823e0a2eb3382.png","profile_background_tile":false,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1759857427\/image1326743606_normal.png","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1759857427\/image1326743606_normal.png","profile_banner_url":"https:\/\/si0.twimg.com\/profile_banners\/7505382\/1349499693","profile_link_color":"0084B4","profile_sidebar_border_color":"000000","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":{"type":"Point","coordinates":[37.78349999,-122.39362884]},"coordinates":{"type":"Point","coordinates":[-122.39362884,37.78349999]},"place":{"id":"5c92ab5379de3839","url":"https:\/\/api.twitter.com\/1.1\/geo\/id\/5c92ab5379de3839.json","place_type":"neighborhood","name":"South Beach","full_name":"South Beach, San Francisco","country_code":"US","country":"United States","bounding_box":{"type":"Polygon","coordinates":[[[-122.403482,37.777529],[-122.387436,37.777529],[-122.387436,37.794486],[-122.403482,37.794486]]]},"attributes":{}},"contributors":null,"retweet_count":316,"entities":{"hashtags":[],"urls":[],"user_mentions":[]},"favorited":false,"retweeted":false}
|
data/spec/helper.rb
CHANGED
@@ -12,6 +12,12 @@ require 'tempfile'
|
|
12
12
|
require 'timecop'
|
13
13
|
require 'webmock/rspec'
|
14
14
|
|
15
|
+
RSpec.configure do |config|
|
16
|
+
config.expect_with :rspec do |c|
|
17
|
+
c.syntax = :expect
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
15
21
|
def a_delete(path)
|
16
22
|
a_request(:delete, 'https://api.twitter.com' + path)
|
17
23
|
end
|
@@ -5,24 +5,24 @@ describe Twitter::Action::Favorite do
|
|
5
5
|
describe "#sources" do
|
6
6
|
it "returns a collection of users who favorited a Tweet" do
|
7
7
|
sources = Twitter::Action::Favorite.new(:sources => [{:id => 7505382}]).sources
|
8
|
-
sources.
|
9
|
-
sources.first.
|
8
|
+
expect(sources).to be_an Array
|
9
|
+
expect(sources.first).to be_a Twitter::User
|
10
10
|
end
|
11
11
|
it "is empty when not set" do
|
12
12
|
sources = Twitter::Action::Favorite.new.sources
|
13
|
-
sources.
|
13
|
+
expect(sources).to be_empty
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
describe "#targets" do
|
18
18
|
it "returns a collection containing the favorited Tweet" do
|
19
19
|
targets = Twitter::Action::Favorite.new(:targets => [{:id => 25938088801}]).targets
|
20
|
-
targets.
|
21
|
-
targets.first.
|
20
|
+
expect(targets).to be_an Array
|
21
|
+
expect(targets.first).to be_a Twitter::Tweet
|
22
22
|
end
|
23
23
|
it "is empty when not set" do
|
24
24
|
targets = Twitter::Action::Favorite.new.targets
|
25
|
-
targets.
|
25
|
+
expect(targets).to be_empty
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -5,24 +5,24 @@ describe Twitter::Action::Follow do
|
|
5
5
|
describe "#sources" do
|
6
6
|
it "returns a collection of users who followed a user" do
|
7
7
|
sources = Twitter::Action::Follow.new(:sources => [{:id => 7505382}]).sources
|
8
|
-
sources.
|
9
|
-
sources.first.
|
8
|
+
expect(sources).to be_an Array
|
9
|
+
expect(sources.first).to be_a Twitter::User
|
10
10
|
end
|
11
11
|
it "is empty when not set" do
|
12
12
|
sources = Twitter::Action::Follow.new.sources
|
13
|
-
sources.
|
13
|
+
expect(sources).to be_empty
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
describe "#targets" do
|
18
18
|
it "returns a collection containing the followed user" do
|
19
19
|
targets = Twitter::Action::Follow.new(:targets => [{:id => 7505382}]).targets
|
20
|
-
targets.
|
21
|
-
targets.first.
|
20
|
+
expect(targets).to be_an Array
|
21
|
+
expect(targets.first).to be_a Twitter::User
|
22
22
|
end
|
23
23
|
it "is empty when not set" do
|
24
24
|
targets = Twitter::Action::Follow.new.targets
|
25
|
-
targets.
|
25
|
+
expect(targets).to be_empty
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -5,36 +5,36 @@ describe Twitter::Action::ListMemberAdded do
|
|
5
5
|
describe "#sources" do
|
6
6
|
it "returns a collection of users who added a user to a list" do
|
7
7
|
sources = Twitter::Action::ListMemberAdded.new(:sources => [{:id => 7505382}]).sources
|
8
|
-
sources.
|
9
|
-
sources.first.
|
8
|
+
expect(sources).to be_an Array
|
9
|
+
expect(sources.first).to be_a Twitter::User
|
10
10
|
end
|
11
11
|
it "is empty when not set" do
|
12
12
|
sources = Twitter::Action::ListMemberAdded.new.sources
|
13
|
-
sources.
|
13
|
+
expect(sources).to be_empty
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
describe "#target_objects" do
|
18
18
|
it "returns a collection of lists that were added to" do
|
19
19
|
targets = Twitter::Action::ListMemberAdded.new(:target_objects => [{:id => 8863586}]).target_objects
|
20
|
-
targets.
|
21
|
-
targets.first.
|
20
|
+
expect(targets).to be_an Array
|
21
|
+
expect(targets.first).to be_a Twitter::List
|
22
22
|
end
|
23
23
|
it "is empty when not set" do
|
24
24
|
targets = Twitter::Action::ListMemberAdded.new.target_objects
|
25
|
-
targets.
|
25
|
+
expect(targets).to be_empty
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
describe "#targets" do
|
30
30
|
it "returns a collection of users who were added to a list" do
|
31
31
|
targets = Twitter::Action::ListMemberAdded.new(:targets => [{:id => 7505382}]).targets
|
32
|
-
targets.
|
33
|
-
targets.first.
|
32
|
+
expect(targets).to be_an Array
|
33
|
+
expect(targets.first).to be_a Twitter::User
|
34
34
|
end
|
35
35
|
it "is empty when not set" do
|
36
36
|
targets = Twitter::Action::ListMemberAdded.new.targets
|
37
|
-
targets.
|
37
|
+
expect(targets).to be_empty
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -5,47 +5,47 @@ describe Twitter::Action::Mention do
|
|
5
5
|
describe "#sources" do
|
6
6
|
it "returns a collection of users who mentioned a user" do
|
7
7
|
sources = Twitter::Action::Mention.new(:sources => [{:id => 7505382}]).sources
|
8
|
-
sources.
|
9
|
-
sources.first.
|
8
|
+
expect(sources).to be_an Array
|
9
|
+
expect(sources.first).to be_a Twitter::User
|
10
10
|
end
|
11
11
|
it "is empty when not set" do
|
12
12
|
sources = Twitter::Action::Mention.new.sources
|
13
|
-
sources.
|
13
|
+
expect(sources).to be_empty
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
describe "#source" do
|
18
18
|
it "returns the user who mentioned a user" do
|
19
19
|
source = Twitter::Action::Mention.new(:sources => [{:id => 7505382}]).source
|
20
|
-
source.
|
20
|
+
expect(source).to be_a Twitter::User
|
21
21
|
end
|
22
22
|
it "returns nil when not set" do
|
23
23
|
source = Twitter::Action::Mention.new.source
|
24
|
-
source.
|
24
|
+
expect(source).to be_nil
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
describe "#target_objects" do
|
29
29
|
it "returns a collection of Tweets that mention a user" do
|
30
30
|
targets = Twitter::Action::Mention.new(:target_objects => [{:id => 25938088801}]).target_objects
|
31
|
-
targets.
|
32
|
-
targets.first.
|
31
|
+
expect(targets).to be_an Array
|
32
|
+
expect(targets.first).to be_a Twitter::Tweet
|
33
33
|
end
|
34
34
|
it "is empty when not set" do
|
35
35
|
targets = Twitter::Action::Mention.new.target_objects
|
36
|
-
targets.
|
36
|
+
expect(targets).to be_empty
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
describe "#targets" do
|
41
41
|
it "returns a collection containing the mentioned user" do
|
42
42
|
targets = Twitter::Action::Mention.new(:targets => [{:id => 7505382}]).targets
|
43
|
-
targets.
|
44
|
-
targets.first.
|
43
|
+
expect(targets).to be_an Array
|
44
|
+
expect(targets.first).to be_a Twitter::User
|
45
45
|
end
|
46
46
|
it "is empty when not set" do
|
47
47
|
targets = Twitter::Action::Mention.new.targets
|
48
|
-
targets.
|
48
|
+
expect(targets).to be_empty
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -5,36 +5,36 @@ describe Twitter::Action::Reply do
|
|
5
5
|
describe "#sources" do
|
6
6
|
it "returns a collection of users who replied to a user" do
|
7
7
|
sources = Twitter::Action::Reply.new(:sources => [{:id => 7505382}]).sources
|
8
|
-
sources.
|
9
|
-
sources.first.
|
8
|
+
expect(sources).to be_an Array
|
9
|
+
expect(sources.first).to be_a Twitter::User
|
10
10
|
end
|
11
11
|
it "is empty when not set" do
|
12
12
|
sources = Twitter::Action::Reply.new.sources
|
13
|
-
sources.
|
13
|
+
expect(sources).to be_empty
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
describe "#target_objects" do
|
18
18
|
it "returns a collection of Tweets that reply to a user" do
|
19
19
|
targets = Twitter::Action::Reply.new(:target_objects => [{:id => 25938088801}]).target_objects
|
20
|
-
targets.
|
21
|
-
targets.first.
|
20
|
+
expect(targets).to be_an Array
|
21
|
+
expect(targets.first).to be_a Twitter::Tweet
|
22
22
|
end
|
23
23
|
it "is empty when not set" do
|
24
24
|
targets = Twitter::Action::Reply.new.target_objects
|
25
|
-
targets.
|
25
|
+
expect(targets).to be_empty
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
describe "#targets" do
|
30
30
|
it "returns a collection that contains the replied-to status" do
|
31
31
|
targets = Twitter::Action::Reply.new(:targets => [{:id => 25938088801}]).targets
|
32
|
-
targets.
|
33
|
-
targets.first.
|
32
|
+
expect(targets).to be_an Array
|
33
|
+
expect(targets.first).to be_a Twitter::Tweet
|
34
34
|
end
|
35
35
|
it "is empty when not set" do
|
36
36
|
targets = Twitter::Action::Reply.new.targets
|
37
|
-
targets.
|
37
|
+
expect(targets).to be_empty
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|