t 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/t/collectable.rb CHANGED
@@ -14,7 +14,7 @@ module T
14
14
  tweets.empty? ? collection.flatten : collect_with_max_id(collection, tweets.last.id - 1, &block)
15
15
  end
16
16
 
17
- def collect_with_count(count, &block)
17
+ def collect_with_count(count)
18
18
  opts = {}
19
19
  opts[:count] = MAX_NUM_RESULTS
20
20
  collect_with_max_id do |max_id|
data/lib/t/delete.rb CHANGED
@@ -48,7 +48,7 @@ module T
48
48
  end
49
49
  end
50
50
  end
51
- map %w(d m) => :dm
51
+ map %w[d m] => :dm
52
52
 
53
53
  desc 'favorite TWEET_ID [TWEET_ID...]', 'Delete favorites.'
54
54
  method_option 'force', :aliases => '-f', :type => :boolean, :default => false
@@ -70,7 +70,7 @@ module T
70
70
  end
71
71
  end
72
72
  end
73
- map %w(fave favourite) => :favorite
73
+ map %w[fave favourite] => :favorite
74
74
 
75
75
  desc 'list LIST', 'Delete a list.'
76
76
  method_option 'force', :aliases => '-f', :type => :boolean, :default => false
@@ -108,6 +108,6 @@ module T
108
108
  end
109
109
  end
110
110
  end
111
- map %w(post tweet update) => :status
111
+ map %w[post tweet update] => :status
112
112
  end
113
113
  end
data/lib/t/list.rb CHANGED
@@ -73,14 +73,14 @@ module T
73
73
  print_table(array)
74
74
  end
75
75
  end
76
- map %w(details) => :information
76
+ map %w[details] => :information
77
77
 
78
78
  desc 'members [USER/]LIST', 'Returns the members of a Twitter list.'
79
79
  method_option 'csv', :aliases => '-c', :type => :boolean, :default => false, :desc => 'Output in CSV format.'
80
80
  method_option 'id', :aliases => '-i', :type => :boolean, :default => false, :desc => 'Specify user via ID instead of screen name.'
81
81
  method_option 'long', :aliases => '-l', :type => :boolean, :default => false, :desc => 'Output in long format.'
82
82
  method_option 'reverse', :aliases => '-r', :type => :boolean, :default => false, :desc => 'Reverse the order of the sort.'
83
- method_option 'sort', :aliases => '-s', :type => :string, :enum => %w(favorites followers friends listed screen_name since tweets tweeted), :default => 'screen_name', :desc => 'Specify the order of the results.', :banner => 'ORDER'
83
+ method_option 'sort', :aliases => '-s', :type => :string, :enum => %w[favorites followers friends listed screen_name since tweets tweeted], :default => 'screen_name', :desc => 'Specify the order of the results.', :banner => 'ORDER'
84
84
  method_option 'unsorted', :aliases => '-u', :type => :boolean, :default => false, :desc => 'Output is not sorted.'
85
85
  def members(list)
86
86
  owner, list = extract_owner(list, options)
@@ -106,6 +106,7 @@ module T
106
106
 
107
107
  desc 'timeline [USER/]LIST', 'Show tweet timeline for members of the specified list.'
108
108
  method_option 'csv', :aliases => '-c', :type => :boolean, :default => false, :desc => 'Output in CSV format.'
109
+ method_option 'decode_uris', :aliases => '-d', :type => :boolean, :default => false, :desc => 'Decodes t.co URLs into their original form.'
109
110
  method_option 'id', :aliases => '-i', :type => :boolean, :default => false, :desc => 'Specify user via ID instead of screen name.'
110
111
  method_option 'long', :aliases => '-l', :type => :boolean, :default => false, :desc => 'Output in long format.'
111
112
  method_option 'number', :aliases => '-n', :type => :numeric, :default => DEFAULT_NUM_RESULTS, :desc => 'Limit the number of results.'
@@ -113,11 +114,13 @@ module T
113
114
  def timeline(list)
114
115
  owner, list = extract_owner(list, options)
115
116
  count = options['number'] || DEFAULT_NUM_RESULTS
117
+ opts = {}
118
+ opts[:include_entities] = !!options['decode_uris']
116
119
  tweets = collect_with_count(count) do |count_opts|
117
- client.list_timeline(owner, list, count_opts)
120
+ client.list_timeline(owner, list, count_opts.merge(opts))
118
121
  end
119
122
  print_tweets(tweets)
120
123
  end
121
- map %w(tl) => :timeline
124
+ map %w[tl] => :timeline
122
125
  end
123
126
  end
data/lib/t/printable.rb CHANGED
@@ -44,8 +44,7 @@ module T
44
44
 
45
45
  def print_csv_tweet(tweet)
46
46
  require 'csv'
47
- require 'htmlentities'
48
- say [tweet.id, csv_formatted_time(tweet), tweet.user.screen_name, decode_full_text(tweet)].to_csv
47
+ say [tweet.id, csv_formatted_time(tweet), tweet.user.screen_name, decode_full_text(tweet, options['decode_uris'])].to_csv
49
48
  end
50
49
 
51
50
  def print_csv_user(user)
@@ -55,17 +54,17 @@ module T
55
54
 
56
55
  def print_lists(lists)
57
56
  lists = case options['sort']
58
- when 'members'
59
- lists.sort_by { |user| user.member_count }
60
- when 'mode'
61
- lists.sort_by { |user| user.mode }
62
- when 'since'
63
- lists.sort_by { |user| user.created_at }
64
- when 'subscribers'
65
- lists.sort_by { |user| user.subscriber_count }
66
- else
67
- lists.sort_by { |list| list.slug.downcase }
68
- end unless options['unsorted']
57
+ when 'members'
58
+ lists.sort_by { |user| user.member_count }
59
+ when 'mode'
60
+ lists.sort_by { |user| user.mode }
61
+ when 'since'
62
+ lists.sort_by { |user| user.created_at }
63
+ when 'subscribers'
64
+ lists.sort_by { |user| user.subscriber_count }
65
+ else
66
+ lists.sort_by { |list| list.slug.downcase }
67
+ end unless options['unsorted']
69
68
  lists.reverse! if options['reverse']
70
69
  if options['csv']
71
70
  require 'csv'
@@ -145,23 +144,23 @@ module T
145
144
 
146
145
  def print_users(users) # rubocop:disable CyclomaticComplexity
147
146
  users = case options['sort']
148
- when 'favorites'
149
- users.sort_by { |user| user.favorites_count.to_i }
150
- when 'followers'
151
- users.sort_by { |user| user.followers_count.to_i }
152
- when 'friends'
153
- users.sort_by { |user| user.friends_count.to_i }
154
- when 'listed'
155
- users.sort_by { |user| user.listed_count.to_i }
156
- when 'since'
157
- users.sort_by { |user| user.created_at }
158
- when 'tweets'
159
- users.sort_by { |user| user.statuses_count.to_i }
160
- when 'tweeted'
161
- users.sort_by { |user| user.status? ? user.status.created_at : Time.at(0) }
162
- else
163
- users.sort_by { |user| user.screen_name.downcase }
164
- end unless options['unsorted']
147
+ when 'favorites'
148
+ users.sort_by { |user| user.favorites_count.to_i }
149
+ when 'followers'
150
+ users.sort_by { |user| user.followers_count.to_i }
151
+ when 'friends'
152
+ users.sort_by { |user| user.friends_count.to_i }
153
+ when 'listed'
154
+ users.sort_by { |user| user.listed_count.to_i }
155
+ when 'since'
156
+ users.sort_by { |user| user.created_at }
157
+ when 'tweets'
158
+ users.sort_by { |user| user.statuses_count.to_i }
159
+ when 'tweeted'
160
+ users.sort_by { |user| user.status? ? user.status.created_at : Time.at(0) }
161
+ else
162
+ users.sort_by { |user| user.screen_name.downcase }
163
+ end unless options['unsorted']
165
164
  users.reverse! if options['reverse']
166
165
  if options['csv']
167
166
  require 'csv'
data/lib/t/search.rb CHANGED
@@ -32,15 +32,14 @@ module T
32
32
  def all(query)
33
33
  count = options['number'] || DEFAULT_NUM_RESULTS
34
34
  opts = {:count => MAX_SEARCH_RESULTS}
35
- opts[:include_entities] = 1 if options['decode_uris']
35
+ opts[:include_entities] = !!options['decode_uris']
36
36
  tweets = client.search(query, opts).take(count)
37
37
  tweets.reverse! if options['reverse']
38
- require 'htmlentities'
39
38
  if options['csv']
40
39
  require 'csv'
