twitter 8.0.0 β†’ 8.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 887f3f7456fa0b9203510120f02368de184dacf83d110b8c0b8a5c28e89bfd74
4
- data.tar.gz: 328625a02d50b6fb1bc4167badb0089c249a1c7f89379fba88694bacc247b7c9
3
+ metadata.gz: 11e677ef797cfd3ab6475560db947569fd11c3b081e2c0b922b74430a2f788e5
4
+ data.tar.gz: 65f083e2f1c64ddcc4366a7ff8d948d26c7cb20fdff0e29113d26ffa35aa50d2
5
5
  SHA512:
6
- metadata.gz: f4da2b78382449b35b00181f71ea6e48de2e169c9e1c5107c414d2384c721a0cb4328b7981dc9f987a5c947e593974b1fb811ef76d10a277dfb471d93c039d97
7
- data.tar.gz: b02e8884564113c6e28ff5852826e35861c1ce7dee1db57925c0c6f09f5dfebf9879030c786b44910a910a224592ba8c42045bddbac187e68e03d4e29bf4608c
6
+ metadata.gz: 5196906962cd60016ecac0ef288c486709ac931ce7220958ce164a99d99c6916b4d18cc5481e57d863208a21d776e1f77188ea9aec763c5a20a6892650ceda11
7
+ data.tar.gz: bfcc66dbf3956ad6dde755b41ccf7c3ac1c5cedce125ba932e865f9677204ce4b7c07705b9afacf8b0d75775641c71a17afa51aa76fbd82d20ec1d8088192948
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ 8.0.1
2
+ -----
3
+ * [Add post-install message](https://github.com/sferik/twitter/commit/154e66b3655b41226ca8b6cbf52e2866a9e5b2d0)
4
+
1
5
  8.0.0
2
6
  -----
3
7
  * [Fix filter limit issue](https://github.com/sferik/twitter/commit/be91024f7af7e94dd6578e08937975443dc09487)
data/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006-2020 Erik Berlin, John Nunemaker, Wynn Netherland, Steve Richert, Steve Agalloco
1
+ Copyright (c) 2006-2023 Erik Berlin, John Nunemaker, Wynn Netherland, Steve Richert, Steve Agalloco
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,36 +1,35 @@
1
1
  # The Twitter Ruby Gem
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/twitter.svg)][gem]
4
- [![Build Status](https://travis-ci.org/sferik/twitter.svg?branch=master)][travis]
5
- [![Maintainability](https://api.codeclimate.com/v1/badges/09362621ad91e8f599b3/maintainability)][maintainability]
6
- [![Inline docs](http://inch-ci.org/github/sferik/twitter.svg?style=shields)][inchpages]
3
+ ## πŸ“£ This gem is no longer maintained
4
+ The Twitter Ruby Gem is no longer maintained and will not support Twitter API v2.
7
5
 
8
- [gem]: https://rubygems.org/gems/twitter
9
- [travis]: https://travis-ci.org/sferik/twitter
10
- [maintainability]: https://codeclimate.com/github/sferik/twitter/maintainability
11
- [inchpages]: http://inch-ci.org/github/sferik/twitter
6
+ ## πŸŽ‰ Here’s the good news
7
+ We recommend switching to the [X gem][x], which supports both v1.1 and v2 to make
8
+ the transition easier. It’s a robust, modern libary that is designed to ensure
9
+ you’ll be able to easily integrate any new changes Twitter/X may roll out.
12
10
 
13
- A Ruby interface to the Twitter API.
11
+ [x]: https://sferik.github.io/x-ruby/
14
12
 
15
- ## Installation
16
- gem install twitter
13
+ ## πŸ’– Sponsoring
14
+ The [X gem][x] is free to use, but with new API pricing tiers, it actually costs
15
+ money to develop and maintain. By contributing to the project, you help us:
17
16
 
18
- ## CLI
19
- Looking for the Twitter command-line interface? It was [removed][] from this
20
- gem in version 0.5.0 and now exists as a [separate project][t].
17
+ 1. πŸ›  Maintain the library: Keeping it up-to-date and secure.
18
+ 2. 🌈 Add new features: Enhancements that make your life easier.
19
+ 3. πŸ’¬ Provide support: Faster responses to issues and feature requests.
21
20
 
22
- [removed]: https://github.com/sferik/twitter/commit/dd2445e3e2c97f38b28a3f32ea902536b3897adf
23
- [t]: https://github.com/sferik/t
21
+ ⭐️ Bonus: Sponsors will get priority support and influence over the project
22
+ roadmap. We will also list your name or your company’s logo on our GitHub page.
24
23
 
25
- ## Documentation
26
- [http://rdoc.info/gems/twitter][documentation]
24
+ Building and maintaining an open-source project like this takes a considerable
25
+ amount of time and effort. Your sponsorship can help sustain this project. Even
26
+ a small monthly donation makes a huge difference!
27
27
 
28
- [documentation]: http://rdoc.info/gems/twitter
28
+ Thanks for considering sponsorship. Together we can make the X gem even better!
29
29
 
30
- ## Examples
31
- [https://github.com/sferik/twitter/tree/master/examples][examples]
30
+ #### πŸ€‘ [Sponsor today!][sponsor]
32
31
 
33
- [examples]: https://github.com/sferik/twitter/tree/master/examples
32
+ [sponsor]: https://github.com/sponsors/sferik
34
33
 
35
34
  ## Announcements
36
35
  You should [follow @gem][follow] on Twitter for announcements and updates about
@@ -38,230 +37,8 @@ this library.
38
37
 
39
38
  [follow]: https://twitter.com/gem
40
39
 
41
- ## Mailing List
42
- Please direct questions about this library to the [mailing list].
43
-
44
- [mailing list]: https://groups.google.com/group/twitter-ruby-gem
45
-
46
- ## Apps Wiki
47
- Does your project or organization use this gem? Add it to the [apps
48
- wiki][apps]!
49
-
50
- [apps]: https://github.com/sferik/twitter/wiki/apps
51
-
52
- ## Configuration
53
- Twitter API v1.1 requires you to authenticate via OAuth, so you'll need to
54
- [register your application with Twitter][register]. Once you've registered an
55
- application, make sure to set the correct access level, otherwise you may see
56
- the error:
57
-
58
- [register]: https://apps.twitter.com/
59
-
60
- Read-only application cannot POST
61
-
62
- Your new application will be assigned a consumer key/secret pair and you will
63
- be assigned an OAuth access token/secret pair for that application. You'll need
64
- to configure these values before you make a request or else you'll get the
65
- error:
66
-
67
- Bad Authentication data
68
-
69
- You can pass configuration options as a block to `Twitter::REST::Client.new`.
70
-
71
- ```ruby
72
- client = Twitter::REST::Client.new do |config|
73
- config.consumer_key = "YOUR_CONSUMER_KEY"
74
- config.consumer_secret = "YOUR_CONSUMER_SECRET"
75
- config.access_token = "YOUR_ACCESS_TOKEN"
76
- config.access_token_secret = "YOUR_ACCESS_SECRET"
77
- end
78
- ```
79
-
80
- ## Usage Examples
81
- After configuring a `client`, you can do the following things.
82
-
83
- **Tweet (as the authenticated user)**
84
-
85
- ```ruby
86
- client.update("I'm tweeting with @gem!")
87
- ```
88
- **Follow a user (by screen name or user ID)**
89
-
90
- ```ruby
91
- client.follow("gem")
92
- client.follow(213747670)
93
- ```
94
- **Fetch a user (by screen name or user ID)**
95
-
96
- ```ruby
97
- client.user("gem")
98
- client.user(213747670)
99
- ```
100
- **Fetch a cursored list of followers with profile details (by screen name or user ID, or by implicit authenticated user)**
101
-
102
- ```ruby
103
- client.followers("gem")
104
- client.followers(213747670)
105
- client.followers
106
- ```
107
- **Fetch a cursored list of friends with profile details (by screen name or user ID, or by implicit authenticated user)**
108
-
109
- ```ruby
110
- client.friends("gem")
111
- client.friends(213747670)
112
- client.friends
113
- ```
114
-
115
- **Fetch the timeline of Tweets by a user**
116
-
117
- ```ruby
118
- client.user_timeline("gem")
119
- client.user_timeline(213747670)
120
- ```
121
- **Fetch the timeline of Tweets from the authenticated user's home page**
122
-
123
- ```ruby
124
- client.home_timeline
125
- ```
126
- **Fetch the timeline of Tweets mentioning the authenticated user**
127
-
128
- ```ruby
129
- client.mentions_timeline
130
- ```
131
- **Fetch a particular Tweet by ID**
132
-
133
- ```ruby
134
- client.status(27558893223)
135
- ```
136
- **Collect the three most recent marriage proposals to @justinbieber**
137
-
138
- ```ruby
139
- client.search("to:justinbieber marry me", result_type: "recent").take(3).collect do |tweet|
140
- "#{tweet.user.screen_name}: #{tweet.text}"
141
- end
142
- ```
143
- **Find a Japanese-language Tweet tagged #ruby (excluding retweets)**
144
-
145
- ```ruby
146
- client.search("#ruby -rt", lang: "ja").first.text
147
- ```
148
- For more usage examples, please see the full [documentation][].
149
-
150
- ## Streaming
151
- Site Streams are restricted to whitelisted accounts. To apply for access,
152
- [follow the steps in the Site Streams documentation][site-streams]. [User
153
- Streams][user-streams] do not require prior approval.
154
-
155
- [site-streams]: https://dev.twitter.com/streaming/sitestreams#applyingforaccess
156
- [user-streams]: https://dev.twitter.com/streaming/userstreams
157
-
158
- **Configuration works just like `Twitter::REST::Client`**
159
-
160
- ```ruby
161
- client = Twitter::Streaming::Client.new do |config|
162
- config.consumer_key = "YOUR_CONSUMER_KEY"
163
- config.consumer_secret = "YOUR_CONSUMER_SECRET"
164
- config.access_token = "YOUR_ACCESS_TOKEN"
165
- config.access_token_secret = "YOUR_ACCESS_SECRET"
166
- end
167
- ```
168
-
169
- **Stream a random sample of all tweets**
170
-
171
- ```ruby
172
- client.sample do |object|
173
- puts object.text if object.is_a?(Twitter::Tweet)
174
- end
175
- ```
176
-
177
- **Stream mentions of coffee or tea**
178
-
179
- ```ruby
180
- topics = ["coffee", "tea"]
181
- client.filter(track: topics.join(",")) do |object|
182
- puts object.text if object.is_a?(Twitter::Tweet)
183
- end
184
- ```
185
-
186
- **Stream tweets, events, and direct messages for the authenticated user**
187
-
188
- ```ruby
189
- client.user do |object|
190
- case object
191
- when Twitter::Tweet
192
- puts "It's a tweet!"
193
- when Twitter::DirectMessage
194
- puts "It's a direct message!"
195
- when Twitter::Streaming::StallWarning
196
- warn "Falling behind!"
197
- end
198
- end
199
- ```
200
-
201
- An `object` may be one of the following:
202
- * `Twitter::Tweet`
203
- * `Twitter::DirectMessage`
204
- * `Twitter::Streaming::DeletedTweet`
205
- * `Twitter::Streaming::Event`
206
- * `Twitter::Streaming::FriendList`
207
- * `Twitter::Streaming::StallWarning`
208
-
209
- ## Ads
210
-
211
- We recommend using the [Twitter Ads SDK for Ruby][ads] to interact with the Twitter Ads API.
212
-
213
- [ads]: http://twitterdev.github.io/twitter-ruby-ads-sdk/
214
-
215
- ## Object Graph
216
- ![Entity-relationship diagram][erd]
217
-
218
- [erd]: https://cdn.rawgit.com/sferik/twitter/master/etc/erd.svg "Entity-relationship diagram"
219
-
220
- This entity-relationship diagram is generated programatically. If you add or
221
- remove any Twitter objects, please regenerate the ERD with the following
222
- command:
223
-
224
- bundle exec rake erd
225
-
226
- ## Supported Ruby Versions
227
- This library aims to support and is [tested against][travis] the following Ruby
228
- versions:
229
-
230
- * Ruby 2.7
231
- * Ruby 3.0
232
- * Ruby 3.1
233
- * Ruby 3.2
234
-
235
- If something doesn't work on one of these versions, it's a bug.
236
-
237
- This library may inadvertently work (or seem to work) on other Ruby versions,
238
- however support will only be provided for the versions listed above.
239
-
240
- If you would like this library to support another Ruby version or
241
- implementation, you may volunteer to be a maintainer. Being a maintainer
242
- entails making sure all tests run and pass on that implementation. When
243
- something breaks on your implementation, you will be responsible for providing
244
- patches in a timely fashion. If critical issues for a particular implementation
245
- exist at the time of a major release, support for that Ruby version may be
246
- dropped.
247
-
248
- ## Versioning
249
- This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations
250
- of this scheme should be reported as bugs. Specifically, if a minor or patch
251
- version is released that breaks backward compatibility, that version should be
252
- immediately yanked and/or a new version should be immediately released that
253
- restores compatibility. Breaking changes to the public API will only be
254
- introduced with new major versions. As a result of this policy, you can (and
255
- should) specify a dependency on this gem using the [Pessimistic Version
256
- Constraint][pvc] with two digits of precision. For example:
257
-
258
- spec.add_dependency 'twitter', '~> 6.0'
259
-
260
- [semver]: http://semver.org/
261
- [pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
262
-
263
40
  ## Copyright
264
- Copyright (c) 2006-2016 Erik Berlin, John Nunemaker, Wynn Netherland, Steve Richert, Steve Agalloco.
41
+ Copyright (c) 2006-2023 Erik Berlin, John Nunemaker, Wynn Netherland, Steve Richert, Steve Agalloco.
265
42
  See [LICENSE][] for details.
266
43
 
267
44
  [license]: LICENSE.md
@@ -4,7 +4,7 @@ module Twitter
4
4
 
5
5
  # @return [Enumerator]
6
6
  def each(start = 0, &block)
7
- return to_enum(:each, start) unless block_given?
7
+ return to_enum(:each, start) unless block
8
8
 
9
9
  Array(@collection[start..]).each(&block)
10
10
  unless finished?
@@ -10,8 +10,10 @@ module Twitter
10
10
  #
11
11
  # @see https://developer.twitter.com/en/docs/media/upload-media/uploading-media/media-best-practices
12
12
  def upload(media, media_category_prefix: "tweet")
13
- return chunk_upload(media, "video/mp4", "#{media_category_prefix}_video") if File.extname(media) == ".mp4"
14
- return chunk_upload(media, "image/gif", "#{media_category_prefix}_gif") if File.extname(media) == ".gif" && File.size(media) > 5_000_000
13
+ ext = File.extname(media)
14
+ return chunk_upload(media, "video/mp4", "#{media_category_prefix}_video") if ext == ".mp4"
15
+ return chunk_upload(media, "video/quicktime", "#{media_category_prefix}_video") if ext == ".mov"
16
+ return chunk_upload(media, "image/gif", "#{media_category_prefix}_gif") if ext == ".gif" && File.size(media) > 5_000_000
15
17
 
16
18
  Twitter::REST::Request.new(self, :multipart_post, "https://upload.twitter.com/1.1/media/upload.json", key: :media, file: media).perform
17
19
  end
@@ -54,8 +56,10 @@ module Twitter
54
56
  def finalize_media(media_id)
55
57
  response = Twitter::REST::Request.new(self, :post, "https://upload.twitter.com/1.1/media/upload.json",
56
58
  command: "FINALIZE", media_id: media_id).perform
59
+ failed_or_succeeded = %w[failed succeeded]
60
+
57
61
  loop do
58
- return response if !response[:processing_info] || %w[failed succeeded].include?(response[:processing_info][:state])
62
+ return response if !response[:processing_info] || failed_or_succeeded.include?(response[:processing_info][:state])
59
63
 
60
64
  sleep(response[:processing_info][:check_after_secs])
61
65
  response = Twitter::REST::Request.new(self, :get, "https://upload.twitter.com/1.1/media/upload.json",
@@ -95,7 +95,7 @@ module Twitter
95
95
 
96
96
  # Set a Proc to be run when connection established.
97
97
  def before_request(&block)
98
- if block_given?
98
+ if block
99
99
  @before_request = block
100
100
  self
101
101
  elsif instance_variable_defined?(:@before_request)
@@ -135,12 +135,12 @@ module Twitter
135
135
  # @param users [Array]
136
136
  # @return [Array<Integer>]
137
137
  def collect_user_ids(users)
138
- users.collect do |user|
138
+ users.filter_map do |user|
139
139
  case user
140
140
  when Integer then user
141
141
  when Twitter::User then user.id
142
142
  end
143
- end.compact
143
+ end
144
144
  end
145
145
  end
146
146
  end
data/lib/twitter/utils.rb CHANGED
@@ -8,7 +8,7 @@ module Twitter
8
8
  # @param enumerable [Enumerable]
9
9
  # @return [Array, Enumerator]
10
10
  def flat_pmap(enumerable, &block)
11
- return to_enum(:flat_pmap, enumerable) unless block_given?
11
+ return to_enum(:flat_pmap, enumerable) unless block
12
12
 
13
13
  pmap(enumerable, &block).flatten(1)
14
14
  end
@@ -19,7 +19,7 @@ module Twitter
19
19
  # @param enumerable [Enumerable]
20
20
  # @return [Array, Enumerator]
21
21
  def pmap(enumerable, &block)
22
- return to_enum(:pmap, enumerable) unless block_given?
22
+ return to_enum(:pmap, enumerable) unless block
23
23
 
24
24
  if enumerable.count == 1
25
25
  enumerable.collect(&block)
@@ -14,7 +14,7 @@ module Twitter
14
14
 
15
15
  # @return [Integer]
16
16
  def patch
17
- 0
17
+ 1
18
18
  end
19
19
 
20
20
  # @return [Integer, NilClass]
data/twitter.gemspec CHANGED
@@ -21,6 +21,35 @@ Gem::Specification.new do |spec|
21
21
  spec.licenses = %w[MIT]
22
22
  spec.metadata["rubygems_mfa_required"] = "true"
23
23
  spec.name = "twitter"
24
+ spec.post_install_message = %q{πŸ“£ Attention Twitter Ruby Gem User!
25
+ If you're seeing this message, that means you're using the old Twitter Ruby gem
26
+ which is no longer maintained and will not support Twitter API v2.
27
+
28
+ πŸŽ‰ Here's the good news:
29
+ We recommend switching to the X gem, which supports both v1.1 and v2 to make
30
+ the transition easier. It's a robust, modern libary that is designed to ensure
31
+ you'll be able to easily integrate any new changes Twitter/X may roll out.
32
+
33
+ πŸ”— For more details, visit: https://sferik.github.io/x-ruby/
34
+
35
+ πŸ€” Why consider sponsoring?
36
+ The X gem is free to use, but with new API pricing tiers, it actually costs
37
+ money to develop and maintain. By contributing to the project, you help us:
38
+
39
+ 1. πŸ›  Maintain the library: Keeping it up-to-date and secure.
40
+ 2. 🌈 Add new features: Enhancements that make your life easier.
41
+ 3. πŸ’¬ Provide support: Faster responses to issues and feature requests.
42
+ ⭐️ Bonus: Sponsors will get priority support and influence over the project
43
+ roadmap. We will also list your name or your company's logo on our GitHub page.
44
+
45
+ πŸ”— To sponsor, visit: https://github.com/sponsors/sferik
46
+
47
+ Building and maintaining an open-source project like this takes a considerable
48
+ amount of time and effort. Your sponsorship can help sustain this project. Even
49
+ a small monthly donation makes a huge difference!
50
+
51
+ πŸ’– Thanks for considering sponsorship. Together we can make the X gem even better!
52
+ }
24
53
  spec.require_paths = %w[lib]
25
54
  spec.required_ruby_version = ">= 3.0"
26
55
  spec.summary = spec.description
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.0
4
+ version: 8.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Berlin
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2023-04-30 00:00:00.000000000 Z
15
+ date: 2023-09-20 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: addressable
@@ -264,7 +264,24 @@ licenses:
264
264
  - MIT
265
265
  metadata:
266
266
  rubygems_mfa_required: 'true'
267
- post_install_message:
267
+ post_install_message: "\U0001F4E3 Attention Twitter Ruby Gem User!\nIf you're seeing
268
+ this message, that means you're using the old Twitter Ruby gem\nwhich is no longer
269
+ maintained and will not support Twitter API v2.\n\n\U0001F389 Here's the good news:\nWe
270
+ recommend switching to the X gem, which supports both v1.1 and v2 to make\nthe transition
271
+ easier. It's a robust, modern libary that is designed to ensure\nyou'll be able
272
+ to easily integrate any new changes Twitter/X may roll out.\n\n\U0001F517 For more
273
+ details, visit: https://sferik.github.io/x-ruby/\n\n\U0001F914 Why consider sponsoring?\nThe
274
+ X gem is free to use, but with new API pricing tiers, it actually costs\nmoney to
275
+ develop and maintain. By contributing to the project, you help us:\n\n1. \U0001F6E0
276
+ \ Maintain the library: Keeping it up-to-date and secure.\n2. \U0001F308 Add new
277
+ features: Enhancements that make your life easier.\n3. \U0001F4AC Provide support:
278
+ Faster responses to issues and feature requests.\n⭐️ Bonus: Sponsors will get priority
279
+ support and influence over the project\nroadmap. We will also list your name or
280
+ your company's logo on our GitHub page.\n\n\U0001F517 To sponsor, visit: https://github.com/sponsors/sferik\n\nBuilding
281
+ and maintaining an open-source project like this takes a considerable\namount of
282
+ time and effort. Your sponsorship can help sustain this project. Even\na small monthly
283
+ donation makes a huge difference!\n\n\U0001F496 Thanks for considering sponsorship.
284
+ Together we can make the X gem even better!\n"
268
285
  rdoc_options: []
269
286
  require_paths:
270
287
  - lib
@@ -279,7 +296,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
279
296
  - !ruby/object:Gem::Version
280
297
  version: '0'
281
298
  requirements: []
282
- rubygems_version: 3.4.12
299
+ rubygems_version: 3.4.19
283
300
  signing_key:
284
301
  specification_version: 4
285
302
  summary: A Ruby interface to the Twitter API.