41
40
  say TWEET_HEADINGS.to_csv unless tweets.empty?
42
41
  tweets.each do |tweet|
43
- say [tweet.id, csv_formatted_time(tweet), tweet.user.screen_name, decode_full_text(tweet)].to_csv
42
+ say [tweet.id, csv_formatted_time(tweet), tweet.user.screen_name, decode_full_text(tweet, options['decode_uris'])].to_csv
44
43
  end
45
44
  elsif options['long']
46
45
  array = tweets.map do |tweet|
@@ -62,10 +61,10 @@ module T
62
61
  method_option 'id', :aliases => '-i', :type => :boolean, :default => false, :desc => 'Specify user via ID instead of screen name.'
63
62
  method_option 'long', :aliases => '-l', :type => :boolean, :default => false, :desc => 'Output in long format.'
64
63
  def favorites(*args)
65
- opts = {:count => MAX_NUM_RESULTS}
66
64
  query = args.pop
67
65
  user = args.pop
68
- opts[:include_entities] = 1 if options['decode_uris']
66
+ opts = {:count => MAX_NUM_RESULTS}
67
+ opts[:include_entities] = !!options['decode_uris']
69
68
  if user
70
69
  require 't/core_ext/string'
71
70
  user = options['id'] ? user.to_i : user.strip_ats
@@ -84,17 +83,17 @@ module T
84
83
  end
85
84
  print_tweets(tweets)
86
85
  end
87
- map %w(faves) => :favorites
86
+ map %w[faves] => :favorites
88
87
 
89
88
  desc 'list [USER/]LIST QUERY', 'Returns Tweets on a list that match the specified query.'
90
89
  method_option 'csv', :aliases => '-c', :type => :boolean, :default => false, :desc => 'Output in CSV format.'
90
+ method_option 'decode_uris', :aliases => '-d', :type => :boolean, :default => false, :desc => 'Decodes t.co URLs into their original form.'
91
91
  method_option 'id', :aliases => '-i', :type => :boolean, :default => false, :desc => 'Specify user via ID instead of screen name.'
92
92
  method_option 'long', :aliases => '-l', :type => :boolean, :default => false, :desc => 'Output in long format.'
93
- method_option 'decode_uris', :aliases => '-d', :type => :boolean, :default => false, :desc => 'Decodes t.co URLs into their original form.'
94
93
  def list(list, query)
95
94
  owner, list = extract_owner(list, options)
96
95
  opts = {:count => MAX_NUM_RESULTS}
97
- opts[:include_entities] = 1 if options['decode_uris']
96
+ opts[:include_entities] = !!options['decode_uris']
98
97
  tweets = collect_with_max_id do |max_id|
99
98
  opts[:max_id] = max_id unless max_id.nil?
100
99
  client.list_timeline(owner, list, opts)
@@ -107,11 +106,11 @@ module T
107
106
 
108
107
  desc 'mentions QUERY', 'Returns Tweets mentioning you that match the specified query.'
109
108
  method_option 'csv', :aliases => '-c', :type => :boolean, :default => false, :desc => 'Output in CSV format.'
110
- method_option 'long', :aliases => '-l', :type => :boolean, :default => false, :desc => 'Output in long format.'
111
109
  method_option 'decode_uris', :aliases => '-d', :type => :boolean, :default => false, :desc => 'Decodes t.co URLs into their original form.'
110
+ method_option 'long', :aliases => '-l', :type => :boolean, :default => false, :desc => 'Output in long format.'
112
111
  def mentions(query)
113
112
  opts = {:count => MAX_NUM_RESULTS}
114
- opts[:include_entities] = 1 if options['decode_uris']
113
+ opts[:include_entities] = !!options['decode_uris']
115
114
  tweets = collect_with_max_id do |max_id|
116
115
  opts[:max_id] = max_id unless max_id.nil?
117
116
  client.mentions(opts)
@@ -121,18 +120,18 @@ module T
121
120
  end
122
121
  print_tweets(tweets)
123
122
  end
124
- map %w(replies) => :mentions
123
+ map %w[replies] => :mentions
125
124
 
126
125
  desc 'retweets [USER] QUERY', "Returns Tweets you've retweeted that match the specified query."
127
126
  method_option 'csv', :aliases => '-c', :type => :boolean, :default => false, :desc => 'Output in CSV format.'
127
+ method_option 'decode_uris', :aliases => '-d', :type => :boolean, :default => false, :desc => 'Decodes t.co URLs into their original form.'
128
128
  method_option 'id', :aliases => '-i', :type => :boolean, :default => false, :desc => 'Specify user via ID instead of screen name.'
129
129
  method_option 'long', :aliases => '-l', :type => :boolean, :default => false, :desc => 'Output in long format.'
130
- method_option 'decode_uris', :aliases => '-d', :type => :boolean, :default => false, :desc => 'Decodes t.co URLs into their original form.'
131
130
  def retweets(*args)
132
- opts = {:count => MAX_NUM_RESULTS}
133
131
  query = args.pop
134
132
  user = args.pop
135
- opts[:include_entities] = 1 if options['decode_uris']
133
+ opts = {:count => MAX_NUM_RESULTS}
134
+ opts[:include_entities] = !!options['decode_uris']
136
135
  if user
137
136
  require 't/core_ext/string'
138
137
  user = options['id'] ? user.to_i : user.strip_ats
@@ -151,12 +150,12 @@ module T
151
150
  end
152
151
  print_tweets(tweets)
153
152
  end
154
- map %w(rts) => :retweets
153
+ map %w[rts] => :retweets
155
154
 
156
155
  desc 'timeline [USER] QUERY', 'Returns Tweets in your timeline that match the specified query.'
157
156
  method_option 'csv', :aliases => '-c', :type => :boolean, :default => false, :desc => 'Output in CSV format.'
158
157
  method_option 'decode_uris', :aliases => '-d', :type => :boolean, :default => false, :desc => 'Decodes t.co URLs into their original form.'
159
- method_option 'exclude', :aliases => '-e', :type => :string, :enum => %w(replies retweets), :desc => 'Exclude certain types of Tweets from the results.', :banner => 'TYPE'
158
+ method_option 'exclude', :aliases => '-e', :type => :string, :enum => %w[replies retweets], :desc => 'Exclude certain types of Tweets from the results.', :banner => 'TYPE'
160
159
  method_option 'id', :aliases => '-i', :type => :boolean, :default => false, :desc => 'Specify user via ID instead of screen name.'
161
160
  method_option 'long', :aliases => '-l', :type => :boolean, :default => false, :desc => 'Output in long format.'
162
161
  method_option 'max_id', :aliases => '-m', :type => :numeric, :desc => 'Returns only the results with an ID less than the specified ID.'
@@ -165,8 +164,8 @@ module T
165
164
  query = args.pop
166
165
  user = args.pop
167
166
  opts = {:count => MAX_NUM_RESULTS}
168
- opts[:include_entities] = 1 if options['decode_uris']
169
167
  opts[:exclude_replies] = true if options['exclude'] == 'replies'
168
+ opts[:include_entities] = !!options['decode_uris']
170
169
  opts[:include_rts] = false if options['exclude'] == 'retweets'
171
170
  opts[:max_id] = options['max_id'] if options['max_id']
172
171
  opts[:since_id] = options['since_id'] if options['since_id']
@@ -188,13 +187,13 @@ module T
188
187
  end
189
188
  print_tweets(tweets)
190
189
  end
191
- map %w(tl) => :timeline
190
+ map %w[tl] => :timeline
192
191
 
193
192
  desc 'users QUERY', 'Returns users that match the specified query.'
194
193
  method_option 'csv', :aliases => '-c', :type => :boolean, :default => false, :desc => 'Output in CSV format.'
195
194
  method_option 'long', :aliases => '-l', :type => :boolean, :default => false, :desc => 'Output in long format.'
196
195
  method_option 'reverse', :aliases => '-r', :type => :boolean, :default => false, :desc => 'Reverse the order of the sort.'
197
- method_option 'sort', :aliases => '-s', :type => :string, :enum => %w(favorites followers friends listed screen_name since tweets tweeted), :default => 'screen_name', :desc => 'Specify the order of the results.', :banner => 'ORDER'
196
+ method_option 'sort', :aliases => '-s', :type => :string, :enum => %w[favorites followers friends listed screen_name since tweets tweeted], :default => 'screen_name', :desc => 'Specify the order of the results.', :banner => 'ORDER'
198
197
  method_option 'unsorted', :aliases => '-u', :type => :boolean, :default => false, :desc => 'Output is not sorted.'
199
198
  def users(query)
200
199
  users = collect_with_page do |page|
data/lib/t/set.rb CHANGED
@@ -22,7 +22,7 @@ module T
22
22
  @rcfile.active_profile = {'username' => @rcfile[screen_name][consumer_key]['username'], 'consumer_key' => consumer_key}
23
23
  say "Active account has been updated to #{@rcfile.active_profile[0]}."
24
24
  end
25
- map %w(default) => :active
25
+ map %w[account default] => :active
26
26
 
27
27
  desc 'bio DESCRIPTION', 'Edits your Bio information on your Twitter profile.'
28
28
  def bio(description)
@@ -54,14 +54,14 @@ module T
54
54
  client.update_profile_background_image(File.new(File.expand_path(file)), :tile => options['tile'], :skip_status => true)
55
55
  say "@#{@rcfile.active_profile[0]}'s background image has been updated."
56
56
  end
57
- map %w(background background_image) => :profile_background_image
57
+ map %w[background background_image] => :profile_background_image
58
58
 
59
59
  desc 'profile_image FILE', 'Sets the image on your Twitter profile.'
60
60
  def profile_image(file)
61
61
  client.update_profile_image(File.new(File.expand_path(file)))
62
62
  say "@#{@rcfile.active_profile[0]}'s image has been updated."
63
63
  end
64
- map %w(avatar image) => :profile_image
64
+ map %w[avatar image] => :profile_image
65
65
 
66
66
  desc 'website URI', 'Sets the website field on your profile.'
67
67
  def website(uri)
data/lib/t/stream.rb CHANGED
@@ -72,7 +72,7 @@ module T
72
72
  search.options = search.options.merge(:format => TWEET_HEADINGS_FORMATTING)
73
73
  search.all(keywords.join(' OR '))
74
74
  end
75
- client.filter(:track => keywords) do |tweet|
75
+ client.filter(:track => keywords.join(',')) do |tweet|
76
76
  next unless tweet.is_a?(Twitter::Tweet)
77
77
  if options['csv']
78
78
  print_csv_tweet(tweet)
@@ -131,7 +131,7 @@ module T
131
131
  print_table([headings])
132
132
  end
133
133
  end
134
- client.follow(user_ids) do |tweet|
134
+ client.filter(:follow => user_ids.join(',')) do |tweet|
135
135
  next unless tweet.is_a?(Twitter::Tweet)
136
136
  if options['csv']
137
137
  print_csv_tweet(tweet)
data/lib/t/utils.rb CHANGED
@@ -47,7 +47,7 @@ module T
47
47
  alias_method :time_ago_in_words, :distance_of_time_in_words
48
48
  alias_method :time_from_now_in_words, :distance_of_time_in_words
49
49
 
50
- def fetch_users(users, options, &block)
50
+ def fetch_users(users, options)
51
51
  format_users!(users, options)
52
52
  require 'retryable'
53
53
  users = retryable(:tries => 3, :on => Twitter::Error, :sleep => 0) do
@@ -87,10 +87,10 @@ module T
87
87
  "#{count || 0} " + (count == 1 || count =~ /^1(\.0+)?$/ ? singular : (plural || "#{singular}s"))
88
88
  end
89
89
 
90
- def decode_full_text(tweet, decode_full_uris = false)
90
+ def decode_full_text(message, decode_full_uris = false)
91
91
  require 'htmlentities'
92
- text = HTMLEntities.new.decode(tweet.full_text)
93
- text = decode_uris(text, tweet.uris) if decode_full_uris
92
+ text = HTMLEntities.new.decode(message.full_text)
93
+ text = decode_uris(text, message.uris) if decode_full_uris
94
94
  text
95
95
  end
96
96
 
data/lib/t/version.rb CHANGED
@@ -1,29 +1,14 @@
1
1
  module T
2
2
  class Version
3
- class << self
4
- # @return [Integer]
5
- def major
6
- 2
7
- end
8
-
9
- # @return [Integer]
10
- def minor
11
- 2
12
- end
13
-
14
- # @return [Integer]
15
- def patch
16
- 0
17
- end
18
-
19
- # @return [String, NilClass]
20
- def pre
21
- nil
22
- end
3
+ MAJOR = 2
4
+ MINOR = 2
5
+ PATCH = 1
6
+ PRE = nil
23
7
 
8
+ class << self
24
9
  # @return [String]
25
10
  def to_s
26
- [major, minor, patch, pre].compact.join('.')
11
+ [MAJOR, MINOR, PATCH, PRE].compact.join('.')
27
12
  end
28
13
  end
29
14
  end
data/spec/cli_spec.rb CHANGED
@@ -29,69 +29,6 @@ describe T::CLI do
29
29
  $stdout = @old_stdout
30
30
  end
31
31
 
32
- describe '--relative-dates' do
33
- before do
34
- stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false'}).to_return(:body => fixture('status.json'))
35
- stub_get('/1.1/users/show.json').with(:query => {:screen_name => 'sferik'}).to_return(:body => fixture('sferik.json'))
36
- @cli.options = @cli.options.merge('relative_dates' => true)
37
- end
38
- it 'status has the correct output (absolute and relative date together)' do
39
- @cli.status('55709764298092545')
40
- expect($stdout.string).to eq <<-eos
41
- ID 55709764298092545
42
- Text The problem with your code is that it's doing exactly what you told it to do.
43
- Screen name @sferik
44
- Posted at Apr 6 2011 (8 months ago)
45
- Retweets 320
46
- Favorites 50
47
- Source Twitter for iPhone
48
- Location Blowfish Sushi To Die For, 2170 Bryant St, San Francisco, California, United States
49
- eos
50
- end
51
- it 'whois has the correct output (absolute and relative date together)' do
52
- @cli.whois('sferik')
53
- expect($stdout.string).to eq <<-eos
54
- ID 7505382
55
- Since Jul 16 2007 (4 years ago)
56
- Last update @goldman You're near my home town! Say hi to Woodstock for me. (7 months ago)
57
- Screen name @sferik
58
- Name Erik Michaels-Ober
59
- Tweets 7,890
60
- Favorites 3,755
61
- Listed 118
62
- Following 212
63
- Followers 2,262
64
- Bio Vagabond.
65
- Location San Francisco
66
- URL https://github.com/sferik
67
- eos
68
- end
69
- context '--csv' do
70
- before do
71
- @cli.options = @cli.options.merge('csv' => true)
72
- end
73
- it 'has the correct output (absolute date in csv)' do
74
- @cli.status('55709764298092545')
75
- expect($stdout.string).to eq <<-eos
76
- ID,Posted at,Screen name,Text,Retweets,Favorites,Source,Location
77
- 55709764298092545,2011-04-06 19:13:37 +0000,sferik,The problem with your code is that it's doing exactly what you told it to do.,320,50,Twitter for iPhone,"Blowfish Sushi To Die For, 2170 Bryant St, San Francisco, California, United States"
78
- eos
79
- end
80
- end
81
- context '--long' do
82
- before do
83
- @cli.options = @cli.options.merge('long' => true)
84
- end
85
- it 'outputs in long format' do
86
- @cli.status('55709764298092545')
87
- expect($stdout.string).to eq <<-eos
88
- ID Posted at Screen name Text ...
89
- 55709764298092545 8 months ago @sferik The problem with your code is t...
90
- eos
91
- end
92
- end
93
- end
94
-
95
32
  describe '#account' do
96
33
  before do
97
34
  @cli.options = @cli.options.merge('profile' => fixture_path + '/.trc')
@@ -211,12 +148,12 @@ testcli
211
148
 
212
149
  describe '#direct_messages' do
213
150
  before do
214
- stub_get('/1.1/direct_messages.json').with(:query => {:count => '20'}).to_return(:body => fixture('direct_messages.json'))
215
- stub_get('/1.1/direct_messages.json').with(:query => {:count => '10', 'max_id' => '1624782205'}).to_return(:body => fixture('empty_array.json'))
151
+ stub_get('/1.1/direct_messages.json').with(:query => {:count => '20', :include_entities => 'false'}).to_return(:body => fixture('direct_messages.json'))
152
+ stub_get('/1.1/direct_messages.json').with(:query => {:count => '10', :max_id => '1624782205', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'))
216
153
  end
217
154
  it 'requests the correct resource' do
218
155
  @cli.direct_messages
219
- expect(a_get('/1.1/direct_messages.json').with(:query => {:count => '20'})).to have_been_made
156
+ expect(a_get('/1.1/direct_messages.json').with(:query => {:count => '20', :include_entities => 'false'})).to have_been_made
220
157
  end
221
158
  it 'has the correct output' do
222
159
  @cli.direct_messages
@@ -280,6 +217,17 @@ ID,Posted at,Screen name,Text
280
217
  eos
281
218
  end
282
219
  end
220
+ context '--decode-uris' do
221
+ before do
222
+ @cli.options = @cli.options.merge('decode_uris' => true)
223
+ stub_get('/1.1/direct_messages.json').with(:query => {:count => '20', :include_entities => 'true'}).to_return(:body => fixture('direct_messages.json'))
224
+ stub_get('/1.1/direct_messages.json').with(:query => {:count => '10', :max_id => '1624782205', :include_entities => 'true'}).to_return(:body => fixture('empty_array.json'))
225
+ end
226
+ it 'requests the correct resource' do
227
+ @cli.direct_messages
228
+ expect(a_get('/1.1/direct_messages.json').with(:query => {:count => '20', :include_entities => 'true'})).to have_been_made
229
+ end
230
+ end
283
231
  context '--long' do
284
232
  before do
285
233
  @cli.options = @cli.options.merge('long' => true)
@@ -303,20 +251,20 @@ ID Posted at Screen name Text
303
251
  end
304
252
  context '--number' do
305
253
  before do
306
- stub_get('/1.1/direct_messages.json').with(:query => {:count => '1'}).to_return(:body => fixture('direct_messages.json'))
307
- stub_get('/1.1/direct_messages.json').with(:query => {:count => '200'}).to_return(:body => fixture('200_direct_messages.json'))
308
- stub_get('/1.1/direct_messages.json').with(:query => {:count => '1', :max_id => '235851563443306495'}).to_return(:body => fixture('direct_messages.json'))
254
+ stub_get('/1.1/direct_messages.json').with(:query => {:count => '1', :include_entities => 'false'}).to_return(:body => fixture('direct_messages.json'))
255
+ stub_get('/1.1/direct_messages.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:body => fixture('200_direct_messages.json'))
256
+ stub_get('/1.1/direct_messages.json').with(:query => {:count => '1', :max_id => '235851563443306495', :include_entities => 'false'}).to_return(:body => fixture('direct_messages.json'))
309
257
  end
310
258
  it 'limits the number of results to 1' do
311
259
  @cli.options = @cli.options.merge('number' => 1)
312
260
  @cli.direct_messages
313
- expect(a_get('/1.1/direct_messages.json').with(:query => {:count => '1'})).to have_been_made
261
+ expect(a_get('/1.1/direct_messages.json').with(:query => {:count => '1', :include_entities => 'false'})).to have_been_made
314
262
  end
315
263
  it 'limits the number of results to 201' do
316
264
  @cli.options = @cli.options.merge('number' => 201)
317
265
  @cli.direct_messages
318
- expect(a_get('/1.1/direct_messages.json').with(:query => {:count => '200'})).to have_been_made
319
- expect(a_get('/1.1/direct_messages.json').with(:query => {:count => '1', :max_id => '235851563443306495'})).to have_been_made
266
+ expect(a_get('/1.1/direct_messages.json').with(:query => {:count => '200', :include_entities => 'false'})).to have_been_made
267
+ expect(a_get('/1.1/direct_messages.json').with(:query => {:count => '1', :max_id => '235851563443306495', :include_entities => 'false'})).to have_been_made
320
268
  end
321
269
  end
322
270
  context '--reverse' do
@@ -369,12 +317,12 @@ ID Posted at Screen name Text
369
317
 
370
318
  describe '#direct_messages_sent' do
371
319
  before do
372
- stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '20'}).to_return(:body => fixture('direct_messages.json'))
373
- stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '10', 'max_id' => '1624782205'}).to_return(:body => fixture('empty_array.json'))
320
+ stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '20', :include_entities => 'false'}).to_return(:body => fixture('direct_messages.json'))
321
+ stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '10', :max_id => '1624782205', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'))
374
322
  end
375
323
  it 'requests the correct resource' do
376
324
  @cli.direct_messages_sent
377
- expect(a_get('/1.1/direct_messages/sent.json').with(:query => {:count => '20'})).to have_been_made
325
+ expect(a_get('/1.1/direct_messages/sent.json').with(:query => {:count => '20', :include_entities => 'false'})).to have_been_made
378
326
  end
379
327
  it 'has the correct output' do
380
328
  @cli.direct_messages_sent
@@ -438,6 +386,17 @@ ID,Posted at,Screen name,Text
438
386
  eos
439
387
  end
440
388
  end
389
+ context '--decode-uris' do
390
+ before do
391
+ @cli.options = @cli.options.merge('decode_uris' => true)
392
+ stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '20', :include_entities => 'true'}).to_return(:body => fixture('direct_messages.json'))
393
+ stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '10', :max_id => '1624782205', :include_entities => 'true'}).to_return(:body => fixture('empty_array.json'))
394
+ end
395
+ it 'requests the correct resource' do
396
+ @cli.direct_messages_sent
397
+ expect(a_get('/1.1/direct_messages/sent.json').with(:query => {:count => '20', :include_entities => 'true'})).to have_been_made
398
+ end
399
+ end
441
400
  context '--long' do
442
401
  before do
443
402
  @cli.options = @cli.options.merge('long' => true)
@@ -461,20 +420,20 @@ ID Posted at Screen name Text
461
420
  end
462
421
  context '--number' do
463
422
  before do
464
- stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '1'}).to_return(:body => fixture('direct_messages.json'))
465
- stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '200'}).to_return(:body => fixture('200_direct_messages.json'))
466
- stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '1', :max_id => '235851563443306495'}).to_return(:body => fixture('direct_messages.json'))
423
+ stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '1', :include_entities => 'false'}).to_return(:body => fixture('direct_messages.json'))
424
+ stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:body => fixture('200_direct_messages.json'))
425
+ stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '1', :max_id => '235851563443306495', :include_entities => 'false'}).to_return(:body => fixture('direct_messages.json'))
467
426
  end
468
427
  it 'limits the number of results 1' do
469
428
  @cli.options = @cli.options.merge('number' => 1)
470
429
  @cli.direct_messages_sent
471
- expect(a_get('/1.1/direct_messages/sent.json').with(:query => {:count => '1'})).to have_been_made
430
+ expect(a_get('/1.1/direct_messages/sent.json').with(:query => {:count => '1', :include_entities => 'false'})).to have_been_made
472
431
  end
473
432
  it 'limits the number of results to 201' do
474
433
  @cli.options = @cli.options.merge('number' => 201)
475
434
  @cli.direct_messages_sent
476
- expect(a_get('/1.1/direct_messages/sent.json').with(:query => {:count => '200'})).to have_been_made
477
- expect(a_get('/1.1/direct_messages/sent.json').with(:query => {:count => '1', :max_id => '235851563443306495'})).to have_been_made
435
+ expect(a_get('/1.1/direct_messages/sent.json').with(:query => {:count => '200', :include_entities => 'false'})).to have_been_made
436
+ expect(a_get('/1.1/direct_messages/sent.json').with(:query => {:count => '1', :max_id => '235851563443306495', :include_entities => 'false'})).to have_been_made
478
437
  end
479
438
  end
480
439
  context '--reverse' do
@@ -854,11 +813,11 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
854
813
 
855
814
  describe '#favorites' do
856
815
  before do
857
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '20'}).to_return(:body => fixture('statuses.json'))
816
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
858
817
  end
859
818
  it 'requests the correct resource' do
860
819
  @cli.favorites
861
- expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '20'})).to have_been_made
820
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '20', :include_entities => 'false'})).to have_been_made
862
821
  end
863
822
  it 'has the correct output' do
864
823
  @cli.favorites
@@ -971,6 +930,20 @@ ID,Posted at,Screen name,Text
971
930
  eos
972
931
  end
973
932
  end
933
+ context '--decode-uris' do
934
+ before do
935
+ @cli.options = @cli.options.merge('decode_uris' => true)
936
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'))
937
+ end
938
+ it 'requests the correct resource' do
939
+ @cli.favorites
940
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '20', :include_entities => 'true'})).to have_been_made
941
+ end
942
+ it 'decodes URLs' do
943
+ @cli.favorites
944
+ expect($stdout.string).to include 'https://twitter.com/sferik/status/243988000076337152'
945
+ end
946
+ end
974
947
  context '--long' do
975
948
  before do
976
949
  @cli.options = @cli.options.merge('long' => true)
@@ -1036,95 +1009,95 @@ ID Posted at Screen name Text
1036
1009
  context '--max-id' do
1037
1010
  before do
1038
1011
  @cli.options = @cli.options.merge('max_id' => 244_104_558_433_951_744)
1039
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :max_id => '244104558433951744'}).to_return(:body => fixture('statuses.json'))
1012
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :max_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
1040
1013
  end
1041
1014
  it 'requests the correct resource' do
1042
1015
  @cli.favorites
1043
- expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '20', :max_id => '244104558433951744'})).to have_been_made
1016
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '20', :max_id => '244104558433951744', :include_entities => 'false'})).to have_been_made
1044
1017
  end
1045
1018
  end
1046
1019
  context '--number' do
1047
1020
  before do
1048
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '1'}).to_return(:body => fixture('statuses.json'))
1049
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '200'}).to_return(:body => fixture('200_statuses.json'))
1050
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '1', :max_id => '265500541700956160'}).to_return(:body => fixture('statuses.json'))
1021
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '1', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
1022
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:body => fixture('200_statuses.json'))
1023
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '1', :max_id => '265500541700956160', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
1051
1024
  end
1052
1025
  it 'limits the number of results to 1' do
1053
1026
  @cli.options = @cli.options.merge('number' => 1)
1054
1027
  @cli.favorites
1055
- expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '1'})).to have_been_made
1028
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '1', :include_entities => 'false'})).to have_been_made
1056
1029
  end
1057
1030
  it 'limits the number of results to 201' do
1058
1031
  @cli.options = @cli.options.merge('number' => 201)
1059
1032
  @cli.favorites
1060
- expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200'})).to have_been_made
1061
- expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '1', :max_id => '265500541700956160'})).to have_been_made
1033
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :include_entities => 'false'})).to have_been_made
1034
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '1', :max_id => '265500541700956160', :include_entities => 'false'})).to have_been_made
1062
1035
  end
1063
1036
  end
1064
1037
  context '--since-id' do
1065
1038
  before do
1066
1039
  @cli.options = @cli.options.merge('since_id' => 244_104_558_433_951_744)
1067
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :since_id => '244104558433951744'}).to_return(:body => fixture('statuses.json'))
1040
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :since_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
1068
1041
  end
1069
1042
  it 'requests the correct resource' do
1070
1043
  @cli.favorites
1071
- expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '20', :since_id => '244104558433951744'})).to have_been_made
1044
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '20', :since_id => '244104558433951744', :include_entities => 'false'})).to have_been_made
1072
1045
  end
1073
1046
  end
1074
1047
  context 'with a user passed' do
1075
1048
  before do
1076
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :screen_name => 'sferik'}).to_return(:body => fixture('statuses.json'))
1049
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
1077
1050
  end
1078
1051
  it 'requests the correct resource' do
1079
1052
  @cli.favorites('sferik')
1080
- expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '20', :screen_name => 'sferik'})).to have_been_made
1053
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '20', :screen_name => 'sferik', :include_entities => 'false'})).to have_been_made
1081
1054
  end
1082
1055
  context '--id' do
1083
1056
  before do
1084
1057
  @cli.options = @cli.options.merge('id' => true)
1085
- stub_get('/1.1/favorites/list.json').with(:query => {:user_id => '7505382', :count => '20'}).to_return(:body => fixture('statuses.json'))
1058
+ stub_get('/1.1/favorites/list.json').with(:query => {:user_id => '7505382', :count => '20', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
1086
1059
  end
1087
1060
  it 'requests the correct resource' do
1088
1061
  @cli.favorites('7505382')
1089
- expect(a_get('/1.1/favorites/list.json').with(:query => {:user_id => '7505382', :count => '20'})).to have_been_made
1062
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:user_id => '7505382', :count => '20', :include_entities => 'false'})).to have_been_made
1090
1063
  end
1091
1064
  end
1092
1065
  context '--max-id' do
1093
1066
  before do
1094
1067
  @cli.options = @cli.options.merge('max_id' => 244_104_558_433_951_744)
1095
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :screen_name => 'sferik', :max_id => '244104558433951744'}).to_return(:body => fixture('statuses.json'))
1068
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :screen_name => 'sferik', :max_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
1096
1069
  end
1097
1070
  it 'requests the correct resource' do
1098
1071
  @cli.favorites('sferik')
1099
- expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '20', :screen_name => 'sferik', :max_id => '244104558433951744'})).to have_been_made
1072
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '20', :screen_name => 'sferik', :max_id => '244104558433951744', :include_entities => 'false'})).to have_been_made
1100
1073
  end
1101
1074
  end
1102
1075
  context '--number' do
1103
1076
  before do
1104
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '1', :screen_name => 'sferik'}).to_return(:body => fixture('statuses.json'))
1105
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :screen_name => 'sferik'}).to_return(:body => fixture('200_statuses.json'))
1106
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '1', :screen_name => 'sferik', :max_id => '265500541700956160'}).to_return(:body => fixture('statuses.json'))
1077
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '1', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
1078
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('200_statuses.json'))
1079
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '1', :screen_name => 'sferik', :max_id => '265500541700956160', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
1107
1080
  end
1108
1081
  it 'limits the number of results to 1' do
1109
1082
  @cli.options = @cli.options.merge('number' => 1)
1110
1083
  @cli.favorites('sferik')
1111
- expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '1', :screen_name => 'sferik'})).to have_been_made
1084
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '1', :screen_name => 'sferik', :include_entities => 'false'})).to have_been_made
1112
1085
  end
1113
1086
  it 'limits the number of results to 201' do
1114
1087
  @cli.options = @cli.options.merge('number' => 201)
1115
1088
  @cli.favorites('sferik')
1116
- expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :screen_name => 'sferik'})).to have_been_made
1117
- expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '1', :screen_name => 'sferik', :max_id => '265500541700956160'})).to have_been_made
1089
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :screen_name => 'sferik', :include_entities => 'false'})).to have_been_made
1090
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '1', :screen_name => 'sferik', :max_id => '265500541700956160', :include_entities => 'false'})).to have_been_made
1118
1091
  end
1119
1092
  end
1120
1093
  context '--since-id' do
1121
1094
  before do
1122
1095
  @cli.options = @cli.options.merge('since_id' => 244_104_558_433_951_744)
1123
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :screen_name => 'sferik', :since_id => '244104558433951744'}).to_return(:body => fixture('statuses.json'))
1096
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :screen_name => 'sferik', :since_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
1124
1097
  end
1125
1098
  it 'requests the correct resource' do
1126
1099
  @cli.favorites('sferik')
1127
- expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '20', :screen_name => 'sferik', :since_id => '244104558433951744'})).to have_been_made
1100
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '20', :screen_name => 'sferik', :since_id => '244104558433951744', :include_entities => 'false'})).to have_been_made
1128
1101
  end
1129
1102
  end
1130
1103
  end
@@ -1896,11 +1869,11 @@ ID Created at Screen name Slug Members Subscribers Mode ...
1896
1869
 
1897
1870
  describe '#mentions' do
1898
1871
  before do
1899
- stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '20'}).to_return(:body => fixture('statuses.json'))
1872
+ stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '20', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
1900
1873
  end
1901
1874
  it 'requests the correct resource' do
1902
1875
  @cli.mentions
1903
- expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '20'})).to have_been_made
1876
+ expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '20', :include_entities => 'false'})).to have_been_made
1904
1877
  end
1905
1878
  it 'has the correct output' do
1906
1879
  @cli.mentions
@@ -2013,6 +1986,20 @@ ID,Posted at,Screen name,Text
2013
1986
  eos
2014
1987
  end
2015
1988
  end
1989
+ context '--decode-uris' do
1990
+ before do
1991
+ @cli.options = @cli.options.merge('decode_uris' => true)
1992
+ stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '20', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'))
1993
+ end
1994
+ it 'requests the correct resource' do
1995
+ @cli.mentions
1996
+ expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '20', :include_entities => 'true'})).to have_been_made
1997
+ end
1998
+ it 'decodes URLs' do
1999
+ @cli.mentions
2000
+ expect($stdout.string).to include 'https://twitter.com/sferik/status/243988000076337152'
2001
+ end
2002
+ end
2016
2003
  context '--long' do
2017
2004
  before do
2018
2005
  @cli.options = @cli.options.merge('long' => true)
@@ -2077,20 +2064,20 @@ ID Posted at Screen name Text
2077
2064
  end
2078
2065
  context '--number' do
2079
2066
  before do
2080
- stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '1'}).to_return(:body => fixture('statuses.json'))
2081
- stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200'}).to_return(:body => fixture('200_statuses.json'))
2082
- stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '1', :max_id => '265500541700956160'}).to_return(:body => fixture('statuses.json'))
2067
+ stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '1', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2068
+ stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:body => fixture('200_statuses.json'))
2069
+ stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '1', :max_id => '265500541700956160', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2083
2070
  end
2084
2071
  it 'limits the number of results to 1' do
2085
2072
  @cli.options = @cli.options.merge('number' => 1)
2086
2073
  @cli.mentions
2087
- expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '1'})).to have_been_made
2074
+ expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '1', :include_entities => 'false'})).to have_been_made
2088
2075
  end
2089
2076
  it 'limits the number of results to 201' do
2090
2077
  @cli.options = @cli.options.merge('number' => 201)
2091
2078
  @cli.mentions
2092
- expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200'})).to have_been_made
2093
- expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '1', :max_id => '265500541700956160'})).to have_been_made
2079
+ expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :include_entities => 'false'})).to have_been_made
2080
+ expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '1', :max_id => '265500541700956160', :include_entities => 'false'})).to have_been_made
2094
2081
  end
2095
2082
  end
2096
2083
  end
@@ -2247,14 +2234,14 @@ ID Posted at Screen name Text
2247
2234
 
2248
2235
  describe '#retweets' do
2249
2236
  before do
2250
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true'}).to_return(:body => fixture('statuses.json'))
2251
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244102729860009983'}).to_return(:body => fixture('statuses.json'))
2237
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2238
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244102729860009983', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2252
2239
  end
2253
2240
  context 'without arguments' do
2254
2241
  it 'requests the correct resource' do
2255
2242
  @cli.retweets
2256
- expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true'})).to have_been_made
2257
- expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244102729860009983'})).to have_been_made.times(3)
2243
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :include_entities => 'false'})).to have_been_made
2244
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244102729860009983', :include_entities => 'false'})).to have_been_made.times(3)
2258
2245
  end
2259
2246
  it 'has the correct output' do
2260
2247
  @cli.retweets
@@ -2373,6 +2360,18 @@ ID,Posted at,Screen name,Text
2373
2360
  eos
2374
2361
  end
2375
2362
  end
2363
+ context '--decode-uris' do
2364
+ before do
2365
+ @cli.options = @cli.options.merge('decode_uris' => true)
2366
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'))
2367
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244102729860009983', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'))
2368
+ end
2369
+ it 'requests the correct resource' do
2370
+ @cli.retweets
2371
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :include_entities => 'true'})).to have_been_made
2372
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244102729860009983', :include_entities => 'true'})).to have_been_made.times(3)
2373
+ end
2374
+ end
2376
2375
  context '--long' do
2377
2376
  before do
2378
2377
  @cli.options = @cli.options.merge('long' => true)
@@ -2437,41 +2436,41 @@ ID Posted at Screen name Text
2437
2436
  end
2438
2437
  context '--number' do
2439
2438
  before do
2440
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true'}).to_return(:body => fixture('statuses.json'))
2441
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244107823733174271'}).to_return(:body => fixture('statuses.json'))
2439
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2440
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244107823733174271', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2442
2441
  end
2443
2442
  it 'limits the number of results to 1' do
2444
2443
  @cli.options = @cli.options.merge('number' => 1)
2445
2444
  @cli.retweets
2446
- expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true'})).to have_been_made
2445
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :include_entities => 'false'})).to have_been_made
2447
2446
  end
2448
2447
  it 'limits the number of results to 201' do
2449
2448
  @cli.options = @cli.options.merge('number' => 201)
2450
2449
  @cli.retweets
2451
- expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true'})).to have_been_made
2452
- expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244107823733174271'})).to have_been_made
2450
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :include_entities => 'false'})).to have_been_made
2451
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244107823733174271', :include_entities => 'false'})).to have_been_made
2453
2452
  end
2454
2453
  end
2455
2454
  context 'with a user passed' do
2456
2455
  before do
2457
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik'}).to_return(:body => fixture('statuses.json'))
2458
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik', :max_id => '244102729860009983'}).to_return(:body => fixture('statuses.json'))
2456
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2457
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik', :max_id => '244102729860009983', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2459
2458
  end
2460
2459
  it 'requests the correct resource' do
2461
2460
  @cli.retweets('sferik')
2462
- expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik'})).to have_been_made
2463
- expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik', :max_id => '244102729860009983'})).to have_been_made.times(3)
2461
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik', :include_entities => 'false'})).to have_been_made
2462
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik', :max_id => '244102729860009983', :include_entities => 'false'})).to have_been_made.times(3)
2464
2463
  end
2465
2464
  context '--id' do
2466
2465
  before do
2467
2466
  @cli.options = @cli.options.merge('id' => true)
2468
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382'}).to_return(:body => fixture('statuses.json'))
2469
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382', :max_id => '244102729860009983'}).to_return(:body => fixture('statuses.json'))
2467
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2468
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382', :max_id => '244102729860009983', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2470
2469
  end
2471
2470
  it 'requests the correct resource' do
2472
2471
  @cli.retweets('7505382')
2473
- expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382'})).to have_been_made
2474
- expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382', :max_id => '244102729860009983'})).to have_been_made.times(3)
2472
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382', :include_entities => 'false'})).to have_been_made
2473
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382', :max_id => '244102729860009983', :include_entities => 'false'})).to have_been_made.times(3)
2475
2474
  end
2476
2475
  end
2477
2476
  end
@@ -2497,11 +2496,11 @@ ID Posted at Screen name Text
2497
2496
 
2498
2497
  describe '#status' do
2499
2498
  before do
2500
- stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false'}).to_return(:body => fixture('status.json'))
2499
+ stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status.json'))
2501
2500
  end
2502
2501
  it 'requests the correct resources' do
2503
2502
  @cli.status('55709764298092545')
2504
- expect(a_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false'})).to have_been_made
2503
+ expect(a_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'})).to have_been_made
2505
2504
  end
2506
2505
  it 'has the correct output' do
2507
2506
  @cli.status('55709764298092545')
@@ -2530,7 +2529,7 @@ ID,Posted at,Screen name,Text,Retweets,Favorites,Source,Location
2530
2529
  end
2531
2530
  context 'with no street address' do
2532
2531
  before do
2533
- stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false'}).to_return(:body => fixture('status_no_street_address.json'))
2532
+ stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_street_address.json'))
2534
2533
  end
2535
2534
  it 'has the correct output' do
2536
2535
  @cli.status('55709764298092545')
@@ -2548,7 +2547,7 @@ Location Blowfish Sushi To Die For, San Francisco, California, United States
2548
2547
  end
2549
2548
  context 'with no locality' do
2550
2549
  before do
2551
- stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false'}).to_return(:body => fixture('status_no_locality.json'))
2550
+ stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_locality.json'))
2552
2551
  end
2553
2552
  it 'has the correct output' do
2554
2553
  @cli.status('55709764298092545')
@@ -2566,7 +2565,7 @@ Location Blowfish Sushi To Die For, San Francisco, California, United States
2566
2565
  end
2567
2566
  context 'with no attributes' do
2568
2567
  before do
2569
- stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false'}).to_return(:body => fixture('status_no_attributes.json'))
2568
+ stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_attributes.json'))
2570
2569
  end
2571
2570
  it 'has the correct output' do
2572
2571
  @cli.status('55709764298092545')
@@ -2584,7 +2583,7 @@ Location Blowfish Sushi To Die For, San Francisco, United States
2584
2583
  end
2585
2584
  context 'with no country' do
2586
2585
  before do
2587
- stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false'}).to_return(:body => fixture('status_no_country.json'))
2586
+ stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_country.json'))
2588
2587
  end
2589
2588
  it 'has the correct output' do
2590
2589
  @cli.status('55709764298092545')
@@ -2602,7 +2601,7 @@ Location Blowfish Sushi To Die For, San Francisco
2602
2601
  end
2603
2602
  context 'with no full name' do
2604
2603
  before do
2605
- stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false'}).to_return(:body => fixture('status_no_full_name.json'))
2604
+ stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_full_name.json'))
2606
2605
  end
2607
2606
  it 'has the correct output' do
2608
2607
  @cli.status('55709764298092545')
@@ -2620,8 +2619,8 @@ Location Blowfish Sushi To Die For
2620
2619
  end
2621
2620
  context 'with no place' do
2622
2621
  before do
2623
- stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false'}).to_return(:body => fixture('status_no_place.json'))
2624
- stub_request(:get, 'http://maps.google.com/maps/geo').with(:query => hash_including(:key => 'REPLACE_WITH_YOUR_GOOGLE_KEY', :oe => 'utf-8', :output => 'xml')).to_return(:body => fixture('geo.kml'), :headers => {:content_type => 'text/xml; charset=UTF-8'})
2622
+ stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_place.json'))
2623
+ stub_request(:get, 'http://maps.google.com/maps/api/geocode/json').with(:query => {:latlng => '37.75963095,-122.410067', :sensor => 'false'}).to_return(:body => fixture('geo.json'), :headers => {:content_type => 'application/json; charset=UTF-8'})
2625
2624
  end
2626
2625
  it 'has the correct output' do
2627
2626
  @cli.status('55709764298092545')
@@ -2633,13 +2632,13 @@ Posted at Apr 6 2011 (8 months ago)
2633
2632
  Retweets 320
2634
2633
  Favorites 50
2635
2634
  Source Twitter for iPhone
2636
- Location San Francisco, CA, USA
2635
+ Location San Francisco, CA, United States
2637
2636
  eos
2638
2637
  end
2639
2638
  context 'with no city' do
2640
2639
  before do
2641
- stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false'}).to_return(:body => fixture('status_no_place.json'))
2642
- stub_request(:get, 'http://maps.google.com/maps/geo').with(:query => hash_including(:key => 'REPLACE_WITH_YOUR_GOOGLE_KEY', :oe => 'utf-8', :output => 'xml')).to_return(:body => fixture('geo_no_city.kml'), :headers => {:content_type => 'text/xml; charset=UTF-8'})
2640
+ stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_place.json'))
2641
+ stub_request(:get, 'http://maps.google.com/maps/api/geocode/json').with(:query => {:latlng => '37.75963095,-122.410067', :sensor => 'false'}).to_return(:body => fixture('geo_no_city.json'), :headers => {:content_type => 'application/json; charset=UTF-8'})
2643
2642
  end
2644
2643
  it 'has the correct output' do
2645
2644
  @cli.status('55709764298092545')
@@ -2651,14 +2650,14 @@ Posted at Apr 6 2011 (8 months ago)
2651
2650
  Retweets 320
2652
2651
  Favorites 50
2653
2652
  Source Twitter for iPhone
2654
- Location CA, USA
2653
+ Location CA, United States
2655
2654
  eos
2656
2655
  end
2657
2656
  end
2658
2657
  context 'with no state' do
2659
2658
  before do
2660
- stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false'}).to_return(:body => fixture('status_no_place.json'))
2661
- stub_request(:get, 'http://maps.google.com/maps/geo').with(:query => hash_including(:key => 'REPLACE_WITH_YOUR_GOOGLE_KEY', :oe => 'utf-8', :output => 'xml')).to_return(:body => fixture('geo_no_state.kml'), :headers => {:content_type => 'text/xml; charset=UTF-8'})
2659
+ stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_place.json'))
2660
+ stub_request(:get, 'http://maps.google.com/maps/api/geocode/json').with(:query => {:latlng => '37.75963095,-122.410067', :sensor => 'false'}).to_return(:body => fixture('geo_no_state.json'), :headers => {:content_type => 'application/json; charset=UTF-8'})
2662
2661
  end
2663
2662
  it 'has the correct output' do
2664
2663
  @cli.status('55709764298092545')
@@ -2670,7 +2669,7 @@ Posted at Apr 6 2011 (8 months ago)
2670
2669
  Retweets 320
2671
2670
  Favorites 50
2672
2671
  Source Twitter for iPhone
2673
- Location USA
2672
+ Location United States
2674
2673
  eos
2675
2674
  end
2676
2675
  end
@@ -2687,16 +2686,78 @@ ID Posted at Screen name Text ...
2687
2686
  eos
2688
2687
  end
2689
2688
  end
2689
+ describe '--relative-dates' do
2690
+ before do
2691
+ stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status.json'))
2692
+ stub_get('/1.1/users/show.json').with(:query => {:screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('sferik.json'))
2693
+ @cli.options = @cli.options.merge('relative_dates' => true)
2694
+ end
2695
+ it 'status has the correct output (absolute and relative date together)' do
2696
+ @cli.status('55709764298092545')
2697
+ expect($stdout.string).to eq <<-eos
2698
+ ID 55709764298092545
2699
+ Text The problem with your code is that it's doing exactly what you told it to do.
2700
+ Screen name @sferik
2701
+ Posted at Apr 6 2011 (8 months ago)
2702
+ Retweets 320
2703
+ Favorites 50
2704
+ Source Twitter for iPhone
2705
+ Location Blowfish Sushi To Die For, 2170 Bryant St, San Francisco, California, United States
2706
+ eos
2707
+ end
2708
+ it 'whois has the correct output (absolute and relative date together)' do
2709
+ @cli.whois('sferik')
2710
+ expect($stdout.string).to eq <<-eos
2711
+ ID 7505382
2712
+ Since Jul 16 2007 (4 years ago)
2713
+ Last update @goldman You're near my home town! Say hi to Woodstock for me. (7 months ago)
2714
+ Screen name @sferik
2715
+ Name Erik Michaels-Ober
2716
+ Tweets 7,890
2717
+ Favorites 3,755
2718
+ Listed 118
2719
+ Following 212
2720
+ Followers 2,262
2721
+ Bio Vagabond.
2722
+ Location San Francisco
2723
+ URL https://github.com/sferik
2724
+ eos
2725
+ end
2726
+ context '--csv' do
2727
+ before do
2728
+ @cli.options = @cli.options.merge('csv' => true)
2729
+ end
2730
+ it 'has the correct output (absolute date in csv)' do
2731
+ @cli.status('55709764298092545')
2732
+ expect($stdout.string).to eq <<-eos
2733
+ ID,Posted at,Screen name,Text,Retweets,Favorites,Source,Location
2734
+ 55709764298092545,2011-04-06 19:13:37 +0000,sferik,The problem with your code is that it's doing exactly what you told it to do.,320,50,Twitter for iPhone,"Blowfish Sushi To Die For, 2170 Bryant St, San Francisco, California, United States"
2735
+ eos
2736
+ end
2737
+ end
2738
+ context '--long' do
2739
+ before do
2740
+ @cli.options = @cli.options.merge('long' => true)
2741
+ end
2742
+ it 'outputs in long format' do
2743
+ @cli.status('55709764298092545')
2744
+ expect($stdout.string).to eq <<-eos
2745
+ ID Posted at Screen name Text ...
2746
+ 55709764298092545 8 months ago @sferik The problem with your code is t...
2747
+ eos
2748
+ end
2749
+ end
2750
+ end
2690
2751
  end
2691
2752
 
2692
2753
  describe '#timeline' do
2693
2754
  before do
2694
- stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20'}).to_return(:body => fixture('statuses.json'))
2755
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2695
2756
  end
2696
2757
  context 'without user' do
2697
2758
  it 'requests the correct resource' do
2698
2759
  @cli.timeline
2699
- expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20'})).to have_been_made
2760
+ expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :include_entities => 'false'})).to have_been_made
2700
2761
  end
2701
2762
  it 'has the correct output' do
2702
2763
  @cli.timeline
@@ -2810,24 +2871,38 @@ ID,Posted at,Screen name,Text
2810
2871
  eos
2811
2872
  end
2812
2873
  end
2874
+ context '--decode-uris' do
2875
+ before do
2876
+ @cli.options = @cli.options.merge('decode_uris' => true)
2877
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'))
2878
+ end
2879
+ it 'requests the correct resource' do
2880
+ @cli.timeline
2881
+ expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :include_entities => 'true'})).to have_been_made
2882
+ end
2883
+ it 'decodes URLs' do
2884
+ @cli.timeline
2885
+ expect($stdout.string).to include 'https://twitter.com/sferik/status/243988000076337152'
2886
+ end
2887
+ end
2813
2888
  context '--exclude=replies' do
2814
2889
  before do
2815
2890
  @cli.options = @cli.options.merge('exclude' => 'replies')
2816
- stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :exclude_replies => 'true'}).to_return(:body => fixture('statuses.json'))
2891
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :exclude_replies => 'true', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2817
2892
  end
2818
2893
  it 'excludes replies' do
2819
2894
  @cli.timeline
2820
- expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :exclude_replies => 'true'})).to have_been_made
2895
+ expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :exclude_replies => 'true', :include_entities => 'false'})).to have_been_made
2821
2896
  end
2822
2897
  end
2823
2898
  context '--exclude=retweets' do
2824
2899
  before do
2825
2900
  @cli.options = @cli.options.merge('exclude' => 'retweets')
2826
- stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :include_rts => 'false'}).to_return(:body => fixture('statuses.json'))
2901
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :include_rts => 'false', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2827
2902
  end
2828
2903
  it 'excludes retweets' do
2829
2904
  @cli.timeline
2830
- expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :include_rts => 'false'})).to have_been_made
2905
+ expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :include_rts => 'false', :include_entities => 'false'})).to have_been_made
2831
2906
  end
2832
2907
  end
2833
2908
  context '--long' do
@@ -2895,95 +2970,95 @@ ID Posted at Screen name Text
2895
2970
  context '--max-id' do
2896
2971
  before do
2897
2972
  @cli.options = @cli.options.merge('max_id' => 244_104_558_433_951_744)
2898
- stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :max_id => '244104558433951744'}).to_return(:body => fixture('statuses.json'))
2973
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :max_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2899
2974
  end
2900
2975
  it 'requests the correct resource' do
2901
2976
  @cli.timeline
2902
- expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :max_id => '244104558433951744'})).to have_been_made
2977
+ expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :max_id => '244104558433951744', :include_entities => 'false'})).to have_been_made
2903
2978
  end
2904
2979
  end
2905
2980
  context '--number' do
2906
2981
  before do
2907
- stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '1'}).to_return(:body => fixture('statuses.json'))
2908
- stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200'}).to_return(:body => fixture('200_statuses.json'))
2909
- stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '1', :max_id => '265500541700956160'}).to_return(:body => fixture('statuses.json'))
2982
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '1', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2983
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:body => fixture('200_statuses.json'))
2984
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '1', :max_id => '265500541700956160', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2910
2985
  end
2911
2986
  it 'limits the number of results to 1' do
2912
2987
  @cli.options = @cli.options.merge('number' => 1)
2913
2988
  @cli.timeline
2914
- expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '1'})).to have_been_made
2989
+ expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '1', :include_entities => 'false'})).to have_been_made
2915
2990
  end
2916
2991
  it 'limits the number of results to 201' do
2917
2992
  @cli.options = @cli.options.merge('number' => 201)
2918
2993
  @cli.timeline
2919
- expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200'})).to have_been_made
2920
- expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '1', :max_id => '265500541700956160'})).to have_been_made
2994
+ expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_entities => 'false'})).to have_been_made
2995
+ expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '1', :max_id => '265500541700956160', :include_entities => 'false'})).to have_been_made
2921
2996
  end
2922
2997
  end
2923
2998
  context '--since-id' do
2924
2999
  before do
2925
3000
  @cli.options = @cli.options.merge('since_id' => 244_104_558_433_951_744)
2926
- stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :since_id => '244104558433951744'}).to_return(:body => fixture('statuses.json'))
3001
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :since_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2927
3002
  end
2928
3003
  it 'requests the correct resource' do
2929
3004
  @cli.timeline
2930
- expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :since_id => '244104558433951744'})).to have_been_made
3005
+ expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :since_id => '244104558433951744', :include_entities => 'false'})).to have_been_made
2931
3006
  end
2932
3007
  end
2933
3008
  context 'with a user passed' do
2934
3009
  before do
2935
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :screen_name => 'sferik'}).to_return(:body => fixture('statuses.json'))
3010
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2936
3011
  end
2937
3012
  it 'requests the correct resource' do
2938
3013
  @cli.timeline('sferik')
2939
- expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :screen_name => 'sferik'})).to have_been_made
3014
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :screen_name => 'sferik', :include_entities => 'false'})).to have_been_made
2940
3015
  end
2941
3016
  context '--id' do
2942
3017
  before do
2943
3018
  @cli.options = @cli.options.merge('id' => true)
2944
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :user_id => '7505382'}).to_return(:body => fixture('statuses.json'))
3019
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :user_id => '7505382', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2945
3020
  end
2946
3021
  it 'requests the correct resource' do
2947
3022
  @cli.timeline('7505382')
2948
- expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :user_id => '7505382'})).to have_been_made
3023
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :user_id => '7505382', :include_entities => 'false'})).to have_been_made
2949
3024
  end
2950
3025
  end
2951
3026
  context '--max-id' do
2952
3027
  before do
2953
3028
  @cli.options = @cli.options.merge('max_id' => 244_104_558_433_951_744)
2954
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :screen_name => 'sferik', :max_id => '244104558433951744'}).to_return(:body => fixture('statuses.json'))
3029
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :screen_name => 'sferik', :max_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2955
3030
  end
2956
3031
  it 'requests the correct resource' do
2957
3032
  @cli.timeline('sferik')
2958
- expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :screen_name => 'sferik', :max_id => '244104558433951744'})).to have_been_made
3033
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :screen_name => 'sferik', :max_id => '244104558433951744', :include_entities => 'false'})).to have_been_made
2959
3034
  end
2960
3035
  end
2961
3036
  context '--number' do
2962
3037
  before do
2963
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '1', :screen_name => 'sferik'}).to_return(:body => fixture('statuses.json'))
2964
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik'}).to_return(:body => fixture('200_statuses.json'))
2965
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '1', :screen_name => 'sferik', :max_id => '265500541700956160'}).to_return(:body => fixture('statuses.json'))
3038
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '1', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
3039
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('200_statuses.json'))
3040
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '1', :screen_name => 'sferik', :max_id => '265500541700956160', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2966
3041
  end
2967
3042
  it 'limits the number of results to 1' do
2968
3043
  @cli.options = @cli.options.merge('number' => 1)
2969
3044
  @cli.timeline('sferik')
2970
- expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '1', :screen_name => 'sferik'})).to have_been_made
3045
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '1', :screen_name => 'sferik', :include_entities => 'false'})).to have_been_made
2971
3046
  end
2972
3047
  it 'limits the number of results to 201' do
2973
3048
  @cli.options = @cli.options.merge('number' => 201)
2974
3049
  @cli.timeline('sferik')
2975
- expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik'})).to have_been_made
2976
- expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '1', :screen_name => 'sferik', :max_id => '265500541700956160'})).to have_been_made
3050
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :include_entities => 'false'})).to have_been_made
3051
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '1', :screen_name => 'sferik', :max_id => '265500541700956160', :include_entities => 'false'})).to have_been_made
2977
3052
  end
2978
3053
  end
2979
3054
  context '--since-id' do
2980
3055
  before do
2981
3056
  @cli.options = @cli.options.merge('since_id' => 244_104_558_433_951_744)
2982
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :screen_name => 'sferik', :since_id => '244104558433951744'}).to_return(:body => fixture('statuses.json'))
3057
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :screen_name => 'sferik', :since_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2983
3058
  end
2984
3059
  it 'requests the correct resource' do
2985
3060
  @cli.timeline('sferik')
2986
- expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :screen_name => 'sferik', :since_id => '244104558433951744'})).to have_been_made
3061
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :screen_name => 'sferik', :since_id => '244104558433951744', :include_entities => 'false'})).to have_been_made
2987
3062
  end
2988
3063
  end
2989
3064
  end
@@ -3370,11 +3445,11 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
3370
3445
 
3371
3446
  describe '#whois' do
3372
3447
  before do
3373
- stub_get('/1.1/users/show.json').with(:query => {:screen_name => 'sferik'}).to_return(:body => fixture('sferik.json'))
3448
+ stub_get('/1.1/users/show.json').with(:query => {:screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('sferik.json'))
3374
3449
  end
3375
3450
  it 'requests the correct resource' do
3376
3451
  @cli.whois('sferik')
3377
- expect(a_get('/1.1/users/show.json').with(:query => {:screen_name => 'sferik'})).to have_been_made
3452
+ expect(a_get('/1.1/users/show.json').with(:query => {:screen_name => 'sferik', :include_entities => 'false'})).to have_been_made
3378
3453
  end
3379
3454
  it 'has the correct output' do
3380
3455
  @cli.whois('sferik')
@@ -3409,11 +3484,11 @@ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name
3409
3484
  context '--id' do
3410
3485
  before do
3411
3486
  @cli.options = @cli.options.merge('id' => true)
3412
- stub_get('/1.1/users/show.json').with(:query => {:user_id => '7505382'}).to_return(:body => fixture('sferik.json'))
3487
+ stub_get('/1.1/users/show.json').with(:query => {:user_id => '7505382', :include_entities => 'false'}).to_return(:body => fixture('sferik.json'))
3413
3488
  end
3414
3489
  it 'requests the correct resource' do
3415
3490
  @cli.whois('7505382')
3416
- expect(a_get('/1.1/users/show.json').with(:query => {:user_id => '7505382'})).to have_been_made
3491
+ expect(a_get('/1.1/users/show.json').with(:query => {:user_id => '7505382', :include_entities => 'false'})).to have_been_made
3417
3492
  end
3418
3493
  end
3419
3494
  context '--long' do