pax_global_header 0000666 0000000 0000000 00000000064 13200674762 0014521 g ustar 00root root 0000000 0000000 52 comment=d6c5100447e2c12d83bae26810632081ac0b69f5
twitter-6.2.0/ 0000775 0000000 0000000 00000000000 13200674762 0013230 5 ustar 00root root 0000000 0000000 twitter-6.2.0/.codeclimate.yml 0000664 0000000 0000000 00000000315 13200674762 0016301 0 ustar 00root root 0000000 0000000 engines:
rubocop:
enabled: true
duplication:
enabled: true
config:
languages:
- ruby
ratings:
paths:
- "**.rb"
exclude_paths:
- etc/**/*
- examples/**/*
- spec/**/*
twitter-6.2.0/.gitignore 0000664 0000000 0000000 00000000130 13200674762 0015212 0 ustar 00root root 0000000 0000000 *.gem
*~
.bundle
.rvmrc
.yardoc
Gemfile.lock
coverage/*
doc/*
log/*
measurement/*
pkg/*
twitter-6.2.0/.rspec 0000664 0000000 0000000 00000000027 13200674762 0014344 0 ustar 00root root 0000000 0000000 --color
--order random
twitter-6.2.0/.rubocop.yml 0000664 0000000 0000000 00000001574 13200674762 0015511 0 ustar 00root root 0000000 0000000 Layout/AccessModifierIndentation:
EnforcedStyle: outdent
Layout/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space
Lint/Void:
Enabled: false
Metrics/BlockLength:
Max: 36
Exclude:
- spec/**/*.rb
Metrics/BlockNesting:
Max: 2
Metrics/LineLength:
AllowURI: true
Enabled: false
Metrics/MethodLength:
CountComments: false
Max: 10
Metrics/ModuleLength:
Max: 150 # TODO: Lower to 100
Metrics/ParameterLists:
Max: 4
CountKeywordArgs: true
Style/CollectionMethods:
Enabled: true
PreferredMethods:
map: 'collect'
map!: 'collect!'
reduce: 'inject'
find: 'detect'
find_all: 'select'
Style/Documentation:
Enabled: false
Style/DoubleNegation:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: false
Style/NumericPredicate:
Enabled: false
Style/TrailingCommaInLiteral:
EnforcedStyleForMultiline: 'comma'
twitter-6.2.0/.travis.yml 0000664 0000000 0000000 00000000663 13200674762 0015346 0 ustar 00root root 0000000 0000000 cache: bundler
language: ruby
rvm:
- 2.0.0
- 2.1
- 2.2
- 2.3.3
- 2.4.0
- jruby-9.1.6.0
- jruby-head
- rbx-2
- ruby-head
sudo: false
bundler_args: --without development --retry=3 --jobs=3
before_install:
- gem update --system
- gem update bundler
env:
global:
- JRUBY_OPTS="$JRUBY_OPTS --debug"
matrix:
allow_failures:
- rvm: jruby-head
- rvm: rbx-2
- rvm: ruby-head
fast_finish: true
twitter-6.2.0/.yardopts 0000664 0000000 0000000 00000000455 13200674762 0015102 0 ustar 00root root 0000000 0000000 --no-private
--protected
--tag rate_limited:"Rate Limited?"
--tag authentication:"Authentication"
--markup markdown
-
CHANGELOG.md
CONTRIBUTING.md
LICENSE.md
README.md
examples/AllTweets.md
examples/Configuration.md
examples/RateLimiting.md
examples/Search.md
examples/Streaming.md
examples/Update.md
twitter-6.2.0/CHANGELOG.md 0000664 0000000 0000000 00000234046 13200674762 0015052 0 ustar 00root root 0000000 0000000 6.2.0
------
Not yet documented, sorry. For now, please use git to compare tags:
https://github.com/sferik/twitter/compare/v6.1.0...v6.2.0
6.1.0
------
Not yet documented, sorry. For now, please use git to compare tags:
https://github.com/sferik/twitter/compare/v6.0.0...v6.1.0
6.0.0
------
Not yet documented, sorry. For now, please use git to compare tags:
https://github.com/sferik/twitter/compare/v5.16.0...v6.0.0
5.16.0
------
* [Add Twitter::Trend#tweet_volume](https://github.com/sferik/twitter/commit/e797b62e5e6a768e8aeafde6186e1f5310e6bfc6)
* [Add new settings to Twitter::Settings](https://github.com/sferik/twitter/commit/d047ce00034d26a99927076c28679ce08fd69308)
* [Fix `Version.to_a`](https://github.com/sferik/twitter/commit/0cd119abf64e6c2b7fd861b0df65b7cb41d892b4)
* [Remove the encoding of profile urls](https://github.com/sferik/twitter/commit/6d46bd689ab4a4f119d1d692488aab37e4e99893)
* [Update http dependency to ~> 1.0](https://github.com/sferik/twitter/commit/8d379a45be6948a9d9264aa2e91ef5f7bdbe1db8)
* [Fetch host and port directly from the request object](https://github.com/sferik/twitter/commit/f9f1bbdabde2ec96dcdd8900fe7bca072f9bea6b)
5.15.0
------
* [`NullObject#as_json` returns 'null'](https://github.com/sferik/twitter/commit/2979e703c09a45f012cb2c5b2d6663bf1f4d3351) ([@lukevmorris](https://twitter.com/lukevmorris))
* [Add methods to get to parameters of quoted tweet](https://github.com/sferik/twitter/commit/afd41a3e36cc94194a2110ba9adce13486ced9fd) ([@couhie](https://twitter.com/couhie))
* [Add additional mime_types for multi-part upload](https://github.com/sferik/twitter/commit/947fcdc9f7348f267d74933ffa43d191cf248a9c)
* [Fix bug where flat_pmap can return nil](https://github.com/sferik/twitter/commit/e22a5601ec702632510b3e983e50929ceb334b95)
* [Add new error codes](https://github.com/sferik/twitter/commit/1ce6b2f02d0f5f78435ee898e8f5b6d3db18d6f1)
5.14.0
------
* [Add `Twitter::NullObject#respond_to?`](https://github.com/sferik/twitter/commit/438e311d93f382960650e20898203c880ade6b25)
* [Add `Twitter::Media::Video`, `Twitter::Media::VideoInfo`, and `Twitter::Media::Variant`](https://github.com/sferik/twitter/commit/158193f85843ebac7b3188bbad26d73907577f6a)
* [Add `Twitter::Media::AnimatedGif` media entity](https://github.com/sferik/twitter/commit/76cb6645a54969edc7c9195e9e27e3728f5fd683) ([@nidev](https://twitter.com/nidev))
5.13.0
------
* [Deprecate `Twitter::REST::Client#get` and `Twitter::REST::Client#post`](https://github.com/sferik/twitter/commit/65773c7d741098490f4164fae9e4433365cd4292)
* [Rename `Twitter::REST::Client::URL_PREFIX` to `Twitter::REST::Client::BASE_URL`](https://github.com/sferik/twitter/commit/73e2b9be19acf1403f324e5be48a550d3756d822)
* [Extract `Twitter::Headers` class](https://github.com/sferik/twitter/commit/e0d4c36bade95253b98b3ee657af409bfeadbbb6)
* [Move `Twitter::Request` to `Twitter::REST::Request`](https://github.com/sferik/twitter/commit/a46d9f21067724c437d40c7cb9c609f6cd304df1)
* [Add `Twitter::REST::Request#rate_limit`](https://github.com/sferik/twitter/commit/0c9f9d6a15835a0260a5a56a8aaffdc3f3e39eed)
* [Rename `Twitter::REST::Utils` methods](https://github.com/sferik/twitter/commit/2b1cceca0d37a038d3afd0b5763f2308b3db1b2d)
* [Update default `User-Agent` to comply with Section 5.5.3 of RFC 7231](https://github.com/sferik/twitter/commit/e5eb8d451d8be2d2751e6dda132c65039e5c879c)
5.12.0
------
* [Rescue `Twitter::Error::NotFound` for safe `#favorite` and `#retweet`](https://github.com/sferik/twitter/commit/5e6223df20217fd6b0ac78b44b0defdb46d1e018)
* [Make `Twitter::User#profile_background_image_uri` methods return a URI](https://github.com/sferik/twitter/commit/d96194c0c3b17076e48faed1b05cd48d043a6778)
* [Un-deprecate `Twitter::Base#to_hash`](https://github.com/sferik/twitter/commit/f45ce597408ab2bae2b55db6456543bf6d9ea081)
* [Add `Twitter::Tweet#possibly_sensitive?`](https://github.com/sferik/twitter/commit/917e8f14f7707eb646e8057827ed0ba9d1766eeb)
* [Namespace registered Faraday middleware](https://github.com/sferik/twitter/commit/a96931171e32c142f36318547f2cffa6ccd5c199) ([@godfoca](https://twitter.com/godfoca))
* [Fix test failures on Ruby 2.2.0-preview1](https://github.com/sferik/twitter/commit/74fb2e676f5882c62a6d4f07d7bbf8ca1f469fe2)
* [Make Twitter::NullObject Comparable](https://github.com/sferik/twitter/commit/9635db5128708525f3368800f11c519d6b14b1e4)
5.11.0
------
* [Return a Twitter::NullObject for empty attributes](https://github.com/sferik/twitter/commit/bca179eefb1c157f19b882a88ba608f6817b76bb)
* [Add `iso_language_code` attribute to `Twitter::Metadata`](https://github.com/sferik/twitter/commit/7bf3a1b6ad0c35dc608b03ba2b3321b594e4da1c)
5.10.0
------
* [Add support for extended entities](https://github.com/sferik/twitter/commit/ed7c708e4208de1df27d141678c14e23422504a0)
* [Add `Twitter::REST::Client#upload`](https://github.com/sferik/twitter/commit/f5a747b53c4866bb378d6022f309d6176620122e)
5.9.0
-----
* [Use expanded URIs when available](https://github.com/sferik/twitter/commit/f1d5d1f4c0ea75ebeaf9e7eb760b9efd245a5df2)
* [Deprecate `Twitter::REST::Client#middleware=` and `#connection_options`](https://github.com/sferik/twitter/commit/2ec17d8d43a87766dd4b89fcc6d5a2433530bf7c)
* [Ensure predicate methods return `false` for `Twitter::NullObject`](https://github.com/sferik/twitter/commit/f1b42bf82440f2dc0ba61761fc8f12460e20aadf)
* [Make `Twitter::Place#id` attribute accessible](https://github.com/sferik/twitter/commit/a4fa4739283a325886d44f97b2648e3b00f933b1)
* [Enable injection of custom TCP/SSL socket classes](https://github.com/sferik/twitter/commit/3629a1edfbc6b35099d4b0fc165b938a67c02d86) ([@neektza](https://twitter.com/neektza))
* [Deprecate predicate methods without question marks](https://github.com/sferik/twitter/commit/0305a8535357b6114be73e6b94744eed6b6d3bb5)
* [Deprecate `Twitter::Base#[]`](https://github.com/sferik/twitter/commit/2ab6c0d546b7c1d3635ac9c319fb5c2aa2514da0)
* [Remove statement that TweetStream is not 2.0.0-compatible](https://github.com/sferik/twitter/pull/553) ([@melaniegilman](https://twitter.com/melaniegilman))
* [Dont allow unacceptable IO objects in `Twitter::REST::Client#update_with_media`](https://github.com/sferik/twitter/commit/f22f1e2efd29200f157af041a470678cd4ef637a) ([@tim_linquist](https://twitter.com/tim_linquist))
* [Add support for new REST API endpoint for bulk lookup of Tweets by ID](https://github.com/sferik/twitter/commit/0d23c5ed65a7e7728cd096d611e5edeecdbc6e79)
* [Make the streaming API raise exceptions for status codes](https://github.com/sferik/twitter/commit/b571e03ed18cd63ec1d1a57c03e5744b284111d6) ([@eroberts](https://twitter.com/eroberts))
* [Call GET users/show if screen name has already been fetched](https://github.com/sferik/twitter/commit/0691a62ca5b43d33aa2f7b63aeb039d9155a24ed)
* [Add the ability to set user_agent and proxy](https://github.com/sferik/twitter/commit/e72185e1b0299221448650760b91c74ff1bec3e7)
* [Use (immutable) user ID instead of (mutable) screen name](https://github.com/sferik/twitter/commit/ceeccb08bbc7cc65c3e6eddaf408b236b8a98677)
* [Implement mute functionality](https://github.com/sferik/twitter/commit/dfe206cae5f2189ce2b5cd5db6307d5d5e8af4ef)
5.8.0
-----
* [Alias `Twitter::Tweet#reply?` to `Twitter::Tweet#in_reply_to_user_id?`](https://github.com/sferik/twitter/commit/57147287d25e21a5e740ee69c3e9aeec6abd1b06)
* [Add `Twitter::Error::SSL_REQUIRED` error code](https://github.com/sferik/twitter/commit/0cb7e6c132b73766bc978ccb45dd8d9cba43f660)
* [`Twitter::Tweet#retweeted_status` always returns the original tweet, not the retweet](https://github.com/sferik/twitter/commit/70fede7fa09a87b7e1cba5b8b4be82127c9eaf51) ([@IanChoiJugnoo](https://twitter.com/IanChoiJugnoo))
5.7.1
-----
* [Only warn if entities are not included](https://github.com/sferik/twitter/commit/82ed19e69c03ccaccc366744421b3bb3ee444625) ([@matthewrudy](https://twitter.com/matthewrudy))
* [Fix typos in documentation](https://github.com/sferik/twitter/pull/531) ([@attilaolah](https://twitter.com/attilaolah))
5.7.0
-----
* [Remove `Twitter::Base.from_response` method](https://github.com/sferik/twitter/commit/6f9a352adaa5eee0611fa8d2e45fc7349b5cecae)
* [Remove `Twitter::REST::API` namespace](https://github.com/sferik/twitter/commit/f9c4e8214bfe0e4cbd13681a6454956f2c6ac21b)
* [Remove `descendants_tracker`](https://github.com/sferik/twitter/commit/4cbcb0fc58c55b84b642bc7c66085bb581e9b20a)
* [Remove unused `HTTP_STATUS_CODE` constants](https://github.com/sferik/twitter/commit/b45d89bc96f11079b31976f14ade4f89d50b4dc9)
* [Remove `Twitter::Error#cause`](https://github.com/sferik/twitter/commit/a5748b925aa3220e7388311bd0228a62d45d09a4)
5.6.0
-----
* [Replace custom `Twitter::NullObject` with `Naught`](https://github.com/sferik/twitter/commit/bc3990e3588f889569f1c92e465c329c508ce32e)
* [Use `URI` and `CGI` to convert query string into a hash](https://github.com/sferik/twitter/commit/6dd9d97aaef3917868b870e01896ab937cbacfbb)
* [Increase default timeout values](https://github.com/sferik/twitter/commit/350536926d1c2c0656fdc79948c5f543e306e14e)
* [Add `Twitter::Error::RequestTimeout`](https://github.com/sferik/twitter/commit/3179537af41b2e2f85c0bc74be799faea0817e48)
* [Remove unused methods `#put` and `#delete` in `Twitter::REST::Client`](https://github.com/sferik/twitter/commit/eaaf234b84a6e2e1f7695f73befaf11f30664f4a)
* [Deprecate `retweeters_count` in favor of `retweet_count`](https://github.com/sferik/twitter/commit/ea39bd013364dc24f02e9a1eb25b4b48b99a5480)
* [Deprecate `favorites_count`/`favoriters_count` in favor of `favorite_count`](https://github.com/sferik/twitter/commit/ea39bd013364dc24f02e9a1eb25b4b48b99a5480)
* [Deprecate `to_hsh` in favor of `to_hash` or `attrs`](https://github.com/sferik/twitter/commit/63e2cdd693aece2912564988d06786cd23a2cad5)
* [Deprecate `oauth_token` and `oauth_token_secret` accessors](https://github.com/sferik/twitter/commit/ac246717557ea02565a1d93b3f9a975e7fd39874)
5.5.1
-----
* [Fix bug where `Twitter::Error::AlreadyFavorited` would never be raised](https://github.com/sferik/twitter/issues/512) ([@polestarw](https://twitter.com/polestarw))
* [Fix bug where `Twitter::Error::AlreadyPosted` would never be raised](https://github.com/sferik/twitter/commit/e6b37b930c056a88d8ee1477246635caf579111d)
* [Restore `Twitter::Entities#entities?` as a public method](https://github.com/sferik/twitter/commit/234a9e3134eeee072bd511e1c1f1823ceb1531a2)
5.5.0
-----
* [Add entities to `Twitter::DirectMessage`](https://github.com/sferik/twitter/commit/d911deb456cb2da6e14d0b3c69ba4d068ca85868)
* [Add conversion methods to `Twitter::NullObject`](https://github.com/sferik/twitter/commit/4900fee474feaa1514c06d459a9da6d52c45a60e)
5.4.1
-----
* [Default to maximum number of tweets per request](https://github.com/sferik/twitter/commit/1e41b5d4dde8678f5968b57dafe9da63b092646c)
5.4.0
-----
* [Fix enumerable search interface](https://github.com/sferik/twitter/commit/e14cc3391ebe8229184e9e83806c870df3baa24c)
5.3.1
-----
* [Add `Twitter::Utils` module](https://github.com/sferik/twitter/commit/a1f47fbf19b859c8e680a0a92eff5e225a015090) ([@charliesome](https://twitter.com/charliesome))
* [Remove `Enumerable` monkey patch](https://github.com/sferik/twitter/commit/818b28d1621e843c0c6f9ef471076f4125623e52) ([@charliesome](https://twitter.com/charliesome))
* [Don't spawning a new thread if there's only one element](https://github.com/sferik/twitter/commit/c01ea8309c16eb77eeb368452df1dadd1e405532)
* [Introduce meaningful constant names](https://github.com/sferik/twitter/commit/215c80890d702535de83d8f849885a95ec153920) ([@futuresanta](https://twitter.com/futuresanta))
* [Automatically flatten `Twitter::Arguments`](https://github.com/sferik/twitter/commit/a556028ace04cb00c3c2b9cb8f72f792a86f04d6)
5.3.0
-----
* [Add `UNABLE_TO_VERIFY_CREDENTIALS` error code](https://github.com/sferik/twitter/commit/6a47e715ef7935cd36a2f78ed877deb3c09af162)
* [Don't suppress `Twitter::Error::Forbidden` in #follow and #follow!](https://github.com/sferik/twitter/commit/b949c0400dabc6774419025e7b131d0a18447c3a)
* [Update memoizable dependency to ~> 0.3.1](https://github.com/sferik/twitter/pull/501)
5.2.0
-----
* [Replace `URI` with `adressable`](https://github.com/sferik/twitter/commit/7ea2f5390dc7456950f55c90aa4e48f29dcd4604)
* [Make `Twitter::Streaming::FriendList` an array](https://github.com/sferik/twitter/commit/1a38e5e8182823c3060fc59c270ef754bd49a179)
* [Add `Twitter::Streaming::DeletedTweet`](https://github.com/sferik/twitter/commit/084025b5e348bd33b4c29c6b9e40565c0e77319c)
* [Add `Twitter::Streaming::StallWarning`](https://github.com/sferik/twitter/commit/b07ac50552f5063ee43a490fa40da8b6889df772)
* [Add error code for "User is over daily status update limit"](https://github.com/sferik/twitter/commit/76c088d38e594703ee391f2a524142aa357b0972)
* [`Twitter::Streaming::Client#site` can take a `String` or `Twitter::User`](https://github.com/sferik/twitter/commit/e3ad4f2da1f8fc82e1d3febbc2602f626bced8a8)
* [Update `http_parser.rb` dependency to `~> 0.6.0`](https://github.com/sferik/twitter/commit/6d2f81bfc5bd469d558868a0f65356f30ca9f5e7)
5.1.1
-----
* [Custom equalizer for `Twitter::Place`](https://github.com/sferik/twitter/commit/79c76a9bed4f0170c8c09fe38ad4f0ee6aa4505e)
5.1.0
-----
* [Use `Addressable::URI` everywhere](https://github.com/sferik/twitter/commit/97d7c68900c9974a1f6841f6eed2706df9030d64) ([@matthewrudy](https://twitter.com/matthewrudy))
* [Allow use of `Twitter::Place` instead of `place_id`](https://github.com/sferik/twitter/commit/c2b31dd2385fefa30a9ddccf15415a713cf5953a)
* [Allow use of `Twitter::Tweet` instead of `in_reply_to_status_id`](https://github.com/sferik/twitter/commit/6b7d6c2b637a074c348a56a51fb1e02252482fb2)
5.0.1
-----
* [Fix `buftok` delimiter handling](https://github.com/sferik/twitter/pull/484)
* [Started handling streaming deletes](https://github.com/sferik/twitter/commit/8860b97bce4bc36086116f380a2771af3c199ea2)
5.0.0
-----
* [Remove `Twitter::API::Undocumented#status_activity` and `#statuses_activity`](https://github.com/sferik/twitter/commit/7f970810af251b2fe80c38b30c54485c55bd2034)
* [Remove `Twitter::Tweet#favoriters`, `#repliers`, `#repliers_count`, and `#retweeters`](https://github.com/sferik/twitter/commit/77cc963381a68e8299ef6c6b7a306b440666d792)
* [Remove identity map](https://github.com/sferik/twitter/commit/ec7c2df78a200e2b0b1cd3a40983c6ce9dee552d)
* [Remove `Twitter::Cursor#all`](https://github.com/sferik/twitter/commit/72be4148b973153c6d3044c406b768ad832555ff)
* [Remove `Twitter::Cursor#collection`](https://github.com/sferik/twitter/commit/9ae4621610ba6c26950e6b77f950f698cdfc8dac)
* [Remove `Twitter#from_user`](https://github.com/sferik/twitter/commit/d2ae9f1cc1f5224bcdff06cda65fabdf9e7fbcb3)
* [Remove `ClientError`, `ServerError`, and `ParserError`](https://github.com/sferik/twitter/commit/72843948d8a6f66345adc254fa91cf1097592b22)
* [Remove global configuration](https://github.com/sferik/twitter/commit/239c5a8462fabb8c8ef9ec6a4cdded34561d572d)
* [Remove ability to configure client with environment variables](https://github.com/sferik/twitter/commit/17e958579f65abf8932841f20058a5989abb994f)
* [Remove Brittish English aliases](https://github.com/sferik/twitter/commit/572813b373a1c3001ff6c1bb729f092434d17bab)
* [Replace `multi_json` with `json`](https://github.com/sferik/twitter/commit/e5fc292fee078567664acf6be4ed31a8ad077780)
* [Rename `oauth_token` to `access_token`](https://github.com/sferik/twitter/commit/d360f8015c487c4599460abd0dd0bc7e59a522a3)
* [Move `Twitter::Arguments` out of `REST::API` namespace](https://github.com/sferik/twitter/commit/8faa15309d906dd46fccc1b914ea4aa7a5da7c2d)
* [Move `Twitter::Client` into `REST` namespace](https://github.com/sferik/twitter/commit/5b8c3fd243227888fc0886b0bf864ecd3a018f99)
* [Add `Twitter::Streaming::Client`](https://github.com/sferik/twitter/commit/23afe90aa494229a4389c3e51f753102b34fc551)
* [Add `Twitter::Error::AlreadyPosted`](https://github.com/sferik/twitter/commit/e11d2a27dd0dfbbe16c812a81b9c2ab2852a7790)
* [Add `Twitter::REST::Client#reverse_token`](https://github.com/sferik/twitter/commit/39139c4df35b54b86fae29d1ac83a08f4aa293cd)
* [Add `#url` methods to `Twitter::List`, `Twitter::Tweet`, and `Twitter::User`](https://github.com/sferik/twitter/commit/a89ec0f4e81097cc303b6c204e0375eb57ffd614)
* [Add `Twitter::Place#contained_within` and `#contained_within?`](https://github.com/sferik/twitter/commit/23cc247bd20001ecbafa544bfb4546bdfc630429)
* [Add `Twitter::GeoResults`](https://github.com/sferik/twitter/commit/be1a0a1425a6700267aae0f94a8835bff24dad56)
* [Add `NullObject`](https://github.com/sferik/twitter/commit/17880f491726cee77c1cbcf914887e95d5e6ae7e)
* [Add predicate methods for any possible `NullObject`](https://github.com/sferik/twitter/commit/eac5522edededacfc2a22d6f6879da43b8136d41)
* [Always return `URI` instead of `String`](https://github.com/sferik/twitter/commit/341f68d1a46667a820754d30ffa6ec2f50034afc)
* [Allow `URI` as argument](https://github.com/sferik/twitter/commit/c207567e674f108e4074e12c9e7343fb74e8a97c)
* [Allow `String` in addition to `URI` objects](https://github.com/sferik/twitter/commit/89a46fbd3560109da87d5f87262dcf6bd2a336c6)
* [Collection caching](https://github.com/sferik/twitter/commit/d484d7d7d7a0956f9b4fa6791a911ed7c9522cba)
* [Implement `Twitter::Cursor#each` without making an extra HTTP request](https://github.com/sferik/twitter/commit/8eeff57f5c6d6ca0a6f1ff5ebc31e652a71fc150)
* [Make `Twitter::SearchResults` enumerable](https://github.com/sferik/twitter/commit/d5ce8537164912e79dffc5a054ecd9ae6ecb8075)
* [Make `Twitter::Base` objects immutable](https://github.com/sferik/twitter/commit/69b1ef7edad32398b778c8449bc3605739a6c59a)
* [Missing key now raises `KeyError`, not `ArgumentError`](https://github.com/sferik/twitter/commit/f56698caff608527b9f3c2c3dd4c18306589cb3b)
* [Use `equalizer` instead of manually overwriting #==](https://github.com/sferik/twitter/commit/a7ddf718b119e9c5fc8b87e6784e8c3304707a72)
* [Give methods more natural names](https://github.com/sferik/twitter/commit/e593194fb7bd689fca561e6334db1e6af622590a)
* [Fix `Twitter::SearchResults#rpp` return value](https://github.com/sferik/twitter/commit/28d73200490ac2755c3e68d8d273fbc64a8d7066)
4.8.1
-----
* [Ignore case of profile image extension](https://github.com/sferik/twitter/commit/73760610e959ae868de23de3da661d237fbcb106)
* [Allow use of Twitter::Token in place of bearer token string](https://github.com/sferik/twitter/commit/13596bc60db36ecaf5a1df09ecb322d85d8c2922)
* [Add Twitter::API::Undocumented#tweet_count](https://github.com/sferik/twitter/commit/795458a25ec7b143a995e7f2f2043e523c11961c)
* [Add missing dependencies](https://github.com/sferik/twitter/commit/e07e034472df8b7aa44c779371cf1e25d8caa77d) ([@tmatilai](https://twitter.com/tmatilai))
4.8.0
-----
* [Add `Twitter::SearchResults#refresh_url`](https://github.com/sferik/twitter/commit/6bf08c008de139aad3ec173461e8633bfa5a3bd8) ([@mustafaturan](https://twitter.com/mustafaturan))
* [Fix issue with wrong signature being generated when multipart data is posted](https://github.com/sferik/twitter/commit/65ab90a6d51755e5901434a3568f8163ca3e262f) ([@mustafaturan](https://twitter.com/mustafaturan))
* [Restore compatibility with Ruby 1.8.7](https://github.com/sferik/twitter/commit/fb63970c1bd19792955d092a38b6adf53b558ec7)
* [Remove undocumented methods, retired in the APIpocalypse](https://github.com/sferik/twitter/commit/cf6a91f8df833dce5bffc7a0292402860e7d4da7)
4.7.0
-----
* [Add support for application-only authentication](https://github.com/sferik/twitter/pull/387) ([@paracycle](https://twitter.com/paracycle))
* [Add support for `Twitter::Entity::Symbol` entities](https://github.com/sferik/twitter/commit/a14a0cdc57ad5d7760392f71a280c7100a5b5936) ([@anno](https://twitter.com/anno))
* [Add `Twitter::API::OAuth#invalidate_token`](https://github.com/sferik/twitter/pull/372) ([@terenceponce](https://twitter.com/terenceponce))
* [Add `Twitter::API::Lists#lists_owned` method](https://github.com/sferik/twitter/commit/9e97b51c20aabf4485a91ae7db697ee3be131a89)
* [Add `Twitter::API::Tweets#retweeters_ids` method](https://github.com/sferik/twitter/commit/8cf5b2ddf3d2647084496c7c3f205b2468d84cbe)
* [Add `Twitter::SearchResults#next_results`](https://github.com/sferik/twitter/pull/365) ([@KentonWhite](https://twitter.com/KentonWhite))
* [Make consumer_key readable](https://github.com/sferik/twitter/commit/a318869c4827d6add781730cfb67fd2bdca5c584)
* [Loosen required_rubygems_version for compatibility with Ubuntu 10.04](https://github.com/sferik/twitter/commit/41bd5655c2e7eca813807d742cb7fdec8f0bb027)
* [Remove default SSL configuration options and override](https://github.com/sferik/twitter/commit/113b14bc05a9f8e513245fda057e7f16f8965357)
4.6.2
-----
* [Fix `SystemStackError: stack level too deep` when converting to JSON](https://github.com/sferik/twitter/issues/368)
* [Add `Twitter::Tweet#favorite_count`](https://github.com/sferik/twitter/commit/de8a356d0d5e757bfe383b58744efa1c2d842b79)
* [Add `Twitter::SearchResults#next_results?`](https://github.com/sferik/twitter/commit/d951db4bdaa1ef72383f2026ec6236a289ee9074) ([@KentonWhite](https://twitter.com/KentonWhite))
4.6.1
-----
* [Convert nested classes in `Twitter::Base#attrs`](https://github.com/sferik/twitter/commit/e56c34c640189eb8b25a16994676a5e82b783cb3) ([@anno](https://twitter.com/anno))
4.6.0
-----
* [Make `Twitter::Base#attrs` call methods if they exist](https://github.com/sferik/twitter/commit/ff4f2daccd1acdfddcea7139d4dd6490b55129db)
* [Allow `Twitter::API::Tweets#oembed` and `Twitter::API::Tweets#oembeds` to take a URL](https://github.com/sferik/twitter/commit/0d986fa4b0c254e8c816bce086c3f6648d8fd3d7) ([@bshelton229](https://twitter.com/bshelton229))
* [Add `Twitter::Tweet#filter_level` and `Twitter::Tweet#lang` attribute readers](https://github.com/sferik/twitter/commit/283aafbe1219e55f19a76517d9edce497001fca2)
* [Add "Quick Start Guide" to the `README`](https://github.com/sferik/twitter/commit/afc24ee1bd07f19ef7fb8fd6b85aede34f3ab156) ([@coreyhaines](https://twitter.com/coreyhaines))
4.5.0
-----
* [Add no_retweet_ids](https://github.com/sferik/twitter/commit/cab8d6ebf3afdbd24463932262798a132d70a6f1) ([@tibbon](https://twitter.com/tibbon))
4.4.4
-----
* [Fix documentation bugs](https://github.com/sferik/twitter/commit/45213d16efda0bd78e8c4c3c80892b824393e37c)
* [Relax `multi_json` dependency](https://github.com/sferik/twitter/commit/46327e740a03ec783cb62863d40eef5efa68c0cb)
4.4.3
-----
* [Add `Twitter::API::Arguments` class; remove `extract_options!` helper method](https://github.com/sferik/twitter/commit/65972c599ced8da27fbbfa72aeead92464355583)
* [Ensure credentials set via `Twitter.configure` are of a valid type](https://github.com/sferik/twitter/commit/fc152dbe56b99639896bcaaf7fe158659e8c50b9)
* [Delegate `Twitter::Tweet#profile_image_url` and `Twitter::Tweet#profile_image_url_https` to `Twitter::Tweet#user`](https://github.com/sferik/twitter/commit/7bd6f8f589a91a8c82363d07da77ec012890c6cb)
* [Fix timeout bug; lock `faraday` dependency to version < 0.10](https://github.com/sferik/twitter/commit/01e2781e4a78137ca4e5e6d3e4faf2552ee9ec76)
4.4.2
-----
* [Fix to `Twitter::API::FriendsAndFollowers#friends` and `Twitter::API::FriendsAndFollowers#followers`](https://github.com/sferik/twitter/commit/d97438f5de89a1a15ad8ff5e67e8e0c7d412911f) ([@nbraem](https://twitter.com/nbraem))
* [Alias `Twitter::DirectMessage#text` to `Twitter::DirectMessage#full_text`](https://github.com/sferik/twitter/commit/dde92816beac5076507b3c0fb5b036222e2a4889)
* [Remove `Kernel#calling_method`](https://github.com/sferik/twitter/commit/045d6e17178520641509f884ed4ce4e4f2f765fb)
4.4.1
-----
* [Do not modify `Thread.abort_on_exception`](https://github.com/sferik/twitter/commit/6de998ced1f3dce97a24e500ecf2348192ae9316)
4.4.0
-----
* [Add `Twitter::API::FriendsAndFollowers#friends` and `Twitter::API::FriendsAndFollowers#followers`](https://github.com/sferik/twitter/commit/03e1512a8e5e589771414aaf46db34718f1469ce) ([@tibbon](https://twitter.com/tibbon))
* [Add `method` parameter to `Twitter::API::Users#users`](https://github.com/sferik/twitter/commit/4885c8df5f36fcbe39bd435ef12b6e0bed06dcb5) ([@thomasjklemm](https://twitter.com/thomasjklemm))
* [Correct endpoint of `Twitter::Client#report_spam` method](https://github.com/sferik/twitter/commit/e59c0c4c31a9f7eed3d202c276628a3ea0df6d28) ([@uasi](https://twitter.com/uasi))
* [Refactor `Twitter::Request` class](https://github.com/sferik/twitter/commit/2d70b64674bdc204c85c47327afa571f9641e545)
* [Remove `Array` core extensions](https://github.com/sferik/twitter/commit/2d00f99f4ac43e13e24bf90fcc813252175273f2)
* [Remove `String` core extensions](https://github.com/sferik/twitter/commit/5a9144c3f5104a7ee13b4c50f32cf71151004023)
* [Remove `Hash` core extensions](https://github.com/sferik/twitter/commit/0a8591efce268119e29623317382a1f2de2d0aa6)
* [Do not `require 'identity_map'` by default](https://github.com/sferik/twitter/commit/da38eec199222ae2292650313ce153e2b3986369)
* [Automatically define inquirer methods](https://github.com/sferik/twitter/commit/a6da19baf82656af118a4ec27e845b46c22a3d7e)
4.3.0
-----
* [Add Twitter::API#profile_banner](https://github.com/sferik/twitter/commit/5879ef3fcc486ac3849426ef0d44ee0288ed9599)
4.2.0
-----
* [Use new resource for `Twitter::API#retweets_of_me`](https://github.com/sferik/twitter/commit/d88ca1e91af06e748c31dcda287326028cf28258)
* [`Twitter::API#favorite` no longer raises `Twitter::Error::Forbidden`](https://github.com/sferik/twitter/commit/65c01133a96106a6b0c61bc16cb2ffec38fa5e25)
* [`Twitter::API#retweet` no longer raises `Twitter::Error::Forbidden`](https://github.com/sferik/twitter/commit/f1322ab12c573229ea3dc8decda2e2ea8b36fc31)
* [Add `Twitter::Error::AlreadyFavorited`](https://github.com/sferik/twitter/commit/34710927e00d4dc5abc049bfc198bdd337fba1bd)
* [Add `Twitter::Error::AlreadyRetweeted`](https://github.com/sferik/twitter/commit/2a231a0888dcd65dbef2dc92571e06d50f845cca)
4.1.2
-----
* [Add abort_on_exception to `Enumerable#threaded_map`](https://github.com/sferik/twitter/commit/15c9a7c221f24226c1003b76b287d2b2ed9306cb) ([@aheaven87](https://twitter.com/aheaven87))
4.1.1
-----
* [Fix bug in `Twitter::Tweet#full_text`](https://github.com/sferik/twitter/commit/9646a5bed6d2d119b1cc1d5757113988de2516d6)
* [Add `Twitter::Tweet#favouriters`, `Twitter::User#favoriters_count`, and `Twitter::User#favouriters_count` aliases](https://github.com/sferik/twitter/commit/60fce1ea0cdf8239262ca46588b4fe766f07288e)
4.1.0
-----
* [Handle new API v1.1 list response format](https://github.com/sferik/twitter/commit/2aace25fcf946de995e5ce1788f24ad35bc79438)
4.0.0
-----
* [Update all endpoints to Twitter API v1.1](https://github.com/sferik/twitter/commit/f55471a03dd0a428d5c0aa57a3c34809dbfde5cf)
* [Replace `per_page` parameter with `count`](https://github.com/sferik/twitter/commit/e112ce6f779ca2a204a86caf71a11125a65de961)
* [Use HTTP POST for `users/lookup`](https://github.com/sferik/twitter/commit/ff68ff81a8586d70fa021afaed6ff261d2a4b178)
* [Add error classes for new Twitter API v1.1 response codes](https://github.com/sferik/twitter/commit/154b00f8c0cbbcf9177d367f19a90ef256d5b6a4)
* [Cache `screen name` in an instance variable to avoid API calls](https://github.com/sferik/twitter/commit/dfc5641511bd99da857bf524af8449afb1843f8e)
* [Update `Twitter::RateLimit` class for API v1.1](https://github.com/sferik/twitter/commit/540cbb2d90f3b2c53f09a9727cbad1d2489e3fae)
* [Remove search endpoint](https://github.com/sferik/twitter/commit/37610fe6d54686238aedaee53914e70e67040d59)
* [Remove media endpoint](https://github.com/sferik/twitter/commit/e4a70152b1a6f00299d3b659497c02adb791c18f)
* [Disable identity map by default](https://github.com/sferik/twitter/commit/c6c5960bea998abdc3e82cbb8dd68766a2df52e1)
* [Remove deprecated `RateLimit.instance` method](https://github.com/sferik/twitter/commit/bf08485942428c26ba595c4e092dcdac1ec823ff)
* [Removed deprecated `Twitter::Tweet#oembed` method](https://github.com/sferik/twitter/commit/16f09cf7053f2109a740ea43461e89b504335c50)
* [Rename resources for v1.1](https://github.com/sferik/twitter/commit/03c4c143082fc1e7b2355d77d98da77f401fddd4)
* [Remove notification methods; use `Twitter::API#friendship_update` instead](https://github.com/sferik/twitter/commit/3b2d2b86599b4d054e7daa0d69b5e088cd776450)
* [Remove `Twitter::API#end_session`](https://github.com/sferik/twitter/commit/23668bc68209a032e9193ade1cdf6d8462980954)
* [Add `Twitter::Tweet#retweet?` method and `Twitter::Tweet#retweet` alias](https://github.com/sferik/twitter/commit/1e6ad051f488cae7bf18a45eea8008b448323fe4)
* [Major changes for Twitter API v1.1](https://github.com/sferik/twitter/commit/eab13be653c1b54aa679dbf16f252a2b6977b80e)
* [Remove `Twitter::API#no_retweet_ids`](https://github.com/sferik/twitter/commit/e179ab6d81c1c4931b67940463f414693671fb96)
* [Remove `Twitter::API#retweeted_to_user`](https://github.com/sferik/twitter/commit/e179ab6d81c1c4931b67940463f414693671fb96)
* [Remove `Twitter::API#trends_daily`](https://github.com/sferik/twitter/commit/e179ab6d81c1c4931b67940463f414693671fb96)
* [Remove `Twitter::API#trends_weekly`](https://github.com/sferik/twitter/commit/e179ab6d81c1c4931b67940463f414693671fb96)
* [Remove `Twitter::API#rate_limited?`](https://github.com/sferik/twitter/commit/b2ec0107bc1a2a73bd6b004348f1e6413822845c)
* [Remove `Twitter::Client#rate_limit`](https://github.com/sferik/twitter/commit/3a4be52a50ad20875b1cf48871f7754944593c95)
* [Remove `Twitter::API#rate_limit_status`](https://github.com/sferik/twitter/commit/ffebee6638875d5cc8363599fcfab2058bf1baf9)
* [Remove `Twitter::API#accept`](https://github.com/sferik/twitter/commit/e4bcec169faafb78772e60d6cdeb5583a40f32e3)
* [Remove `Twitter::API#deny`](https://github.com/sferik/twitter/commit/e4bcec169faafb78772e60d6cdeb5583a40f32e3)
* [Remove `Twitter::API#related_results`](https://github.com/sferik/twitter/commit/e4bcec169faafb78772e60d6cdeb5583a40f32e3)
* [Remove `Twitter::API#recommendations`](https://github.com/sferik/twitter/commit/e4bcec169faafb78772e60d6cdeb5583a40f32e3)
* [Remove `Twitter::API#network_timeline`](https://github.com/sferik/twitter/commit/93c65f25eafb3051a86140ab7e980d03431040f1)
3.8.0
-----
* [Do not attempt to parse redirects](https://github.com/sferik/twitter/commit/30ee1c733cfea091f60b18a51d01eab1d0cc6f30) ([@twoism](https://twitter.com/twoism))
* [Add profile banner methods to `Twitter::User` class](https://github.com/sferik/twitter/commit/d0200d72e71639ad3e7f7e2b7243889f2f39e8b3)
* [Add `Twitter::Error::UnprocessableEntity`](https://github.com/sferik/twitter/commit/fca4d174e8237655c82992edf67fcc846497fd54)
* [Add `Twitter::API#update_profile_banner` and `Twitter::API#remove_profile_banner`](https://github.com/sferik/twitter/commit/74b17f58549b06885ab49c56271cb571886e67f0)
* [Add `Twitter::Tweet#reply?`](https://github.com/sferik/twitter/commit/029d815815c99a7921a9b396c6c45b9f4cbd8fc3)
3.7.0
-----
* [Remove support for `IO` hash syntax](https://github.com/sferik/twitter/commit/bfe842d714a77b8edda90d0e2b547be434dc0148)
* [Allow `Tempfile` to be passed to `Twitter::API#update_with_media`](https://github.com/sferik/twitter/commit/79dc8197250f0416a9a44524be0aaea9d3f31d83)
* [Set `Content-Type` header to `multipart/form-data` when uploading a file](https://github.com/sferik/twitter/commit/24f759b7a128de2bceff27ee0e4699e8d927e5a5)
* [Do not attempt to parse bodies that only contain spaces](https://github.com/sferik/twitter/commit/2a191ea051b20a492a3325413dcdca11b593ba50)
* [Add `Twitter::Tweet#entities?` method](https://github.com/sferik/twitter/commit/43221b1d5fc1a3333a4718c79fd95f9ad42f143e)
* [Add `Twitter::User#status?` method](https://github.com/sferik/twitter/commit/255dc305ed886ac1e062b96001cb09484e5ad98d)
3.6.0
-----
* [Rename Twitter::Status to Twitter::Tweet](https://github.com/sferik/twitter/commit/6d25887ecd371b9deaf4b70bc2f2ee1e6bff98bc)
* [Make Twitter::Cursor an Enumerable](https://github.com/sferik/twitter/commit/2582f2ed3518a11bcad150778da18618dd9a0d37)
* [Always define respond_to_missing? when overriding method_missing](https://github.com/sferik/twitter/commit/23cfaf9dec4bc58fd9b3fd8366fb0e087c7f1e51)
3.5.0
-----
* [Add `Twitter::API#related_results`](https://github.com/sferik/twitter/commit/15fb81202dde3bbf4d64407cb79163095603cdbe)
* [Alias `Twitter::API#status_destroy` to `Twitter::API#tweet_destroy`](https://github.com/sferik/twitter/commit/ec16ed28538b2cf828183999df90da1942b7bcd6)
* [Alias `Twitter::API#status_activity` to `Twitter::API#tweet_activity`](https://github.com/sferik/twitter/commit/ccbdc6776a6780277e6ec813d3ed579f42440631)
* [Move `IdentityMapKeyError` under `Twitter::Error` namespace](https://github.com/sferik/twitter/commit/f1491d2fe1827140ea42b2618d0a25dc03110394)
3.4.1
-----
* [Prevent MultiJson::DecodeError error from bubbling up](https://github.com/sferik/twitter/commit/d870b7b8605e48bb0cd40e4b60684705ec06a846)
* [Add British aliases for "favorite" methods on `Twitter::Status`](https://github.com/sferik/twitter/commit/07b1f410a8865ea3736d53d637fb513b4731a3ec)
* [Correctly handle `nil` response body](https://github.com/sferik/twitter/commit/7fc785fa2ad43187fee2ba4808ffb3d09e8533dc)
3.4.0
-----
* [Refactor retweeted_to and retweeted_by into multiple methods](https://github.com/sferik/twitter/commit/7600cc3d529599cefc8d9c715e5f308ac4ca7319)
3.3.1
-----
* [Fix authentication bug](https://github.com/sferik/twitter/commit/b1fc6eac21293f2f87df9ca6684c30ef8155137f)
3.3.0
-----
* [Refactor `Twitter::RateLimit` class to be non-global](https://github.com/sferik/twitter/commit/6e9da0d0b8ae61e077eb631514922635a78951a7)
* [Combine `Twitter::RateLimit#retry_after` and `Twitter::RateLimit#reset_in` into a single method](https://github.com/sferik/twitter/commit/1702f05a60016013c198626339c57d53031cb17d)
* [Create proper interface for `Twitter::IdentityMap`](https://github.com/sferik/twitter/commit/8996c37a17484dd8ffe0d6a0ab278eb0b4e5e1ca)
* [Move `Twitter::Point` and `Twitter::Polygon` classes under `Twitter::Geo` namespace](https://github.com/sferik/twitter/commit/059cc5545195f99ba1b484e8359b7246f29be37e)
* [Move `Twitter::Photo` class under `Twitter::Media` namespace](https://github.com/sferik/twitter/commit/979ed718c6c31140a5698cbb6c7bd311b799f39e)
3.2.0
-----
* [Make identity map configurable](https://github.com/sferik/twitter/pull/288)
* [Decouple identity map from object instantiation](https://github.com/sferik/twitter/pull/286)
* [Make `IdentityMapKeyError` inherit from `IndexError`](https://github.com/sferik/twitter/commit/5503704c8601fa533299e22b49040cd073b85a6a)
* [Break up `Twitter::User` class into `Twitter::BasicUser`, `Twitter::SourceUser`, `Twitter::TargetUser`, and `Twitter::User`](https://github.com/sferik/twitter/commit/9d4f1e5dc4001adb124d07584f64322555e0e73c)
3.1.0
-----
* [Add size option to `Twitter::User#profile_image_url` and `Twitter::User#profile_image_url_https`](https://github.com/sferik/twitter/commit/bd4c63c327308572f2d4b7ae266216d50ee35beb)
* [Make object equality more strict](https://github.com/sferik/twitter/commit/537a5463d568e9a07ef5de5ce4dcad701b068ff3)
* [Pass options from Twitter::Client.user to Twitter::Client.verify_credentials](https://github.com/sferik/twitter/commit/8d99cfdbc7614690769c1682664cbe8cd9ea9c93)
3.0.0
-----
* [All returned hashes now use `Symbol` keys instead of `String` keys](https://github.com/sferik/twitter/commit/d5b5d8788dc0c0cef6f2c28e6fa2dc6ffcf389eb)
* [`Twitter::Client` methods now allow multiple arguments and return an `Array`](https://github.com/sferik/twitter/commit/78adf3833ebfcafda48d31dee7befdcfa76f2971)
* [`Twitter::Client#users` can now return more than 100 `Twitter::User` objects](https://github.com/sferik/twitter/commit/296a8847aa9bea0881369649a91e38fc2e9b3076)
* [`Twitter::Client#search` now returns a `Twitter::SearchResult` object instead of an array of `Twitter::Status` objects](https://github.com/sferik/twitter/pull/261/files) ([@wjlroe](https://twitter.com/wjlroe))
* [`Twitter::Client#follow` now checks to make sure a user is not already being followed before following](https://github.com/sferik/twitter/commit/24ffbca370f6957bc9a6c43cb6a1ee55cade7bb8)
* [Add `Twitter::Client#follow!` to follow a user without checking whether they are already being followed](https://github.com/sferik/twitter/commit/24ffbca370f6957bc9a6c43cb6a1ee55cade7bb8)
* [Add an identity map](https://github.com/sferik/twitter/commit/218479f71c861db79ccce8e12c4cb59d0a63cc77)
* [Attempt to pull credentials from the environment when not specified](https://github.com/sferik/twitter/commit/32e3fde7ccc7aea15b24159302d7c0fd934a6a0a)
* [Add default timeout options](https://github.com/sferik/twitter/commit/bb8a15d60e930233050e96964823b2f569e0943f)
* [Middleware is now specified as a `Faraday::Builder`](https://github.com/sferik/twitter/commit/2bd5010fc38b235ee9cc09b75e1ae89f23409f94)
* [Faraday errors are now captured and re-raised as a `Twitter::Error::ClientError`](https://github.com/sferik/twitter/commit/ccf3ddeb4cae937fdf3335546c17884472855149)
* [Replace `Twitter::Error.ratelimit` methods with the singleton `Twitter::RateLimit` class](https://github.com/sferik/twitter/commit/4c63a7378305df791b6fbcd3d3beb83ccd360f95)
* [Remove explicit proxy and user agent configuration](https://github.com/sferik/twitter/commit/f6e647f73eaa0f39b4306256789ded414ea9a8c2)
* [Remove untested gateway middleware](https://github.com/sferik/twitter/commit/7e501a99fe15ba9be69d2b791fc1d99c1904542b)
* [Remove deprecated `Twitter::Status#expanded_urls` method](https://github.com/sferik/twitter/commit/50d2613b1ade92c820f553d6e8389a49ec53dac1)
2.5.0
-----
* [Remove `Active Support` dependency](https://github.com/sferik/twitter/compare/v2.4.0...v2.5.0)
2.4.0
-----
* [`Twitter::User` objects can be used interchangeably with user IDs or screen names](https://github.com/sferik/twitter/commit/2dd5d32ca1a67a88d61d2f762e011295cab8a9bd)
* [`Twitter::List` objects can be used interchangeably with list IDs or slugs](https://github.com/sferik/twitter/commit/621e1ee428ea9fea024b26c8775baa47a7c235d9)
2.3.0
-----
* [Merge `Twitter::Client` modules into a monolithic `Twitter::Client` class](https://github.com/sferik/twitter/commit/396bb15fe8a273e01370e6a22efbf1e7f6a7805e)
* [Add `Twitter::Status#full_text`](https://github.com/sferik/twitter/commit/a03eb945df6a58f92cc832f5ffc1c8973c57339e)
* [Add `profile_image_url_https` accessor to `Twitter::Status`](https://github.com/sferik/twitter/commit/5991fa395fcd94bb88e88ed6c9bfae51896978b5) ([@terryjray](https://twitter.com/terryjray))
* [Make `Status#screen_name` return `from_user` attribute and vice versa](https://github.com/sferik/twitter/commit/82afc66a342c51258f80d1ba26959358be1a9c73)
* [Add `created_at` attribute to `Twitter::List`](https://github.com/sferik/twitter/commit/6d408ead1cfa83dd0539fe771495b5f5e594282e)
* [Add ability to pass a user to `Twitter::Client#recommendations`](https://github.com/sferik/twitter/commit/19f5796ba618e634ed56e936eb8f3bcb9822124c)
* [Alias `trends` to `local_trends`](https://github.com/sferik/twitter/commit/b4eb89c33a6b00f9fd685fd7dc95b79ee9e403bb) ([@Tricon](https://twitter.com/Tricon))
2.2.0
-----
* [Don't create a new Faraday instance on every request](https://github.com/sferik/twitter/pull/233/files)
* [Add `Twitter::Mention#source`](https://github.com/sferik/twitter/commit/6829994f4d8ca1e6d444fa75dc78c06bd01a5d74)
* [Add `Twitter::ListMemeberAdded`](https://github.com/sferik/twitter/commit/b40c79d59e8a4cfc71078127542c1f434c3ca517) ([@aamerabbas](https://twitter.com/aamerabbas))
* [Add `entities` attribute to `Twitter::Status`](https://github.com/sferik/twitter/pull/245/files) ([@tomykaira](https://twitter.com/tomykaira))
* [Add `Twitter::Client#list_remove_members`](https://github.com/sferik/twitter/commit/025c5281c9e695ad7fd21bcc34d4df4aaf0f3fb7)
2.1.0
-----
* [Add `in_reply_to_status_id` attribute to `Twitter::Status`](https://github.com/sferik/twitter/commit/9eeb74a5f724681dad1a35b3e052ea78142b532f)
* [Remove `twitter-text` dependency](https://github.com/sferik/twitter/commit/9645fde056353a4fe85a64632ed58f043cfe8871)
* [Add `Twitter::Status#retweeted_status`](https://github.com/sferik/twitter/commit/617ebccb890f612f0cd8883a524d199e838a58a0)
* [Add optional parameter hash to `Twitter::Client#oembed`](https://github.com/sferik/twitter/commit/ce9cf63f84c74d3c0f616524f6674b58e2a45377)
* [Fix `Twitter::Status` object returned by `Twitter::Client#retweet`](https://github.com/sferik/twitter/pull/228/files)
* [Add `from_user_name` and `to_user_name` attributes to `Twitter::Status`](https://github.com/sferik/twitter/commit/d60ac38e4a1623688a5ac8a29b6a4e79295fe9d1)
2.0.0
-----
* Replace `Hashie::Mash` with custom classes and Ruby primitaives
* Any instance method that returns a boolean can now be called with a trailing question mark
* [The `created_at` instance method now returns a `Time` instead of a `String`](https://github.com/sferik/twitter/commit/b92b0ca44af35fc9f72b81690a8aa72fa4bdfbce#diff-5)
* [Replace the `Twitter::Search` class with `Twitter::Client#search`](https://github.com/sferik/twitter/commit/591cbf1be86707584de0548365cc71c795683b2d)
* [Add object equivalence](https://github.com/sferik/twitter/commit/a52e0d2296db55fc0d1dcc184fb6eacba6183642)
* [`Twitter::Client#totals` has been removed. Use `Twitter::Client#user` instead]((https://github.com/sferik/twitter/commit/1ad0928a6232324072e8d960242a99949016cf50)
* [`Twitter.faraday_options` has been renamed to `Twitter.connection_options`](https://github.com/sferik/twitter/commit/221cb650ba126effb3447a3b9e0d58da2bdb507e)
* [All error classes have been moved inside the Twitter::Error namespace](https://github.com/sferik/twitter/commit/1245742f030415ebf5f1054e85fe93bca85cddfb)
* [Remove support for XML response format](https://github.com/sferik/twitter/commit/e60b9cac2b14d11dcc703c87b9a74328c173f35a)
* [Remove all deprecated methods](https://github.com/sferik/twitter/commit/5f59f1935d31df2756fd5bc43ae0f7e57879a5a4)
1.7.2
-----
* [Update multi_xml dependency to 0.4.0](https://github.com/sferik/twitter/commit/01105b7e7f211a140ce61bdbe5e3fc7d68c9b301) ([@masterkain](https://twitter.com/masterkain))
* [Add support for passing options directly to faraday](https://github.com/sferik/twitter/commit/4cc469761ea9e663abaf761e061a89e848ce9beb) ([@icambron](https://twitter.com/icambron))
* [Deprecate Trends#trends_current and remove the XML response format](https://github.com/sferik/twitter/commit/f9f0c1f1ddc5057cdb655f645970f771e1ebc702)
1.7.1
-----
* [Refactor connection and requests to accept options](https://github.com/sferik/twitter/commit/f7570de9f38f57e9fc6f15aa275f308a5ea69bc7) ([@laserlemon](https://twitter.com/laserlemon))
* [Include X-Phx header for internal APIs only](https://github.com/sferik/twitter/compare/f7570de9...34f29fe6) ([@laserlemon](https://twitter.com/laserlemon))
1.7.0
-----
* [Add `Account#totals` and `Account#settings`](https://github.com/sferik/twitter/commit/6496e318ec49f5b054f93a13ea91b4f1d4bb58c0) ([@gazoombo](https://twitter.com/gazoombo))
* [Add `Activity#about_me` and `Activity#by_friends`](https://github.com/sferik/twitter/commit/35e96108c450e76611137feed841f595d7214533)
* [Add `Help#configuration` and `Help#language`](https://github.com/sferik/twitter/commit/a0c88b43990a64b22b82e32301f2b91c094ab721) ([@anno](https://twitter.com/anno))
* [Add `Search#images_facets` and `Search#video_facets`](https://github.com/sferik/twitter/commit/1cc1f3cd75128f5e2c802fe95524a1afffc3962b)
* [Add `Search#search`](https://github.com/sferik/twitter/commit/327724b8edcefaf726d9d92c7e9d8f5380003097)
* [Add `Statuses#media_timeline`](https://github.com/sferik/twitter/commit/f1a78ea183663e9853b4b5dc128dee9ce79391a3)
* [Add `Tweets#update_with_media`](https://github.com/sferik/twitter/commit/cdf717b366a9ac73133a6f576391c4c3f46f9bb3) ([@JulienNakache](https://twitter.com/JulienNakache))
* [Add `Urls#resolve`](https://github.com/sferik/twitter/commit/b8d92b9f3b9669cc7267774b563bae543295350e)
* [Add `User#contributees`](https://github.com/sferik/twitter/commit/2b88f819775b9a90f4969fe03dc66ef1ecc2fb38) ([@GhettoCode](https://twitter.com/GhettoCode))
* [Add `User#contributor`](https://github.com/sferik/twitter/commit/1bb9f2000a322f9026681b78d1e8966409a333a2)
* [Add `User#recommendations`](https://github.com/sferik/twitter/commit/52d13cd4711931539686a483daa15666bae297a5)
* [Add `User#suggest_users`](https://github.com/sferik/twitter/commit/15dc1812f270be0f635f65091044d7cbb88cae4d)
* [Move API version out of endpoint and into path](https://github.com/sferik/twitter/commit/d156fd54a8591b44b22f72890099fce0ce4d58c8)
1.6.2
-----
* [Update hashie dependency to 1.1.0](https://github.com/sferik/twitter/commit/fb86f58203fb7c7dfec30068de663624416e955f)
1.6.1
-----
* [Update faraday dependency to 0.7.0](https://github.com/sferik/twitter/commit/59a50a8f08999fa7a90b0e332171079a137c6752) ([@ngauthier](https://twitter.com/ngauthier))
1.6.0
-----
* [Add a custom OAuth implementation](https://github.com/sferik/twitter/commit/5d2e7cc514b13842d7fe02fa7bc724136ef9f276) ([@NathanielBarnes](https://twitter.com/NathanielBarnes))
* [Unify naming of boolean methods](https://github.com/sferik/twitter/commit/b139e912ef70b55f7af7c03a27346f15ff472c7e)
* [Add convenience method to determine whether a user exists](https://github.com/sferik/twitter/commit/a7fc8616e5733e4c64f98f2ff5562e74e025a1f3)
* [Fully remove `Rash`](https://github.com/sferik/twitter/commit/3b39696902cc05a29bac35e7465ef352264b694d)
1.5.0
-----
* [Change interface to make `Twitter` module behave more like a class](https://github.com/sferik/twitter/commit/df5247de490f7448c35c8f84112a9e7c14ce4057)
1.4.1
-----
* [Update multi_json dependency to version 1.0.0](https://github.com/sferik/twitter/commit/9ab51bc5536e5eebea10283d771cfe57e2fccbc7)
1.4.0
-----
* [Update list methods to use new resources](https://github.com/sferik/twitter/compare/v1.3.0...v1.4.0) ([@erebor](https://twitter.com/erebor))
* [Fix copy/paste bug in `Error#ratelimit_remaining`](https://github.com/sferik/twitter/commit/b74861e75f0cdf7eaafc37162e2f040ae27db002)
1.3.0
-----
* [Update faraday dependency to version 0.6](https://github.com/sferik/twitter/commit/2b29c2109d2ca95a699ebe3822b98091a96256d8)
* [Include response headers when raising an error](https://github.com/sferik/twitter/commit/6db6fe2c2504f566333c6742979436580f5264d4)
* [Fix typo in README for accessing friends and followers](https://github.com/sferik/twitter/commit/2043ab4a6b723cac2a8ed77e26a4b0e3f4f55b03) ([@surfacedamage](https://twitter.com/surfacedamage))
1.2.0
-----
* [Respect global load path](https://github.com/sferik/twitter/commit/6a629a6a06e115388cce6f1de04f45a4b0707cac)
* [Use map and `Hash[]` instead of `inject({})`](https://github.com/sferik/twitter/commit/a2b0b51618f40b526f554c019a6c83b0bf9a8cdf) ([@wtnelson](https://twitter.com/wtnelson))
* [Check headers for `Retry-After` in absence of `retry-after`](https://github.com/sferik/twitter/commit/924253214efcedfeb80b4c6fe57dcbb2a7470177) ([@wtnelson](https://twitter.com/wtnelson))
* [Fix name of `#list_add_members` resource](https://github.com/sferik/twitter/commit/3adcc1592240be2679f0a2c7d0c390b574abe8f1)
* [Don't strip @ signs from screen names](https://github.com/sferik/twitter/commit/38c9dd0a720ea857ff6220b28f66db4c780a7fda)
* [Make `#places_similar` method return a token](https://github.com/sferik/twitter/commit/351e2240717a34d6575a802078077a1681fa4616) ([@nicolassanta](https://twitter.com/nicolassanta))
1.1.2
-----
* [Opt-in for testing with rubygems-test](https://github.com/sferik/twitter/commit/7d92afc138cac1b751b17682fd166b2603f804c6)
* [Add support for `Twitter.respond_to?`](https://github.com/sferik/twitter/commit/ce64c7818f9b62cf91f1fa5dc2e76a9d4205cd2e) ([@fernandezpablo](https://twitter.com/fernandezpablo))
1.1.1
-----
* [Don't set cached `screen_name` when creating a new API client](https://github.com/sferik/twitter/commit/ceeed993b16f95582c648e93de03738362ba1d7b)
1.1.0
-----
* [Overload all methods that require a `screen_name` parameter](https://github.com/sferik/twitter/compare/ecd647e414ac0b0cae96...59cf052ca646a2b79446) ([@gabriel_somoza](https://twitter.com/gabriel_somoza))
* [Rename `user_screen_name` to `screen_name`](https://github.com/sferik/twitter/commit/4fb4f8a28c967f7d5a2cf295b34548a346900cfd) ([@jalada](https://twitter.com/jalada))
* [Handle error returns from lookup](https://github.com/sferik/twitter/commit/0553cdbe262f006fae149309ce51a03985ed8fd2) ([@leshill](https://twitter.com/leshill))
* [Use 'tude' parameter for attitudes](https://github.com/sferik/twitter/commit/8db1bf9dadec3a660a281c94cab2fc335891ce30) ([@ALindeman](https://twitter.com/ALindeman))
* [Add Enumerable mixin to Twitter::Search](https://github.com/sferik/twitter/commit/c175c15d320d10db542ebb4cc13c5f5d583c89c4) ([@ALindeman](https://twitter.com/ALindeman))
1.0.0
-----
* [Fix conditional inclusion of jruby-openssl in Ruby 1.9](https://github.com/sferik/twitter/commit/e8e9b1d7232bf69ac5e217e2e18dc9c8e75f2fc4)
* [Allow users to pass in screen names with leading '@'](https://github.com/sferik/twitter/commit/fc3af84e0d7358ddacf49acefe7d950ac11983e0)
* [UTF-8 encode `Utils` module](https://github.com/sferik/twitter/commit/4a62f181c2ae7b931e17fcfa6532b3a3f0ed0c8e)
* [Copy-edit documentation](https://github.com/sferik/twitter/commit/7873b0306d5fb1f27e4061cd024ab43589441fa4) ([@dianakimball](https://twitter.com/dianakimball))
* [Add methods to `Search` class](https://github.com/sferik/twitter/commit/1871913342a5621edfebb9a7c8be705608e082d5)
* [Changes to `Search` class](https://github.com/sferik/twitter/commit/e769fabc0232cbbcb9d0fa5a07277fb9f50b17c8)
* [Add proxy support](https://github.com/sferik/twitter/commit/1df33b7495093bc1f136d61b8aac9c9038414bc5)
* [Make `#suggestions` method consistent with Twitter API documentation](https://github.com/sferik/twitter/commit/8393a06a9e8ca03be9adffdbfd042c176e2f6597)
* [Rename default user agent](https://github.com/sferik/twitter/commit/2929e533f441bea2313882c4e0ed5593fe999491)
* [Make all global settings overrideable at the class level](https://github.com/sferik/twitter/commit/66f3ac223d6f0822c8b3acd4cdcd8c84c8dacfe0)
* [Expose a property in EnhanceYourCalm for HTTP header "Retry-After"](https://github.com/sferik/twitter/commit/7ab91f9d26351f52d3c803bb191d33bdacff5094) ([@duylam](https://twitter.com/duylam))
* [Merge `Base`, `Geo`, `Trends`, and `Unauthenticated` into `Client` class](https://github.com/sferik/twitter/commit/eb53872249634ee1f0179982b091a1a0fd9c0973) ([@laserlemon](https://twitter.com/laserlemon))
* [Move examples into README](https://github.com/sferik/twitter/commit/96600cb5611965788c41b3788668188d37e16803)
* [Rename `Twitter.scheme` to `Twitter.protocol`](https://github.com/sferik/twitter/commit/512fcdfc22b796d39dd07c2dcc712aa48131d7c6)
* [Map access key/secret names to SimpleOAuth correctly](https://github.com/sferik/twitter/commit/9fa5be3a9e0b7f7dcb4046314d8c6bc41f4f063d)
* [Improved error handling by separating HTTP 4xx errors from HTTP 5xx errors, so HTTP 4xx errors can be parsed first](https://github.com/sferik/twitter/commit/f26e7875980a7b2b16285c31198601b92ac5cbb6)
* [Add tests for XML response format](https://github.com/sferik/twitter/commit/54c4b36b8f9a5a0ad7c741e53409a03a7ddaade7)
* [Switch from httparty to faraday HTTP client library](https://github.com/sferik/twitter/commit/80aff88dae11d64673fe4e025cc8f065a6796345)
* [Switch from oauth to simple_oauth for authentication](https://github.com/sferik/twitter/commit/76cfe3749e56b2b486f2b5ffc9aa7f437cb2db29) ([@laserlemon](https://twitter.com/laserlemon))
* [Handle errors in faraday middleware](https://github.com/sferik/twitter/commit/466a0d9942d1c0c0c35c6302951087076ddf4b82#diff-2)
* [Add #NewTwitter methods and tests](https://github.com/sferik/twitter/commit/0bfbf6352de9bdda2b93ed053a358c0cb8e78e8f)
* [Fix tests that assume position in a `Hash`](https://github.com/sferik/twitter/commit/c9f7ed1d9106807aa6fb27d48a92f4b92d0594a7) ([@duncan](https://twitter.com/duncan))
* [Enable SSL by default (add option to disable SSL)](https://github.com/sferik/twitter/commit/c4f8907d6595f93d63bc84d6575920a14774e656)
* [Use HTTP DELETE method instead of HTTP POST for all destructive methods](https://github.com/sferik/twitter/commit/0bfbf6352de9bdda2b93ed053a358c0cb8e78e8f)
* [Change the method signature for `Base#users` and `Base#friendships` to accept an `Array` and an options `Hash`](https://github.com/sferik/twitter/commit/0bfbf6352de9bdda2b93ed053a358c0cb8e78e8f)
* [Add `Twitter.profile_image` method](https://github.com/sferik/twitter/commit/e6645022aefdc11860fe88b45725a08bb24adf55) ([@ratherchad](https://twitter.com/ratherchad))
* [Improve website style](https://github.com/sferik/twitter/commit/4cdf4e76b6d71d5d4760b46d1a894c00929c0ba3) ([@rodrigo3n](https://twitter.com/rodrigo3n))
* [Make request format configurable](https://github.com/sferik/twitter/commit/d35d6447b25fa84447ae97558958431fa9f6aa29)
0.9.12
------
* [Rename parameters to be less confusing](https://github.com/rorra/twitter/commit/cd7ea8de6663d6ed5ea22b590d39adc72646fc1e) ([@rorra](https://twitter.com/rorra))
* [Update `user` method to match the Twitter API docs](https://github.com/sferik/twitter/commit/cb31e4a26b20d93006d568fab50ccce5c4d1626f) ([@nerdEd](https://twitter.com/nerdEd))
* [Add aliases for search methods](https://github.com/sferik/twitter/commit/05dd3e5a058ef69f874cfe33ae35b01f574e549b)
* [Add `Twitter.user_agent` and `Twitter.user_agent=` methods](https://github.com/sferik/twitter/commit/0fc68f1c52e3b754194fe8a9cfbd9d4499eacbe1)
* [Add `Search#locale` method](https://github.com/sferik/twitter/commit/584bcf9eb896530a87e4122fb1a020c35744f0cf)
0.9.11
------
* [Add a `Search#filter` method](https://github.com/sferik/twitter/commit/0b37998055158d4fed0e3c296d8d2a42ac77d5d9) ([@pjdavis](https://twitter.com/pjdavis))
* [Add test to ensure `Search#fetch` doesn't overwrite `@query(:q)`](https://github.com/sferik/twitter/commit/2e05847cf70692b760c45dd54b6bad820176c9bd) ([@pjdavis](https://twitter.com/pjdavis))
* [Add `Search#retweeted` and `Search#not_retweeted` methods](https://github.com/sferik/twitter/commit/9ef83acdcbe682a8b5a325f89d566f7ef97fffc2) ([@levycarneiro](https://twitter.com/levycarneiro))
* [Switch from YAJL to MultiJson](https://github.com/sferik/twitter/commit/60a7cb179e77319e03c595850119b63fb413a53d) ([@MichaelRykov](https://twitter.com/MichaelRykov))
0.9.10
------
* [Specify Twitter API version for all REST API calls](https://github.com/sferik/twitter/commit/76b1fa31588bbc20166464313027f75e3771e385)
* [Parse all responses with YAJL JSON parser](https://github.com/sferik/twitter/commit/c477f368fde6161dbae59ea7bc7c7d182b15721b)
* [Ensure that users are tested](https://github.com/sferik/twitter/commit/108019e83d745c23ebc92fc8a3f9f8c605b2e884) ([@duncan](https://twitter.com/duncan))
* [Remove redgreen due to Ruby 1.9 incompatibility](https://github.com/sferik/twitter/commit/83e1ea168da2e38c3f393972bf1d8eb665df2510) ([@duncan](https://twitter.com/duncan))
* [Make all tests pass in Ruby 1.9](https://github.com/sferik/twitter/commit/7bead60774fb118ef63fb1557976194848af6754) ([@duncan](https://twitter.com/duncan))
0.9.9
-----
* [Bump dependency versions](https://github.com/sferik/twitter/commit/ac8114c1f6ba2da20c2267d3133252c2ffc6b6a3)
* [Remove Basic Auth](https://github.com/sferik/twitter/pull/56) ([@rodrigo3n](https://twitter.com/rodrigo3n))
* [Flatten `ids_or_usernames` before iterating](https://github.com/sferik/twitter/commit/956fb23f82cc1f91f6beefb24cf052cf48475a3f) ([@jacqui](https://twitter.com/jacqui))
* [Add an example to list followers and friends sorted by followers count](https://github.com/sferik/twitter/commit/fb57b27e8a48abcc82810fe476413e8b506cebe6) ([@danicuki](https://twitter.com/danicuki))
* [Add optional query parameter to `list_subscribers`](https://github.com/sferik/twitter/commit/a608d4088edf8772a3549326bed1124c9a2a123d)
* [Change trends endpoint to api.twitter.com/1/trends](https://github.com/sferik/twitter/commit/39ff888b243ba57098589d4e304dd6dec877d05f)
* [Use Bundler](https://github.com/sferik/twitter/commit/ebcb1d2c76d45f691cc90c880d13d19bc69a6f32)
0.9.8
-----
* [Geo API](https://github.com/sferik/twitter/commit/0e5aa205f9e29db434d84452f59694d9b64877d2) ([@anno](https://twitter.com/anno))
* [Set `api_endpoint` for unauthenticated calls](https://github.com/sferik/twitter/commit/ff20ecb4f4fef12c58572fb31e5c06162f8659d7) ([@earth2marsh](https://twitter.com/earth2marsh))
0.9.7
-----
* [Add `api_endpoint` option for Search](https://github.com/sferik/twitter/commit/3c3d73fb8eedb5d322aeb1e4431d9936226fef9b)
0.9.6
-----
* [Deprecated Basic Auth](https://github.com/sferik/twitter/commit/878c09527037ab8ec5ac11a48afece61f03861e1)
* [Add `api_endpoint` option for OAuth](https://github.com/sferik/twitter/commit/be937cf93db35f60cd47288aeea45afd2ab42288)
0.9.5
-----
* [Saved searches](https://github.com/sferik/twitter/commit/d5f0b5846b24468f323cc4f96e583fd267240615) ([@zmoazeni](https://twitter.com/zmoazeni))
* [Handle null result sets in search more gracefully](https://github.com/sferik/twitter/commit/f6d1f995dc7757dda4f4ac71dda2487d56d51c85) ([@sferik](https://twitter.com/sferik))
* [Add `report_spam`](https://github.com/sferik/twitter/commit/91275b549ebdd1cad795dff9f7a1772a4ca37749) ([@chrisrbailey](https://twitter.com/chrisrbailey))
* [Tests for `friendship_exists?` method](https://github.com/sferik/twitter/commit/e778d7f5f2bed73428c854d5d788d4a2d58540cd) ([@sferik](https://twitter.com/sferik))
* [Replace JSON parser with YAJL JSON parser](https://github.com/sferik/twitter/commit/1f480a85925025aec1ac5c91cfb45b4e74e4c9c3) ([@sferik](https://twitter.com/sferik))
* [Cursors for lists](https://github.com/sferik/twitter/commit/d283cefdbcaeee6005b0ec747e8d6bded14911b2) ([@zmoazeni](https://twitter.com/zmoazeni))
0.9.4
-----
* [Rolled back search API endpoint to get around rate limiting issues](https://github.com/sferik/twitter/commit/f9c7af99b4560f39b3542582934ae07955b6c9cc) ([@secobarbital](https://twitter.com/secobarbital))
0.9.3
-----
* [Restore Ruby 1.8.6 compatibility](https://github.com/sferik/twitter/commit/b725b1b8a105fa3488783cef43b7db8b0dbb7c99) ([@raykrueger](https://twitter.com/raykrueger))
0.9.2
-----
* [Make error handling consistent between authenticated and unauthenticated method calls](https://github.com/sferik/twitter/commit/f62a1502ba9c4a764d25a4179982fabd3bff2210) ([@sferik](https://twitter.com/sferik))
* [Test error handling for unauthenticated methods](https://github.com/sferik/twitter/commit/4de5c9212142ceb0206f979755e6e151280b16b9) ([@sferik](https://twitter.com/sferik))
0.9.1
-----
* [Add cursor to `lists` method](https://github.com/sferik/twitter/commit/a16ad354be4fae3d3f86207d8c5ae8b4c2a11b52) ([@sferik](https://twitter.com/sferik))
* [Add Twitter API version to trends method calls](https://github.com/sferik/twitter/commit/6f23c5eb3ffdac6eac65fa2b6d36f08aa7b6e1fb) ([@sferik](https://twitter.com/sferik))
* [Add Twitter API version to unauthenticated method calls](https://github.com/sferik/twitter/commit/fb895cc7e645499826dcc96e2cf8727c94eac83f) ([@sferik](https://twitter.com/sferik))
* [Remove rubygems dependencies](https://github.com/sferik/twitter/commit/0f7a9ee4a1aee45bfb7136a0f6f48f9b7632e663) ([@sferik](https://twitter.com/sferik))
0.9.0
-----
* [Add `Base#retweeters_of` method](https://github.com/sferik/twitter/commit/7de2d6204028b6741ce7a72b12efe868e074331c)
* [Add `result_type` to search for popular/recent results](https://github.com/sferik/twitter/commit/c32fa818f8331a7ff02f04f6cba8739423902029)
* [Add `users` method for bulk user lookup](https://github.com/sferik/twitter/commit/5723b60f042d98b630040fa076ac86e9b735dee8) ([@sferik](https://twitter.com/sferik))
* [Add Twitter API version to authenticated method calls](https://github.com/sferik/twitter/commit/69d4df515fe95f727221dad19b92665dc24f06d0) ([@sferik](https://twitter.com/sferik))
* [Search exclusions](https://github.com/sferik/twitter/commit/cb05e77adb2d771170d731ad2e55ba17bcb13766) ([@abozanich](https://twitter.com/abozanich))
0.8.6
-----
* [Bump httparty version](https://github.com/sferik/twitter/commit/643517da3d12442883d90918b280e968809a4750) ([@dewski](https://twitter.com/dewski))
0.8.5
-----
* [Add `Search#next_page?` and `Search#fetch_next_page` methods](https://github.com/sferik/twitter/commit/767ddaa62e8fa9e3872ddd17323f323d9f1393e4) ([@cyu](https://twitter.com/cyu))
0.8.4
-----
* [Add `query` parameter to `membership` method](https://github.com/sferik/twitter/commit/f09b3121d4c721c34f40a11580a7a1d4ffc0df22) ([@mingyeow](https://twitter.com/mingyeow))
* [Add `Search#phrase` method](https://github.com/sferik/twitter/commit/e3e8f7e4b1ea8a315f935805e409a3fff6a5483d) ([@zagari](https://twitter.com/zagari))
* [Add `Trends#available` and `Trends#location` methods](https://github.com/sferik/twitter/commit/39b8d8dd3bb25cb5cd081cae23486fb47c25ec8f)
0.8.3
-----
* [Add `Twitter.list_timeline` method](https://github.com/sferik/twitter/commit/aed3a298b613a508bb9caf93afc7f12c50626ad7) ([@spastorino](https://twitter.com/spastorino))
0.8.2
-----
* [Add `Base#update_profile_image` method](https://github.com/sferik/twitter/commit/10afe76daef3a2b8e10917b9550724cc9c3a6c19) ([@urajat](https://twitter.com/urajat))
0.8.1
-----
* [Add `Twitter.timeline` method](https://github.com/sferik/twitter/commit/dc26a0c9b5a6a98aec4ca9c0a48333e665c9bf18)
0.8.0
-----
* [Make API endpoint configurable to use services like Tumblr](https://github.com/sferik/twitter/commit/c5550f1317538638b754d6b0dbbb372e069b5580)
0.7.11
------
* [Add list timeline paging](https://github.com/sferik/twitter/commit/591d31a45b1a360d5743d2bf3966e7e9b563b9b7) ([@kchen1](https://twitter.com/kchen1))
0.7.10
------
* [Add `Base#blocks` and `Base#blocking` methods](https://github.com/sferik/twitter/commit/0eb099001f060431c56c1884d86abb2e53a09c6d)
0.7.9
-----
* [Add `Base#retweets` method](https://github.com/sferik/twitter/commit/a1a834575000bbb8fb430632b6bf88e19daeb8fb) ([@ivey](https://twitter.com/ivey))
0.7.8
-----
* [Use `cursor` parameter to `list_members` method](https://github.com/sferik/twitter/commit/9f393f05c127623f4c58a68e2246a3553f225349) ([@ivey](https://twitter.com/ivey))
0.7.7
-----
* [Fix bug in `list_remove_member` when using OAuth](https://github.com/sferik/twitter/commit/b20b770af3d6594f8e551cade3cfbd58a0647c2d)
* [Bump oauth dependency to version 0.3.6](https://github.com/sferik/twitter/commit/3eeed693180d15ba4ca2370c41bd5547f715fc88)
* [Add `Base#update_profile_background` method](https://github.com/sferik/twitter/commit/3eeed693180d15ba4ca2370c41bd5547f715fc88) ([@kev_in](https://twitter.com/kev_in))
* [Add `Base#blocked_ids` method](https://github.com/sferik/twitter/commit/2a5046500eb30141f55552d9b151857d08a1436a) ([@rizwanreza](https://twitter.com/rizwanreza))
* [Add `Search#since_date` and `Search#until_date` methods](https://github.com/sferik/twitter/commit/9dcd340817224fa34fcb515f79a846886ffa1427) ([@jschairb](https://twitter.com/jschairb))
0.7.6
-----
* [Add `Base#home_timeline` method](https://github.com/sferik/twitter/commit/2de3786e75e6a1725572d3f08f6886f64e507851) ([@coderifous](https://twitter.com/coderifous))
0.7.5
-----
* [Use Hashie instead of Mash to avoid conflicts with extlib](https://github.com/sferik/twitter/commit/365f8378b45c93ed6219ac49afec5c7f7eb85fe6) ([@hassox](https://twitter.com/hassox))
0.7.4
-----
* [Support for user search](https://github.com/sferik/twitter/commit/54e046924431a08e3dfce06f571f71ebb76f7bbd)
0.7.3
-----
* [Add `Base#list_subscriptions` method](https://github.com/sferik/twitter/commit/2273c8a4e7c5d496922fc34551b46b22d30b68aa) ([@christospappas](https://twitter.com/christospappas))
0.7.2
-----
* [Add `Base#friendship_show` method](https://github.com/sferik/twitter/commit/693f95a6a19dd51c047078ef969e14357930bcd7) ([@dcrec1](https://twitter.com/dcrec1))
0.7.1
-----
* [Bump dependency versions](https://github.com/sferik/twitter/commit/d6bf8c5693f0ec4eedd641b97a7e6f0fdce75e2c)
0.7.0
-----
* [Add support for lists](https://github.com/sferik/twitter/commit/be4bffd79c2bdcfd2988ef6a65cbca8a8f6abd6d)
0.6.14
------
* [Lower oauth dependency to version 0.3.4 as people are complaining about 0.3.5](https://github.com/sferik/twitter/commit/dd144c377bc888388099e029a0e1505a66392bb1)
0.6.13
------
* [Bump oauth dependency to version >= 0.3.5](https://github.com/sferik/twitter/commit/555ae1fc13146b74b8df0346caea1a6b065b344f)
0.6.12
------
* [Fix `fakeweb` test issue](https://github.com/sferik/twitter/commit/cdd9dba19f6edc21f1b7eefb66db133dec682423) ([@obie](https://twitter.com/obie))
* [Add `Search#user_agent` method](https://github.com/sferik/twitter/commit/e8fbad6a9cfdcfaad4938f7243fc971a1ea8ac8c)
0.6.11
------
* [Add the ability to sign in with Twitter instead of authorizing](https://github.com/sferik/twitter/commit/68b6252a21e7e773d108027f693b8378593e21ad)
0.6.10
------
* [Add `Trends#current`](https://github.com/sferik/twitter/commit/549f34903be38232c24044d9972629a86a0503a4), [`Trends#daily`, and `Trends#weekly` methods](https://github.com/sferik/twitter/commit/dc8046aea5794303f6f36622221a412a4e80f9a8)
0.6.9
-----
* [Bump oauth dependency to version 0.3.4](https://github.com/sferik/twitter/commit/88d4612b50d2be7cc300120278d53c80265e8780)
0.6.8
-----
* [Fix httparty dependency](https://github.com/sferik/twitter/commit/44aa418a22233c84cea1dae74b158cd490589b10)
0.6.7
-----
* [Bump httparty dependency to version 0.4.3 which allows `response.message` and fixes errors that the lack of `response.message` was causing](https://github.com/sferik/twitter/commit/a630b1c77792641794745d2f3cbba6c64d168d62)
0.6.6
-----
* [Add `query` parameter to `user` method](https://github.com/sferik/twitter/commit/33ae7dbd7593235efb8ea1df13638891b621244f)
* [Add `ssl` optional parameter to use HTTPS instead of HTTP for `HTTPAuth`](https://github.com/sferik/twitter/commit/f46cdf9ce957b03539bd4dc76a83ce439535d349)
* [Add `Twitter.status`, `Twitter.friend_ids`, and `Twitter.follower_ids` methods](https://github.com/sferik/twitter/commit/55813617c5b4cf672800bf7f9e7473904e3c3194)
0.6.5
-----
* [Fix `friend_ids` and `follower_ids` bombing on mashing](https://github.com/sferik/twitter/commit/f01c2878033cd6afc1e718f2140c82b9708e5603)
0.6.4
-----
* [More explicit about dependency versions in gemspec and when requiring](https://github.com/sferik/twitter/commit/5ce3eeb25c5b8bcd8caa8704c5d125174781781d)
0.6.3
-----
* [Add `Twitter.user` method](https://github.com/sferik/twitter/commit/cb46975eaa8aa7e02ad798ba8b7b62017f15604c)
0.6.2
-----
* [Add `Search#max` method](https://github.com/sferik/twitter/commit/e79cc1fdb306da24462c6617b118e03ccbead9f1)
0.6.1
-----
* [Rename one of the two `friend_ids` methods to `follower_ids`](https://github.com/sferik/twitter/commit/051d19db49dce2422d06181c5a3b595e3a9b85b3)
0.6.0
-----
* [Add HTTP authentication](https://github.com/sferik/twitter/commit/d713ecfbe80edde688009fa6bfbf32a2de687a39)
0.5.3
-----
* [Only send `follow` parameter to Twitter if `follow` is true for calls to `friendship_create`](https://github.com/sferik/twitter/commit/5ebf39c0538a3dfd48c6a1dbdf8558305737ce69)
0.5.2
-----
* [Add mash as an install dependency](https://github.com/sferik/twitter/commit/a8693b27791e966736415cb90335600d075f60dd)
* [Add options to `search`](https://github.com/sferik/twitter/commit/096d56ed9a62a0ea53bfe3a8df588ddef71df1c9)
* [Add missing variables in exception raising](https://github.com/sferik/twitter/commit/e21a4f69c68d28148045e7c98ce1841d72994e1e)
* [Add development dependencies to `Rakefile` to make that more explicit](https://github.com/sferik/twitter/commit/de57b1c2834653ea4c336ed426ee8fbbebcd80b2) ([@technomancy](https://twitter.com/technomancy))
* [Add workaround for `Mash#hash` that allows using return objects in sets and such](https://github.com/sferik/twitter/commit/2da491308766e82c797c7801bdc3a440b7f8d719) ([@technomancy](https://twitter.com/technomancy))
0.5.1
-----
* [Add data error hash returned from Twitter to a few of the exceptions to help with debugging](https://github.com/sferik/twitter/commit/72d46c4804a30b28ab351a5a0d37d6bc664e577e)
* [Fix bug with `friendship_exists?` throwing a stringify keys error because it was returning `true` or `false` instead of a `Hash` or `Array`](https://github.com/sferik/twitter/commit/1e9def65277125f23739be034abd4059a42d2b87)
0.5.0
-----
* [Proxy no longer supported (someone please add it back in, I never use proxies)](https://github.com/sferik/twitter/commit/dd2445e3e2c97f38b28a3f32ea902536b3897adf)
* [Identica support killed with an axe (nothing against them but I don't use it)](https://github.com/sferik/twitter/commit/dd2445e3e2c97f38b28a3f32ea902536b3897adf)
* [CLI shot to death (will be reborn at a later date using OAuth and its own gem)](https://github.com/sferik/twitter/commit/dd2445e3e2c97f38b28a3f32ea902536b3897adf)
0.4.3
-----
* [Make `verify_credentials` return a `Twitter::User` rather than a Hpricot doc](https://github.com/sferik/twitter/commit/6a8efc464dcb174e41b2eb0197a79e778dae1428)
0.4.2
-----
* [Add `Base#friend_ids` and `Base#follower_ids` methods](https://github.com/sferik/twitter/commit/b70718cc31684af6ce2d1c2a11adaaba29ea7b92) ([@joshowens](https://twitter.com/joshowens))
0.4.1
-----
* [Add better exception handling](https://github.com/sferik/twitter/commit/2b85bed874902d184e5d53c0a0bd249fd1ed3b8b) ([@billymeltdown](https://twitter.com/billymeltdown))
* [Add `Search#page` method](https://github.com/sferik/twitter/commit/977023126fbe7fdf13af53d840ca3b6807cd2d85) ([@ivey](https://twitter.com/ivey))
* [Add an option to display tweets on CLI in reverse chronological order](https://github.com/sferik/twitter/commit/40d2f1ae631dce3c31c6a13d295989e945b22622) ([@coderdaddy](https://twitter.com/coderdaddy))
* [Add `in_reply_to_status_id` option for replying to statuses](https://github.com/sferik/twitter/commit/2ecceda9fa74d486e3ba62edba7fa42a443191fa) ([@anthonycrumley](https://twitter.com/anthonycrumley))
* [Fix a bug where the [@config was improperly set](https://github.com/sferik/twitter/commit/9c5fd0f0a0186638aae189e28a3a0d0d20e7d3d5) ([@pope](https://twitter.com/pope))
* [Fix `verify_credentials` to include a format](https://github.com/sferik/twitter/commit/bf6f783e8867148a056d130f00a03679ea9b414b) ([@dlsspy](https://twitter.com/dlsspy))
0.4.0
-----
* [Remove Active Support dependency and switched to echoe for gem management](https://github.com/sferik/twitter/commit/fbb792561ea2aba8c8e7abb946d2a5e6e3d64fb0)
* [Remove CLI dependencies](https://github.com/sferik/twitter/commit/906d34db1a81314bb8929d9b5ee61519ed6dc080)
0.3.7
-----
* [Fix `source` parameter not getting through](https://github.com/sferik/twitter/commit/e3743cf22df3ad9406bf8c2e4425f30680606283)
0.3.6
-----
* [Refactor the remaining methods that were not using `request` to use it](https://github.com/sferik/twitter/commit/8a802c4b461be0d4d7f374888591a9af6ef8b8d2)
0.3.5
-----
* [Remove sqlite-ruby dependency](https://github.com/sferik/twitter/commit/9277e832daf9539e70f446b8b4f7093d8eb98484)
0.3.4
-----
* [Add `Search` class](https://github.com/sferik/twitter/commit/538a5d4b1a72ed2bf97404704699f498ab082ca9)
0.3.3
-----
* [Add Identica support](https://github.com/sferik/twitter/commit/ed06aaf27eea8852198200eb3db510d56508e727) ([@dlsspy](https://twitter.com/dlsspy))
* [Update methods to `POST` instead of `GET`](https://github.com/sferik/twitter/commit/ed06aaf27eea8852198200eb3db510d56508e727)
0.3.2
-----
* [Add the CLI gems as dependencies until it is separated from the API wrapper](https://github.com/sferik/twitter/commit/52af6fd83bb2e72b90abd6114e264a88431cfb34)
* [Add cleaner CLI errors for no active account or no accounts at all](https://github.com/sferik/twitter/commit/dbc9e57d0a66ee585893b0b5955078575effc616)
* [Add `username` and `password` parameters to `add` method](https://github.com/sferik/twitter/commit/013b48229786c1080ee79a490e731f4b1811a7e4)
0.3.1
-----
* [Add `open` method to CLI](https://github.com/sferik/twitter/commit/84e77a1d515f762d7a24f697786f5959d4f1cc2e)
* [Add `-f` option to timeline and replies which ignores the `since_id` and shows all results](https://github.com/sferik/twitter/commit/84e77a1d515f762d7a24f697786f5959d4f1cc2e)
* [Add `clear_config` to remove all cached values](https://github.com/sferik/twitter/commit/84e77a1d515f762d7a24f697786f5959d4f1cc2e)
* [Improved the output of `timelines` and `replies`](https://github.com/sferik/twitter/commit/84e77a1d515f762d7a24f697786f5959d4f1cc2e)
0.3.0
-----
* [Support multiple accounts in CLI and switching between them](https://github.com/sferik/twitter/commit/35eddef783492990bf0bebcae1f5891a556988e4)
* [Make `d` method accept stdin](https://github.com/sferik/twitter/commit/25ddfe33a10a252ff7d9ba74d4d16e3e25719661)
* [Add `Status#source`, `Status#truncated`, `Status#in_reply_to_status_id`, `Status#in_reply_to_user_id`, `Status#favorited`, and `User#protected` methods](https://github.com/sferik/twitter/commit/d02d233000667c74101571f9362532a57715ae4e)
* [Add `Base#friendship_exists?`, `Base#update_location`, `Base#update_delivery_device`, `Base#favorites`, `Base#create_favorite`, `Base#destroy_favorite`, `Base#block`, and `Base#unblock` methods](https://github.com/sferik/twitter/commit/eeca67c5693dc175cf1990c2657a6efd8c4cbd6d)
* [Rewrite methods that had `since` or `lite` parameters to use a `Hash`](https://github.com/sferik/twitter/commit/eeca67c5693dc175cf1990c2657a6efd8c4cbd6d)
0.2.7
-----
* [Add `Base#rate_limit_status` method](https://github.com/sferik/twitter/commit/2b5325b1875574805fde77f30d0df84e423272e5) ([@danielmorrison](https://twitter.com/danielmorrison))
* [Add `source` parameter to `Base#post`](https://github.com/sferik/twitter/commit/215b2ca687014e042f991192281ea1dfbe100665)
* [Add `twittergem` as the source when posting from the command-line interface](https://github.com/sferik/twitter/commit/d94b6bdb23dd27ff25cf170cd7ceb5610187d176)
* [Raise `Twitter::RateExceeded` when you hit your limit](https://github.com/sferik/twitter/commit/d94b6bdb23dd27ff25cf170cd7ceb5610187d176) ([@jimoleary](https://twitter.com/jimoleary))
* [Raise `Twitter::Unavailable` when Twitter returns 503](https://github.com/sferik/twitter/commit/d94b6bdb23dd27ff25cf170cd7ceb5610187d176)
* [Make `Twitter::CantConnect` messages more descriptive](https://github.com/sferik/twitter/commit/d94b6bdb23dd27ff25cf170cd7ceb5610187d176)
* [Make quoting your message optional when posting from the command-line interface](https://github.com/sferik/twitter/commit/d94b6bdb23dd27ff25cf170cd7ceb5610187d176) ([@bcaccinolo](https://twitter.com/bcaccinolo))
* [Alias `post` to `p` on the command-line interface](https://github.com/sferik/twitter/commit/d94b6bdb23dd27ff25cf170cd7ceb5610187d176) ([@bcaccinolo](https://twitter.com/bcaccinolo))
* [Unescape HTML and add color to the command-line interface](https://github.com/sferik/twitter/commit/d94b6bdb23dd27ff25cf170cd7ceb5610187d176) ([@mileszs](https://twitter.com/mileszs))
* [Add gemspec](https://github.com/sferik/twitter/commit/d94b6bdb23dd27ff25cf170cd7ceb5610187d176) ([@technoweenie](https://twitter.com/technoweenie), [@mileszs(https://twitter.com/mileszs))
* [Fix stack trace error on first command-line operation](https://github.com/sferik/twitter/commit/d94b6bdb23dd27ff25cf170cd7ceb5610187d176) ([@mrose2n](https://twitter.com/mrose2n))
0.2.6
-----
* [Found a simpler way of doing `stdin` without any extra gem dependencies](https://github.com/sferik/twitter/commit/2ef6c3e7280b64d5d4a956ca245e631b126001b0)
0.2.5
-----
* [Command-line interface can use `stdin` for posting](https://github.com/sferik/twitter/commit/d4e710bd3184f33775bf969b0993cbc9dff0ed50) ([@reclusive_geek](https://twitter.com/reclusive_geek))
$ twitter post 'test without stdin' # => twitters: test without stdin
$ echo 'test with stdin' | twitter post 'and an argv(1)' # => twitters: test with stdin and an argv(1)
$ echo 'test with stdin without any argv(1)' | twitter post # => twitters: test with stdin without any argv(1)
0.2.4
-----
* [Add `lite` parameter to `friends` and `followers` methods, which doesn't include the user's current status](https://github.com/sferik/twitter/commit/0de3901258de5b2a4a3fda308e495ee373d07ea6) ([@danielmorrison](https://twitter.com/danielmorrison))
* [Update `since` parameter to use HTTP header](https://github.com/sferik/twitter/commit/90b5b5ebb2a7d94a278e3ff374e4fde4cf850234) ([@danielmorrison](https://twitter.com/danielmorrison))
* [Add `since` parameter on `timeline` and `replies` methods](https://github.com/sferik/twitter/commit/90b5b5ebb2a7d94a278e3ff374e4fde4cf850234) ([@danielmorrison](https://twitter.com/danielmorrison))
0.2.3
-----
* [Add `d` to the command-line interface](https://github.com/sferik/twitter/commit/a9ecddd3323ef202248dae59d049b00b88b76b4e) ([@humbucker](https://twitter.com/humbucker))
* [Add progress dots while waiting for confirmation when Twitter is being slow](https://github.com/sferik/twitter/commit/02a24d9042f3fa0235759fbbd6f34ea639a01578) ([@HendyIrawan](https://twitter.com/HendyIrawan))
0.2.2
-----
* [Add `Base#leave` and `Base#follow` methods](https://github.com/sferik/twitter/commit/4878689063574ad88ea76343387094fc634ccead)
0.2.1
-----
0.2.0
-----
* [Alias `direct_messages` to `received_messages`](https://github.com/sferik/twitter/commit/c2d8c55516747627452224af8faecc15ee6b5fd4)
* [Add `Base#sent_messages`, `Base#create_friendship`, `Base#destroy_friendship`, `Base#featured`, `Base#replies`, `Base#destroy`, and `Base#status` methods](https://github.com/sferik/twitter/commit/c2d8c55516747627452224af8faecc15ee6b5fd4)
* [Add Active Support dependency](https://github.com/sferik/twitter/commit/c2d8c55516747627452224af8faecc15ee6b5fd4)
* [Add `Base#d` method](https://github.com/sferik/twitter/commit/139a820de0bcc97ece7e33435535985555231bc8) ([@jnewland](https://twitter.com/jnewland))
* [Fix `since` parameter in `Base#direct_messages` method](https://github.com/sferik/twitter/commit/41a9006be9221d7305752639ac4440b3a8859cd0) ([@jnewland](https://twitter.com/jnewland))
0.1.1
-----
* [Add support for Hpricot 0.5+](https://github.com/sferik/twitter/commit/4aa2fabaa62c60e9f11f29510db10b6ed406e510) ([@erebor](https://twitter.com/erebor))
0.1.0
-----
* [Add `Base#d` method](https://github.com/sferik/twitter/commit/13e031f8d2e8db6ca8ace18a25886fb690d580d2)
* [Add `Base#direct_messages` method](https://github.com/sferik/twitter/commit/0f4d699a5310dc8a4e2997b82853f5466292b320)
* [Add `Base#featured` and `Base#friends_for` methods](https://github.com/sferik/twitter/commit/21ca95ffa3f42aaf7728c3d5c2aa5f1f9ed84fe7)
* [Add tests](https://github.com/sferik/twitter/commit/ff1ae65766109c75f80c4b15797e12a69d7c29ad)
* [Remove `relative_created_at`](https://github.com/sferik/twitter/commit/ff1ae65766109c75f80c4b15797e12a69d7c29ad)
0.0.5
-----
* [Code cleanup](https://github.com/sferik/twitter/commit/abd6eb31089975e3dc65f7e0bb4156feacc97a1c)
0.0.4
-----
* [Add `User#location`, `User#description`, `User#url`, and `User#profile_image_url` methods](https://github.com/sferik/twitter/commit/e6737ec8b07b9fd1ffd96a21074a100a6fb3cf7e) ([@al3x](https://twitter.com/al3x))
0.0.3
-----
* [Make error message more informative](https://github.com/sferik/twitter/commit/1763cd85c4fd85cde6815cc7c1b74937dd7aeeaf)
0.0.2
-----
* Add command-line options for `friend` and `follower`
* Improved docs
0.0.1
-----
* [Initial release](https://github.com/sferik/twitter/commit/cd7aecde450157ae2ec0c07a2171d7149bebb74a)
twitter-6.2.0/CONTRIBUTING.md 0000664 0000000 0000000 00000003663 13200674762 0015471 0 ustar 00root root 0000000 0000000 ## Contributing
In the spirit of [free software][free-sw], **everyone** is encouraged to help
improve this project. Here are some ways *you* can contribute:
[free-sw]: http://www.fsf.org/licensing/essays/free-sw.html
* Use alpha, beta, and pre-release versions.
* Report bugs.
* Suggest new features.
* Write or edit documentation.
* Write specifications.
* Write code (**no patch is too small**: fix typos, add comments, clean up
inconsistent whitespace).
* Refactor code.
* Fix [issues][].
* Review patches.
* Financially pledge using [gittip][].
[issues]: https://github.com/sferik/twitter/issues
[gittip]: https://www.gittip.com/sferik/
## Submitting an Issue
We use the [GitHub issue tracker][issues] to track bugs and features. Before
submitting a bug report or feature request, check to make sure it hasn't
already been submitted. When submitting a bug report, please include a [Gist][]
that includes a stack trace and any details that may be necessary to reproduce
the bug, including your gem version, Ruby version, and operating system.
Ideally, a bug report should include a pull request with failing specs.
[gist]: https://gist.github.com/
## Submitting a Pull Request
1. [Fork the repository.][fork]
2. [Create a topic branch.][branch]
3. Add specs for your unimplemented feature or bug fix.
4. Run `bundle exec rake spec`. If your specs pass, return to step 3.
5. Implement your feature or bug fix.
6. Run `bundle exec rake`. If your specs fail, return to step 5.
7. Run `open coverage/index.html`. If your changes are not completely covered
by your tests, return to step 3.
8. Add documentation for your feature or bug fix.
9. Run `bundle exec rake verify_measurements`. If your changes are not 100%
documented, go back to step 8.
10. Commit and push your changes.
11. [Submit a pull request.][pr]
[fork]: http://help.github.com/fork-a-repo/
[branch]: http://learn.github.com/p/branching.html
[pr]: http://help.github.com/send-pull-requests/
twitter-6.2.0/Gemfile 0000664 0000000 0000000 00000000464 13200674762 0014527 0 ustar 00root root 0000000 0000000 source 'https://rubygems.org'
gem 'jruby-openssl', platforms: :jruby
gem 'rake'
gem 'yard'
group :development do
gem 'pry'
end
group :test do
gem 'coveralls'
gem 'rspec', '>= 2.14'
gem 'rubocop', '>= 0.46'
gem 'simplecov', '>= 0.9'
gem 'timecop'
gem 'webmock'
gem 'yardstick'
end
gemspec
twitter-6.2.0/LICENSE.md 0000664 0000000 0000000 00000002153 13200674762 0014635 0 ustar 00root root 0000000 0000000 Copyright (c) 2006-2016 Erik Michaels-Ober, John Nunemaker, Wynn Netherland, Steve Richert, Steve Agalloco
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
twitter-6.2.0/README.md 0000664 0000000 0000000 00000020120 13200674762 0014502 0 ustar 00root root 0000000 0000000 # The Twitter Ruby Gem
[][gem]
[][travis]
[][gemnasium]
[][codeclimate]
[][coveralls]
[][inchpages]
[gem]: https://rubygems.org/gems/twitter
[travis]: https://travis-ci.org/sferik/twitter
[gemnasium]: https://gemnasium.com/sferik/twitter
[codeclimate]: https://codeclimate.com/github/sferik/twitter
[coveralls]: https://coveralls.io/r/sferik/twitter
[inchpages]: http://inch-ci.org/github/sferik/twitter
A Ruby interface to the Twitter API.
## Installation
gem install twitter
## CLI
Looking for the Twitter command-line interface? It was [removed][] from this
gem in version 0.5.0 and now exists as a [separate project][t].
[removed]: https://github.com/sferik/twitter/commit/dd2445e3e2c97f38b28a3f32ea902536b3897adf
[t]: https://github.com/sferik/t
## Documentation
[http://rdoc.info/gems/twitter][documentation]
[documentation]: http://rdoc.info/gems/twitter
## Examples
[https://github.com/sferik/twitter/tree/master/examples][examples]
[examples]: https://github.com/sferik/twitter/tree/master/examples
## Announcements
You should [follow @gem][follow] on Twitter for announcements and updates about
this library.
[follow]: https://twitter.com/gem
## Mailing List
Please direct questions about this library to the [mailing list].
[mailing list]: https://groups.google.com/group/twitter-ruby-gem
## Apps Wiki
Does your project or organization use this gem? Add it to the [apps
wiki][apps]!
[apps]: https://github.com/sferik/twitter/wiki/apps
## Configuration
Twitter API v1.1 requires you to authenticate via OAuth, so you'll need to
[register your application with Twitter][register]. Once you've registered an
application, make sure to set the correct access level, otherwise you may see
the error:
[register]: https://apps.twitter.com/
Read-only application cannot POST
Your new application will be assigned a consumer key/secret pair and you will
be assigned an OAuth access token/secret pair for that application. You'll need
to configure these values before you make a request or else you'll get the
error:
Bad Authentication data
You can pass configuration options as a block to `Twitter::REST::Client.new`.
```ruby
client = Twitter::REST::Client.new do |config|
config.consumer_key = "YOUR_CONSUMER_KEY"
config.consumer_secret = "YOUR_CONSUMER_SECRET"
config.access_token = "YOUR_ACCESS_TOKEN"
config.access_token_secret = "YOUR_ACCESS_SECRET"
end
```
## Usage Examples
After configuring a `client`, you can do the following things.
**Tweet (as the authenticated user)**
```ruby
client.update("I'm tweeting with @gem!")
```
**Follow a user (by screen name or user ID)**
```ruby
client.follow("gem")
client.follow(213747670)
```
**Fetch a user (by screen name or user ID)**
```ruby
client.user("gem")
client.user(213747670)
```
**Fetch a cursored list of followers with profile details (by screen name or user ID, or by implicit authenticated user)**
```ruby
client.followers("gem")
client.followers(213747670)
client.followers
```
**Fetch a cursored list of friends with profile details (by screen name or user ID, or by implicit authenticated user)**
```ruby
client.friends("gem")
client.friends(213747670)
client.friends
```
**Fetch the timeline of Tweets by a user**
```ruby
client.user_timeline("gem")
client.user_timeline(213747670)
```
**Fetch the timeline of Tweets from the authenticated user's home page**
```ruby
client.home_timeline
```
**Fetch the timeline of Tweets mentioning the authenticated user**
```ruby
client.mentions_timeline
```
**Fetch a particular Tweet by ID**
```ruby
client.status(27558893223)
```
**Collect the three most recent marriage proposals to @justinbieber**
```ruby
client.search("to:justinbieber marry me", result_type: "recent").take(3).collect do |tweet|
"#{tweet.user.screen_name}: #{tweet.text}"
end
```
**Find a Japanese-language Tweet tagged #ruby (excluding retweets)**
```ruby
client.search("#ruby -rt", lang: "ja").first.text
```
For more usage examples, please see the full [documentation][].
## Streaming
Site Streams are restricted to whitelisted accounts. To apply for access,
[follow the steps in the Site Streams documentation][site-streams]. [User
Streams][user-streams] do not require prior approval.
[site-streams]: https://dev.twitter.com/streaming/sitestreams#applyingforaccess
[user-streams]: https://dev.twitter.com/streaming/userstreams
**Configuration works just like `Twitter::REST::Client`**
```ruby
client = Twitter::Streaming::Client.new do |config|
config.consumer_key = "YOUR_CONSUMER_KEY"
config.consumer_secret = "YOUR_CONSUMER_SECRET"
config.access_token = "YOUR_ACCESS_TOKEN"
config.access_token_secret = "YOUR_ACCESS_SECRET"
end
```
**Stream a random sample of all tweets**
```ruby
client.sample do |object|
puts object.text if object.is_a?(Twitter::Tweet)
end
```
**Stream mentions of coffee or tea**
```ruby
topics = ["coffee", "tea"]
client.filter(track: topics.join(",")) do |object|
puts object.text if object.is_a?(Twitter::Tweet)
end
```
**Stream tweets, events, and direct messages for the authenticated user**
```ruby
client.user do |object|
case object
when Twitter::Tweet
puts "It's a tweet!"
when Twitter::DirectMessage
puts "It's a direct message!"
when Twitter::Streaming::StallWarning
warn "Falling behind!"
end
end
```
An `object` may be one of the following:
* `Twitter::Tweet`
* `Twitter::DirectMessage`
* `Twitter::Streaming::DeletedTweet`
* `Twitter::Streaming::Event`
* `Twitter::Streaming::FriendList`
* `Twitter::Streaming::StallWarning`
## Ads
We recommend using the [Twitter Ads SDK for Ruby][ads] to interact with the Twitter Ads API.
[ads]: http://twitterdev.github.io/twitter-ruby-ads-sdk/
## Object Graph
![Entity-relationship diagram][erd]
[erd]: https://cdn.rawgit.com/sferik/twitter/master/etc/erd.svg "Entity-relationship diagram"
This entity-relationship diagram is generated programatically. If you add or
remove any Twitter objects, please regenerate the ERD with the following
command:
bundle exec rake erd
## Supported Ruby Versions
This library aims to support and is [tested against][travis] the following Ruby
versions:
* Ruby 2.0.0
* Ruby 2.1
* Ruby 2.2
* Ruby 2.3
* JRuby 9.1.6.0
If something doesn't work on one of these versions, it's a bug.
This library may inadvertently work (or seem to work) on other Ruby versions,
however support will only be provided for the versions listed above.
If you would like this library to support another Ruby version or
implementation, you may volunteer to be a maintainer. Being a maintainer
entails making sure all tests run and pass on that implementation. When
something breaks on your implementation, you will be responsible for providing
patches in a timely fashion. If critical issues for a particular implementation
exist at the time of a major release, support for that Ruby version may be
dropped.
## Versioning
This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations
of this scheme should be reported as bugs. Specifically, if a minor or patch
version is released that breaks backward compatibility, that version should be
immediately yanked and/or a new version should be immediately released that
restores compatibility. Breaking changes to the public API will only be
introduced with new major versions. As a result of this policy, you can (and
should) specify a dependency on this gem using the [Pessimistic Version
Constraint][pvc] with two digits of precision. For example:
spec.add_dependency 'twitter', '~> 6.0'
[semver]: http://semver.org/
[pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
## Copyright
Copyright (c) 2006-2016 Erik Michaels-Ober, John Nunemaker, Wynn Netherland, Steve Richert, Steve Agalloco.
See [LICENSE][] for details.
[license]: LICENSE.md
twitter-6.2.0/Rakefile 0000664 0000000 0000000 00000001241 13200674762 0014673 0 ustar 00root root 0000000 0000000 require 'bundler'
Bundler::GemHelper.install_tasks
task :erd do
FORMAT = 'svg'.freeze
`bundle exec ruby ./etc/erd.rb > ./etc/erd.dot`
`dot -T #{FORMAT} ./etc/erd.dot -o ./etc/erd.#{FORMAT}`
end
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task test: :spec
require 'rubocop/rake_task'
RuboCop::RakeTask.new
require 'yard'
YARD::Rake::YardocTask.new
require 'yardstick/rake/measurement'
Yardstick::Rake::Measurement.new do |measurement|
measurement.output = 'measurement/report.txt'
end
require 'yardstick/rake/verify'
Yardstick::Rake::Verify.new do |verify|
verify.threshold = 59.0
end
task default: %i[spec rubocop verify_measurements]
twitter-6.2.0/etc/ 0000775 0000000 0000000 00000000000 13200674762 0014003 5 ustar 00root root 0000000 0000000 twitter-6.2.0/etc/erd.dot 0000664 0000000 0000000 00000017154 13200674762 0015275 0 ustar 00root root 0000000 0000000 digraph classes {
graph [rotate=0, rankdir="LR"]
node [fillcolor="#c4ddec", style="filled", fontname="Helvetica Neue"]
edge [color="#444444"]
Array [label="Array"]
Exception [label="Exception"]
Naught__BasicObject [label="Naught::BasicObject"]
Object [label="Object"]
StandardError [label="StandardError"]
Twitter__Arguments [label="Twitter::Arguments"]
Twitter__Base [label="Twitter::Base"]
Twitter__BasicUser [label="Twitter::BasicUser"]
Twitter__Client [label="Twitter::Client"]
Twitter__Configuration [label="Twitter::Configuration"]
Twitter__Cursor [label="Twitter::Cursor"]
Twitter__DirectMessage [label="Twitter::DirectMessage"]
Twitter__Entity [label="Twitter::Entity"]
Twitter__Entity__Hashtag [label="Twitter::Entity::Hashtag"]
Twitter__Entity__Symbol [label="Twitter::Entity::Symbol"]
Twitter__Entity__URI [label="Twitter::Entity::URI"]
Twitter__Entity__UserMention [label="Twitter::Entity::UserMention"]
Twitter__Error [label="Twitter::Error"]
Twitter__Error__AlreadyFavorited [label="Twitter::Error::AlreadyFavorited"]
Twitter__Error__AlreadyRetweeted [label="Twitter::Error::AlreadyRetweeted"]
Twitter__Error__BadGateway [label="Twitter::Error::BadGateway"]
Twitter__Error__BadRequest [label="Twitter::Error::BadRequest"]
Twitter__Error__ClientError [label="Twitter::Error::ClientError"]
Twitter__Error__DuplicateStatus [label="Twitter::Error::DuplicateStatus"]
Twitter__Error__Forbidden [label="Twitter::Error::Forbidden"]
Twitter__Error__GatewayTimeout [label="Twitter::Error::GatewayTimeout"]
Twitter__Error__InternalServerError [label="Twitter::Error::InternalServerError"]
Twitter__Error__NotAcceptable [label="Twitter::Error::NotAcceptable"]
Twitter__Error__NotFound [label="Twitter::Error::NotFound"]
Twitter__Error__ServerError [label="Twitter::Error::ServerError"]
Twitter__Error__ServiceUnavailable [label="Twitter::Error::ServiceUnavailable"]
Twitter__Error__TooManyRequests [label="Twitter::Error::TooManyRequests"]
Twitter__Error__Unauthorized [label="Twitter::Error::Unauthorized"]
Twitter__Error__UnprocessableEntity [label="Twitter::Error::UnprocessableEntity"]
Twitter__Factory [label="Twitter::Factory"]
Twitter__Geo [label="Twitter::Geo"]
Twitter__GeoFactory [label="Twitter::GeoFactory"]
Twitter__GeoResults [label="Twitter::GeoResults"]
Twitter__Geo__Point [label="Twitter::Geo::Point"]
Twitter__Geo__Polygon [label="Twitter::Geo::Polygon"]
Twitter__Headers [label="Twitter::Headers"]
Twitter__Identity [label="Twitter::Identity"]
Twitter__Language [label="Twitter::Language"]
Twitter__List [label="Twitter::List"]
Twitter__MediaFactory [label="Twitter::MediaFactory"]
Twitter__Media__AnimatedGif [label="Twitter::Media::AnimatedGif"]
Twitter__Media__Photo [label="Twitter::Media::Photo"]
Twitter__Media__Video [label="Twitter::Media::Video"]
Twitter__Media__VideoInfo [label="Twitter::Media::VideoInfo"]
Twitter__Metadata [label="Twitter::Metadata"]
Twitter__NullObject [label="Twitter::NullObject"]
Twitter__OEmbed [label="Twitter::OEmbed"]
Twitter__Place [label="Twitter::Place"]
Twitter__ProfileBanner [label="Twitter::ProfileBanner"]
Twitter__REST__Client [label="Twitter::REST::Client"]
Twitter__REST__Request [label="Twitter::REST::Request"]
Twitter__RateLimit [label="Twitter::RateLimit"]
Twitter__Relationship [label="Twitter::Relationship"]
Twitter__SavedSearch [label="Twitter::SavedSearch"]
Twitter__SearchResults [label="Twitter::SearchResults"]
Twitter__Settings [label="Twitter::Settings"]
Twitter__Size [label="Twitter::Size"]
Twitter__SourceUser [label="Twitter::SourceUser"]
Twitter__Streaming__Client [label="Twitter::Streaming::Client"]
Twitter__Streaming__Connection [label="Twitter::Streaming::Connection"]
Twitter__Streaming__DeletedTweet [label="Twitter::Streaming::DeletedTweet"]
Twitter__Streaming__Event [label="Twitter::Streaming::Event"]
Twitter__Streaming__FriendList [label="Twitter::Streaming::FriendList"]
Twitter__Streaming__MessageParser [label="Twitter::Streaming::MessageParser"]
Twitter__Streaming__Response [label="Twitter::Streaming::Response"]
Twitter__Streaming__StallWarning [label="Twitter::Streaming::StallWarning"]
Twitter__Suggestion [label="Twitter::Suggestion"]
Twitter__TargetUser [label="Twitter::TargetUser"]
Twitter__Trend [label="Twitter::Trend"]
Twitter__TrendResults [label="Twitter::TrendResults"]
Twitter__Tweet [label="Twitter::Tweet"]
Twitter__User [label="Twitter::User"]
Twitter__Variant [label="Twitter::Variant"]
Array -> Object
Exception -> Object
Naught__BasicObject -> BasicObject
Object -> BasicObject
StandardError -> Exception
Twitter__Arguments -> Array
Twitter__Base -> Object
Twitter__BasicUser -> Twitter__Identity
Twitter__Client -> Object
Twitter__Configuration -> Twitter__Base
Twitter__Cursor -> Object
Twitter__DirectMessage -> Twitter__Identity
Twitter__Entity -> Twitter__Base
Twitter__Entity__Hashtag -> Twitter__Entity
Twitter__Entity__Symbol -> Twitter__Entity
Twitter__Entity__URI -> Twitter__Entity
Twitter__Entity__UserMention -> Twitter__Entity
Twitter__Error -> StandardError
Twitter__Error__AlreadyFavorited -> Twitter__Error__Forbidden
Twitter__Error__AlreadyRetweeted -> Twitter__Error__Forbidden
Twitter__Error__BadGateway -> Twitter__Error__ServerError
Twitter__Error__BadRequest -> Twitter__Error__ClientError
Twitter__Error__ClientError -> Twitter__Error
Twitter__Error__DuplicateStatus -> Twitter__Error__Forbidden
Twitter__Error__Forbidden -> Twitter__Error__ClientError
Twitter__Error__GatewayTimeout -> Twitter__Error__ServerError
Twitter__Error__InternalServerError -> Twitter__Error__ServerError
Twitter__Error__NotAcceptable -> Twitter__Error__ClientError
Twitter__Error__NotFound -> Twitter__Error__ClientError
Twitter__Error__ServerError -> Twitter__Error
Twitter__Error__ServiceUnavailable -> Twitter__Error__ServerError
Twitter__Error__TooManyRequests -> Twitter__Error__ClientError
Twitter__Error__Unauthorized -> Twitter__Error__ClientError
Twitter__Error__UnprocessableEntity -> Twitter__Error__ClientError
Twitter__Factory -> Object
Twitter__Geo -> Twitter__Base
Twitter__GeoFactory -> Twitter__Factory
Twitter__GeoResults -> Object
Twitter__Geo__Point -> Twitter__Geo
Twitter__Geo__Polygon -> Twitter__Geo
Twitter__Headers -> Object
Twitter__Identity -> Twitter__Base
Twitter__Language -> Twitter__Base
Twitter__List -> Twitter__Identity
Twitter__MediaFactory -> Twitter__Factory
Twitter__Media__AnimatedGif -> Twitter__Media__Video
Twitter__Media__Photo -> Twitter__Identity
Twitter__Media__Video -> Twitter__Identity
Twitter__Media__VideoInfo -> Twitter__Base
Twitter__Metadata -> Twitter__Base
Twitter__NullObject -> Naught__BasicObject
Twitter__OEmbed -> Twitter__Base
Twitter__Place -> Twitter__Identity
Twitter__ProfileBanner -> Twitter__Base
Twitter__REST__Client -> Twitter__Client
Twitter__REST__Request -> Object
Twitter__RateLimit -> Twitter__Base
Twitter__Relationship -> Twitter__Base
Twitter__SavedSearch -> Twitter__Identity
Twitter__SearchResults -> Object
Twitter__Settings -> Twitter__Base
Twitter__Size -> Twitter__Base
Twitter__SourceUser -> Twitter__BasicUser
Twitter__Streaming__Client -> Twitter__Client
Twitter__Streaming__Connection -> Object
Twitter__Streaming__DeletedTweet -> Twitter__Identity
Twitter__Streaming__Event -> Object
Twitter__Streaming__FriendList -> Array
Twitter__Streaming__MessageParser -> Object
Twitter__Streaming__Response -> Object
Twitter__Streaming__StallWarning -> Twitter__Base
Twitter__Suggestion -> Twitter__Base
Twitter__TargetUser -> Twitter__BasicUser
Twitter__Trend -> Twitter__Base
Twitter__TrendResults -> Object
Twitter__Tweet -> Twitter__Identity
Twitter__User -> Twitter__BasicUser
Twitter__Variant -> Twitter__Base
}
twitter-6.2.0/etc/erd.rb 0000664 0000000 0000000 00000002336 13200674762 0015106 0 ustar 00root root 0000000 0000000 require 'twitter'
COLON = ':'.freeze
UNDERSCORE = '_'.freeze
TAB = "\t".freeze
NAMESPACE = 'Twitter::'.freeze
# Colons are invalid characters in DOT nodes.
# Replace them with underscores.
# http://www.graphviz.org/doc/info/lang.html
def nodize(klass)
klass.name.tr(COLON, UNDERSCORE)
end
nodes = {}
edges = {}
twitter_objects = ObjectSpace.each_object(Class).select do |klass|
klass.name.to_s.start_with?(NAMESPACE)
end
twitter_objects.each do |klass|
loop do
unless klass.nil? || klass.superclass.nil? || klass.name.empty?
nodes[nodize(klass)] = klass.name
edges[nodize(klass)] = nodize(klass.superclass)
end
klass = klass.superclass
break if klass.nil?
end
end
edges.delete(nil)
@indent = 0
def indent
@indent += 1
yield
@indent -= 1
end
def puts(string)
super(TAB * @indent + string)
end
puts 'digraph classes {'
# Add or remove DOT formatting options here
indent do
puts 'graph [rotate=0, rankdir="LR"]'
puts 'node [fillcolor="#c4ddec", style="filled", fontname="Helvetica Neue"]'
puts 'edge [color="#444444"]'
nodes.sort.each do |node, label|
puts "#{node} [label=\"#{label}\"]"
end
edges.sort.each do |child, parent|
puts "#{child} -> #{parent}"
end
end
puts '}'
twitter-6.2.0/etc/erd.svg 0000664 0000000 0000000 00000160323 13200674762 0015303 0 ustar 00root root 0000000 0000000
twitter-6.2.0/examples/ 0000775 0000000 0000000 00000000000 13200674762 0015046 5 ustar 00root root 0000000 0000000 twitter-6.2.0/examples/AllTweets.md 0000664 0000000 0000000 00000001774 13200674762 0017305 0 ustar 00root root 0000000 0000000 # All Tweets
This example assumes you have a configured Twitter REST `client`. Instructions
on how to configure a client can be found in [examples/Configuration.md][cfg].
[cfg]: https://github.com/sferik/twitter/blob/master/examples/Configuration.md
You can fetch up to 3,200 tweets for a user, 200 at a time.
Here is an example of recursively getting pages of 200 Tweets until you receive
an empty response.
**Note: This may result in [rate limiting][].**
[rate limiting]: https://github.com/sferik/twitter/blob/master/examples/RateLimiting.md
```ruby
def collect_with_max_id(collection=[], max_id=nil, &block)
response = yield(max_id)
collection += response
response.empty? ? collection.flatten : collect_with_max_id(collection, response.last.id - 1, &block)
end
def client.get_all_tweets(user)
collect_with_max_id do |max_id|
options = {count: 200, include_rts: true}
options[:max_id] = max_id unless max_id.nil?
user_timeline(user, options)
end
end
client.get_all_tweets("sferik")
```
twitter-6.2.0/examples/Configuration.md 0000664 0000000 0000000 00000011523 13200674762 0020201 0 ustar 00root root 0000000 0000000 # Configuration
Twitter API version 1.1 requires authentication on all requests. Some requests
can be made with [application-only authentication][application-only] while
other requests require [single-user authentication][single-user].
[application-only]: https://dev.twitter.com/oauth/application-only
[single-user]: https://dev.twitter.com/oauth/overview/single-user
## Application-only Authentication
To start using the Twitter API, you need to [register your application with
Twitter][register]. Registration requires you to answer some questions about
your application and agree to the [Twitter API Terms of Use][api-terms].
[register]: https://apps.twitter.com/
[api-terms]: https://dev.twitter.com/overview/terms/agreement-and-policy
Once you've registered an application, it's important that you set the correct
access level. Otherwise you may see the error:
Read-only application cannot POST
Your new application will be assigned a consumer key/secret pair that
identifies your application to Twitter. This is all you need to configure your
client for application-only authentication.
```ruby
client = Twitter::REST::Client.new do |config|
config.consumer_key = "YOUR_CONSUMER_KEY"
config.consumer_secret = "YOUR_CONSUMER_SECRET"
end
```
If you prefer, you can pass in configuration as a `Hash`:
```ruby
config = {
consumer_key: "YOUR_CONSUMER_KEY",
consumer_secret: "YOUR_CONSUMER_SECRET",
}
client = Twitter::REST::Client.new(config)
```
Regardless of your configuration style, you should now be able to use this
client to make any Twitter API request that does not require single-user
authentication. For example:
```ruby
client.user("sferik")
```
Note: The first time this method is called, it will make two API requests.
First, it will fetch an access token to perform the request. Then, it will
fetch the requested user. The access token will be cached for subsequent
requests made with the same client but you may wish to manually fetch the
access token once and use it when initializing clients to avoid making two
requests every time.
```ruby
client.bearer_token
```
This token never expires and will not change unless it is invalidated. Once
you've obtained a bearer token, you can use it to initialize clients to avoid
making an extra request.
```ruby
client = Twitter::REST::Client.new do |config|
config.consumer_key = "YOUR_CONSUMER_KEY"
config.consumer_secret = "YOUR_CONSUMER_SECRET"
config.bearer_token = "YOUR_BEARER_TOKEN"
end
```
## Single-user Authentication
Not all Twitter API resources are accessible with application-only
authentication. Some resources require single-user authentication tokens, which
you can obtain from the [3-legged authorization][3-legged-authorization] flow.
[3-legged-authorization]: https://dev.twitter.com/oauth/3-legged
```ruby
client = Twitter::REST::Client.new do |config|
config.consumer_key = "YOUR_CONSUMER_KEY"
config.consumer_secret = "YOUR_CONSUMER_SECRET"
config.access_token = "YOUR_ACCESS_TOKEN"
config.access_token_secret = "YOUR_ACCESS_SECRET"
end
```
You can use this client to make any Twitter REST API request. For example:
```ruby
client.update("I'm tweeting with @gem!")
```
## Streaming Clients
Streaming clients are initialized just like single-user authenticated REST
clients:
```ruby
client = Twitter::Streaming::Client.new do |config|
config.consumer_key = "YOUR_CONSUMER_KEY"
config.consumer_secret = "YOUR_CONSUMER_SECRET"
config.access_token = "YOUR_ACCESS_TOKEN"
config.access_token_secret = "YOUR_ACCESS_SECRET"
end
```
```ruby
client.sample do |object|
puts object.text if object.is_a?(Twitter::Tweet)
end
```
For more information, see the documentation for the
[`Twitter::Client`][client], [`Twitter::REST::Client`][rest-client], and
[`Twitter::Streaming::Client`][streaming-client] classes.
[client]: http://rdoc.info/gems/twitter/Twitter/Client
[rest-client]: http://rdoc.info/gems/twitter/Twitter/REST/Client
[streaming-client]: http://rdoc.info/gems/twitter/Twitter/Streaming/Client
## Using a Proxy
If you'd like to connect via a proxy, a proxy can be configured by passing a
`Hash` to your configuration:
```ruby
proxy: {
uri: Addressable::URI.parse("http://proxy_host:proxy_port"),
username: "proxy_username",
password: "proxy_password"
}
client = Twitter::REST::Client.new do |config|
config.consumer_key = "YOUR_CONSUMER_KEY"
config.consumer_secret = "YOUR_CONSUMER_SECRET"
config.access_token = "YOUR_ACCESS_TOKEN"
config.access_token_secret = "YOUR_ACCESS_SECRET"
config.proxy = proxy
end
```
Note that only a `host` and `port` are required, but a `username` and `password`
can be optionally configured for an authenticated proxy server. Proxies are
supported by both [`Twitter::REST::Client`][rest-client] and
[`Twitter::Streaming::Client`][streaming-client] classes.
twitter-6.2.0/examples/README.md 0000664 0000000 0000000 00000000761 13200674762 0016331 0 ustar 00root root 0000000 0000000 Examples Index
====================
- [All Tweets](AllTweets.md)
- [Configuration](Configuration.md#configuration)
- [Application-only Authentication](Configuration.md#application-only-authentication)
- [Single-user Authentication](Configuration.md#single-user-authentication)
- [Streaming Clients](Configuration.md#streaming-clients)
- [Rate Limits](RateLimiting.md#rate-limits)
- [Search](Search.md#search)
- [Streaming](Streaming.md#streaming)
- [Update (Tweet)](Update.md#update)
twitter-6.2.0/examples/RateLimiting.md 0000664 0000000 0000000 00000001200 13200674762 0017751 0 ustar 00root root 0000000 0000000 # Rate Limits
This example assumes you have a configured Twitter REST `client`. Instructions
on how to configure a client can be found in [examples/Configuration.md][cfg].
[cfg]: https://github.com/sferik/twitter/blob/master/examples/Configuration.md
Here's an example of how to handle rate limits:
```ruby
follower_ids = client.follower_ids('justinbieber')
begin
follower_ids.to_a
rescue Twitter::Error::TooManyRequests => error
# NOTE: Your process could go to sleep for up to 15 minutes but if you
# retry any sooner, it will almost certainly fail with the same exception.
sleep error.rate_limit.reset_in + 1
retry
end
```
twitter-6.2.0/examples/Search.md 0000664 0000000 0000000 00000000774 13200674762 0016605 0 ustar 00root root 0000000 0000000 # Search
This example assumes you have a configured Twitter REST `client`. Instructions
on how to configure a client can be found in [examples/Configuration.md][cfg].
[cfg]: https://github.com/sferik/twitter/blob/master/examples/Configuration.md
Here's a simple example of how to search for tweets. This query will return the
three most recent marriage proposals to @justinbieber.
```ruby
client.search("to:justinbieber marry me", result_type: "recent").take(3).each do |tweet|
puts tweet.text
end
```
twitter-6.2.0/examples/Streaming.md 0000664 0000000 0000000 00000000651 13200674762 0017323 0 ustar 00root root 0000000 0000000 # Streaming
This example assumes you have a configured Twitter Streaming `client`.
Instructions on how to configure a client can be found in
[examples/Configuration.md][cfg].
[cfg]: https://github.com/sferik/twitter/blob/master/examples/Configuration.md
Here's a simple example of how to stream tweets from San Francisco:
```ruby
client.filter(locations: "-122.75,36.8,-121.75,37.8") do |tweet|
puts tweet.text
end
```
twitter-6.2.0/examples/Update.md 0000664 0000000 0000000 00000003510 13200674762 0016611 0 ustar 00root root 0000000 0000000 # Update
These examples assume you have a configured Twitter REST `client`.
Instructions on how to configure a client can be found in
[examples/Configuration.md][cfg].
[cfg]: https://github.com/sferik/twitter/blob/master/examples/Configuration.md
If the authenticated user has granted read/write permission to your
application, you may tweet as them.
```ruby
client.update("I'm tweeting with @gem!")
```
Post an update in reply to another tweet.
```ruby
client.update("I'm tweeting with @gem!", in_reply_to_status_id: 402712877960019968)
```
Post an update with precise coordinates.
```ruby
client.update("I'm tweeting with @gem!", lat: 37.7821120598956, long: -122.400612831116, display_coordinates: true)
```
Post an update from a specific place. Place IDs can be retrieved using the
[`#reverse_geocode`][reverse_geocode] method.
[reverse_geocode]: http://rdoc.info/gems/twitter/Twitter/REST/API/PlacesAndGeo#reverse_geocode-instance_method
```ruby
client.update("I'm tweeting with @gem!", place_id: "df51dec6f4ee2b2c")
```
Post an update with an image.
```ruby
client.update_with_media("I'm tweeting with @gem!", File.new("/path/to/media.png"))
```
Post an update with a possibly-sensitive image.
```ruby
client.update_with_media("I'm tweeting with @gem!", File.new("/path/to/sensitive-media.png"), possibly_sensitive: true)
```
Post an update with multiple images.
```ruby
media = %w(/path/to/media1.png /path/to/media2.png).map { |filename| File.new(filename) }
client.update_with_media("I'm tweeting with @gem!", media)
```
For more information, see the documentation for the [`#update`][update] and
[`#update_with_media`][update_with_media] methods.
[update]: http://rdoc.info/gems/twitter/Twitter/REST/Tweets#update-instance_method
[update_with_media]: http://rdoc.info/gems/twitter/Twitter/REST/Tweets#update_with_media-instance_method
twitter-6.2.0/lib/ 0000775 0000000 0000000 00000000000 13200674762 0013776 5 ustar 00root root 0000000 0000000 twitter-6.2.0/lib/twitter.rb 0000664 0000000 0000000 00000001575 13200674762 0016035 0 ustar 00root root 0000000 0000000 require 'addressable/uri'
require 'twitter/configuration'
require 'twitter/cursor'
require 'twitter/direct_message'
require 'twitter/entity'
require 'twitter/entity/hashtag'
require 'twitter/entity/symbol'
require 'twitter/entity/uri'
require 'twitter/entity/user_mention'
require 'twitter/geo_factory'
require 'twitter/language'
require 'twitter/list'
require 'twitter/media_factory'
require 'twitter/metadata'
require 'twitter/oembed'
require 'twitter/place'
require 'twitter/profile_banner'
require 'twitter/rate_limit'
require 'twitter/relationship'
require 'twitter/rest/client'
require 'twitter/saved_search'
require 'twitter/search_results'
require 'twitter/settings'
require 'twitter/size'
require 'twitter/source_user'
require 'twitter/streaming/client'
require 'twitter/suggestion'
require 'twitter/target_user'
require 'twitter/trend'
require 'twitter/tweet'
require 'twitter/user'
twitter-6.2.0/lib/twitter/ 0000775 0000000 0000000 00000000000 13200674762 0015500 5 ustar 00root root 0000000 0000000 twitter-6.2.0/lib/twitter/arguments.rb 0000664 0000000 0000000 00000000450 13200674762 0020031 0 ustar 00root root 0000000 0000000 module Twitter
class Arguments < Array
# @return [Hash]
attr_reader :options
# Initializes a new Arguments object
#
# @return [Twitter::Arguments]
def initialize(args)
@options = args.last.is_a?(::Hash) ? args.pop : {}
super(args.flatten)
end
end
end
twitter-6.2.0/lib/twitter/base.rb 0000664 0000000 0000000 00000007327 13200674762 0016750 0 ustar 00root root 0000000 0000000 require 'addressable/uri'
require 'forwardable'
require 'memoizable'
require 'twitter/null_object'
require 'twitter/utils'
module Twitter
class Base
extend Forwardable
include Memoizable
include Twitter::Utils
# @return [Hash]
attr_reader :attrs
alias to_h attrs
alias to_hash to_h
class << self
# Define methods that retrieve the value from attributes
#
# @param attrs [Array, Symbol]
def attr_reader(*attrs)
attrs.each do |attr|
define_attribute_method(attr)
define_predicate_method(attr)
end
end
def predicate_attr_reader(*attrs)
attrs.each do |attr|
define_predicate_method(attr)
end
end
# Define object methods from attributes
#
# @param klass [Symbol]
# @param key1 [Symbol]
# @param key2 [Symbol]
def object_attr_reader(klass, key1, key2 = nil)
define_attribute_method(key1, klass, key2)
define_predicate_method(key1)
end
# Define URI methods from attributes
#
# @param attrs [Array, Symbol]
def uri_attr_reader(*attrs)
attrs.each do |uri_key|
array = uri_key.to_s.split('_')
index = array.index('uri')
array[index] = 'url'
url_key = array.join('_').to_sym
define_uri_method(uri_key, url_key)
alias_method(url_key, uri_key)
define_predicate_method(uri_key, url_key)
alias_method(:"#{url_key}?", :"#{uri_key}?")
end
end
# Define display_uri attribute methods
def display_uri_attr_reader
define_attribute_method(:display_url)
alias_method(:display_uri, :display_url)
define_predicate_method(:display_uri, :display_url)
alias_method(:display_url?, :display_uri?)
end
# Dynamically define a method for a URI
#
# @param key1 [Symbol]
# @param key2 [Symbol]
def define_uri_method(key1, key2)
define_method(key1) do
Addressable::URI.parse(@attrs[key2].chomp('#')) unless @attrs[key2].nil?
end
memoize(key1)
end
# Dynamically define a method for an attribute
#
# @param key1 [Symbol]
# @param klass [Symbol]
# @param key2 [Symbol]
def define_attribute_method(key1, klass = nil, key2 = nil)
define_method(key1) do
if attr_falsey_or_empty?(key1)
NullObject.new
else
klass.nil? ? @attrs[key1] : Twitter.const_get(klass).new(attrs_for_object(key1, key2))
end
end
memoize(key1)
end
# Dynamically define a predicate method for an attribute
#
# @param key1 [Symbol]
# @param key2 [Symbol]
def define_predicate_method(key1, key2 = key1)
define_method(:"#{key1}?") do
!attr_falsey_or_empty?(key2)
end
memoize(:"#{key1}?")
end
end
# Initializes a new object
#
# @param attrs [Hash]
# @return [Twitter::Base]
def initialize(attrs = {})
@attrs = attrs || {}
end
# Fetches an attribute of an object using hash notation
#
# @param method [String, Symbol] Message to send to the object
def [](method)
warn "#{Kernel.caller.first}: [DEPRECATION] #[#{method.inspect}] is deprecated. Use ##{method} to fetch the value."
send(method.to_sym)
rescue NoMethodError
nil
end
private
def attr_falsey_or_empty?(key)
!@attrs[key] || @attrs[key].respond_to?(:empty?) && @attrs[key].empty?
end
def attrs_for_object(key1, key2 = nil)
if key2.nil?
@attrs[key1]
else
attrs = @attrs.dup
attrs.delete(key1).merge(key2 => attrs)
end
end
end
end
twitter-6.2.0/lib/twitter/basic_user.rb 0000664 0000000 0000000 00000000314 13200674762 0020142 0 ustar 00root root 0000000 0000000 require 'twitter/identity'
require 'twitter/utils'
module Twitter
class BasicUser < Twitter::Identity
# @return [String]
attr_reader :screen_name
predicate_attr_reader :following
end
end
twitter-6.2.0/lib/twitter/client.rb 0000664 0000000 0000000 00000002227 13200674762 0017306 0 ustar 00root root 0000000 0000000 require 'twitter/error'
require 'twitter/utils'
require 'twitter/version'
module Twitter
class Client
include Twitter::Utils
attr_accessor :access_token, :access_token_secret, :consumer_key, :consumer_secret, :proxy, :timeouts
attr_writer :user_agent
# Initializes a new Client object
#
# @param options [Hash]
# @return [Twitter::Client]
def initialize(options = {})
options.each do |key, value|
instance_variable_set("@#{key}", value)
end
yield(self) if block_given?
end
# @return [Boolean]
def user_token?
!(blank?(access_token) || blank?(access_token_secret))
end
# @return [String]
def user_agent
@user_agent ||= "TwitterRubyGem/#{Twitter::Version}"
end
# @return [Hash]
def credentials
{
consumer_key: consumer_key,
consumer_secret: consumer_secret,
token: access_token,
token_secret: access_token_secret,
}
end
# @return [Boolean]
def credentials?
credentials.values.none? { |v| blank?(v) }
end
private
def blank?(s)
s.respond_to?(:empty?) ? s.empty? : !s
end
end
end
twitter-6.2.0/lib/twitter/configuration.rb 0000664 0000000 0000000 00000001414 13200674762 0020674 0 ustar 00root root 0000000 0000000 require 'memoizable'
require 'twitter/base'
module Twitter
class Configuration < Twitter::Base
include Memoizable
# @return [Array]
attr_reader :non_username_paths
# @return [Integer]
attr_reader :characters_reserved_per_media, :dm_text_character_limit,
:max_media_per_upload, :photo_size_limit, :short_url_length,
:short_url_length_https
alias short_uri_length short_url_length
alias short_uri_length_https short_url_length_https
# Returns an array of photo sizes
#
# @return [Array]
def photo_sizes
@attrs.fetch(:photo_sizes, []).each_with_object({}) do |(key, value), object|
object[key] = Size.new(value)
end
end
memoize :photo_sizes
end
end
twitter-6.2.0/lib/twitter/creatable.rb 0000664 0000000 0000000 00000000627 13200674762 0017754 0 ustar 00root root 0000000 0000000 require 'time'
require 'memoizable'
module Twitter
module Creatable
include Memoizable
# Time when the object was created on Twitter
#
# @return [Time]
def created_at
Time.parse(@attrs[:created_at]).utc unless @attrs[:created_at].nil?
end
memoize :created_at
# @return [Boolean]
def created?
!!@attrs[:created_at]
end
memoize :created?
end
end
twitter-6.2.0/lib/twitter/cursor.rb 0000664 0000000 0000000 00000002655 13200674762 0017352 0 ustar 00root root 0000000 0000000 require 'twitter/enumerable'
require 'twitter/rest/request'
require 'twitter/utils'
module Twitter
class Cursor
include Twitter::Enumerable
include Twitter::Utils
# @return [Hash]
attr_reader :attrs
alias to_h attrs
alias to_hash to_h
# Initializes a new Cursor
#
# @param key [String, Symbol] The key to fetch the data from the response
# @param klass [Class] The class to instantiate objects in the response
# @param request [Twitter::REST::Request]
# @return [Twitter::Cursor]
def initialize(key, klass, request)
@key = key.to_sym
@klass = klass
@client = request.client
@request_method = request.verb
@path = request.path
@options = request.options
@collection = []
self.attrs = request.perform
end
private
# @return [Integer]
def next_cursor
@attrs[:next_cursor] || -1
end
alias next next_cursor
# @return [Boolean]
def last?
next_cursor.zero?
end
# @return [Hash]
def fetch_next_page
response = Twitter::REST::Request.new(@client, @request_method, @path, @options.merge(cursor: next_cursor)).perform
self.attrs = response
end
# @param attrs [Hash]
# @return [Hash]
def attrs=(attrs)
@attrs = attrs
@attrs.fetch(@key, []).each do |element|
@collection << (@klass ? @klass.new(element) : element)
end
@attrs
end
end
end
twitter-6.2.0/lib/twitter/direct_message.rb 0000664 0000000 0000000 00000000550 13200674762 0021003 0 ustar 00root root 0000000 0000000 require 'twitter/creatable'
require 'twitter/entities'
require 'twitter/identity'
module Twitter
class DirectMessage < Twitter::Identity
include Twitter::Creatable
include Twitter::Entities
# @return [String]
attr_reader :text
alias full_text text
object_attr_reader :User, :recipient
object_attr_reader :User, :sender
end
end
twitter-6.2.0/lib/twitter/entities.rb 0000664 0000000 0000000 00000004421 13200674762 0017652 0 ustar 00root root 0000000 0000000 require 'memoizable'
require 'twitter/entity/hashtag'
require 'twitter/entity/symbol'
require 'twitter/entity/uri'
require 'twitter/entity/user_mention'
require 'twitter/media_factory'
module Twitter
module Entities
include Memoizable
# @return [Boolean]
def entities?
!@attrs[:entities].nil? && @attrs[:entities].any? { |_, array| array.any? }
end
memoize :entities?
# @note Must include entities in your request for this method to work
# @return [Array]
def hashtags
entities(Entity::Hashtag, :hashtags)
end
memoize :hashtags
# @return [Boolean]
def hashtags?
hashtags.any?
end
memoize :hashtags?
# @note Must include entities in your request for this method to work
# @return [Array]
def media
extended_entities = entities(MediaFactory, :media, :extended_entities)
extended_entities.empty? ? entities(MediaFactory, :media) : extended_entities
end
memoize :media
# @return [Boolean]
def media?
media.any?
end
memoize :media?
# @note Must include entities in your request for this method to work
# @return [Array]
def symbols
entities(Entity::Symbol, :symbols)
end
memoize :symbols
# @return [Boolean]
def symbols?
symbols.any?
end
memoize :symbols?
# @note Must include entities in your request for this method to work
# @return [Array]
def uris
entities(Entity::URI, :urls)
end
memoize :uris
alias urls uris
# @return [Boolean]
def uris?
uris.any?
end
alias urls? uris?
# @note Must include entities in your request for this method to work
# @return [Array]
def user_mentions
entities(Entity::UserMention, :user_mentions)
end
memoize :user_mentions
# @return [Boolean]
def user_mentions?
user_mentions.any?
end
memoize :user_mentions?
private
# @param klass [Class]
# @param key2 [Symbol]
# @param key1 [Symbol]
def entities(klass, key2, key1 = :entities)
@attrs.fetch(key1.to_sym, {}).fetch(key2.to_sym, []).collect do |entity|
klass.new(entity)
end
end
end
end
twitter-6.2.0/lib/twitter/entity.rb 0000664 0000000 0000000 00000000210 13200674762 0017332 0 ustar 00root root 0000000 0000000 require 'twitter/base'
module Twitter
class Entity < Twitter::Base
# @return [Array]
attr_reader :indices
end
end
twitter-6.2.0/lib/twitter/entity/ 0000775 0000000 0000000 00000000000 13200674762 0017014 5 ustar 00root root 0000000 0000000 twitter-6.2.0/lib/twitter/entity/hashtag.rb 0000664 0000000 0000000 00000000237 13200674762 0020762 0 ustar 00root root 0000000 0000000 require 'twitter/entity'
module Twitter
class Entity
class Hashtag < Twitter::Entity
# @return [String]
attr_reader :text
end
end
end
twitter-6.2.0/lib/twitter/entity/symbol.rb 0000664 0000000 0000000 00000000236 13200674762 0020647 0 ustar 00root root 0000000 0000000 require 'twitter/entity'
module Twitter
class Entity
class Symbol < Twitter::Entity
# @return [String]
attr_reader :text
end
end
end
twitter-6.2.0/lib/twitter/entity/uri.rb 0000664 0000000 0000000 00000000262 13200674762 0020140 0 ustar 00root root 0000000 0000000 require 'twitter/entity'
module Twitter
class Entity
class URI < Twitter::Entity
display_uri_attr_reader
uri_attr_reader :expanded_uri, :uri
end
end
end
twitter-6.2.0/lib/twitter/entity/user_mention.rb 0000664 0000000 0000000 00000000341 13200674762 0022046 0 ustar 00root root 0000000 0000000 require 'twitter/entity'
module Twitter
class Entity
class UserMention < Twitter::Entity
# @return [Integer]
attr_reader :id
# @return [String]
attr_reader :name, :screen_name
end
end
end
twitter-6.2.0/lib/twitter/enumerable.rb 0000664 0000000 0000000 00000000742 13200674762 0020147 0 ustar 00root root 0000000 0000000 module Twitter
module Enumerable
include ::Enumerable
# @return [Enumerator]
def each(start = 0)
return to_enum(:each, start) unless block_given?
Array(@collection[start..-1]).each do |element|
yield(element)
end
unless last?
start = [@collection.size, start].max
fetch_next_page
each(start, &Proc.new)
end
self
end
private
# @return [Boolean]
def last?
true
end
end
end
twitter-6.2.0/lib/twitter/error.rb 0000664 0000000 0000000 00000012100 13200674762 0017150 0 ustar 00root root 0000000 0000000 require 'twitter/rate_limit'
module Twitter
# Custom error class for rescuing from all Twitter errors
class Error < StandardError
# @return [Integer]
attr_reader :code
# @return [Twitter::RateLimit]
attr_reader :rate_limit
# Raised when Twitter returns a 4xx HTTP status code
ClientError = Class.new(self)
# Raised when Twitter returns the HTTP status code 400
BadRequest = Class.new(ClientError)
# Raised when Twitter returns the HTTP status code 401
Unauthorized = Class.new(ClientError)
# Raised when Twitter returns the HTTP status code 403
Forbidden = Class.new(ClientError)
# Raised when Twitter returns the HTTP status code 413
RequestEntityTooLarge = Class.new(ClientError)
# Raised when a Tweet has already been favorited
AlreadyFavorited = Class.new(Forbidden)
# Raised when a Tweet has already been retweeted
AlreadyRetweeted = Class.new(Forbidden)
# Raised when a Tweet has already been posted
DuplicateStatus = Class.new(Forbidden)
# Raised when Twitter returns the HTTP status code 404
NotFound = Class.new(ClientError)
# Raised when Twitter returns the HTTP status code 406
NotAcceptable = Class.new(ClientError)
# Raised when Twitter returns the HTTP status code 422
UnprocessableEntity = Class.new(ClientError)
# Raised when Twitter returns the HTTP status code 429
TooManyRequests = Class.new(ClientError)
# Raised when Twitter returns a 5xx HTTP status code
ServerError = Class.new(self)
# Raised when Twitter returns the HTTP status code 500
InternalServerError = Class.new(ServerError)
# Raised when Twitter returns the HTTP status code 502
BadGateway = Class.new(ServerError)
# Raised when Twitter returns the HTTP status code 503
ServiceUnavailable = Class.new(ServerError)
# Raised when Twitter returns the HTTP status code 504
GatewayTimeout = Class.new(ServerError)
ERRORS = {
400 => Twitter::Error::BadRequest,
401 => Twitter::Error::Unauthorized,
403 => Twitter::Error::Forbidden,
404 => Twitter::Error::NotFound,
406 => Twitter::Error::NotAcceptable,
413 => Twitter::Error::RequestEntityTooLarge,
422 => Twitter::Error::UnprocessableEntity,
429 => Twitter::Error::TooManyRequests,
500 => Twitter::Error::InternalServerError,
502 => Twitter::Error::BadGateway,
503 => Twitter::Error::ServiceUnavailable,
504 => Twitter::Error::GatewayTimeout,
}.freeze
FORBIDDEN_MESSAGES = {
'Status is a duplicate.' => Twitter::Error::DuplicateStatus,
'You have already favorited this status.' => Twitter::Error::AlreadyFavorited,
'You have already retweeted this tweet.' => Twitter::Error::AlreadyRetweeted,
'sharing is not permissible for this status (Share validations failed)' => Twitter::Error::AlreadyRetweeted,
}.freeze
# If error code is missing see https://dev.twitter.com/overview/api/response-codes
module Code
AUTHENTICATION_PROBLEM = 32
RESOURCE_NOT_FOUND = 34
SUSPENDED_ACCOUNT = 64
DEPRECATED_CALL = 68
RATE_LIMIT_EXCEEDED = 88
INVALID_OR_EXPIRED_TOKEN = 89
SSL_REQUIRED = 92
UNABLE_TO_VERIFY_CREDENTIALS = 99
OVER_CAPACITY = 130
INTERNAL_ERROR = 131
OAUTH_TIMESTAMP_OUT_OF_RANGE = 135
ALREADY_FAVORITED = 139
FOLLOW_ALREADY_REQUESTED = 160
FOLLOW_LIMIT_EXCEEDED = 161
PROTECTED_STATUS = 179
OVER_UPDATE_LIMIT = 185
DUPLICATE_STATUS = 187
BAD_AUTHENTICATION_DATA = 215
SPAM = 226
LOGIN_VERIFICATION_NEEDED = 231
ENDPOINT_RETIRED = 251
CANNOT_WRITE = 261
CANNOT_MUTE = 271
CANNOT_UNMUTE = 272
end
class << self
include Twitter::Utils
# Create a new error from an HTTP response
#
# @param body [String]
# @param headers [Hash]
# @return [Twitter::Error]
def from_response(body, headers)
message, code = parse_error(body)
new(message, headers, code)
end
private
def parse_error(body)
if body.nil? || body.empty?
['', nil]
elsif body[:error]
[body[:error], nil]
elsif body[:errors]
extract_message_from_errors(body)
end
end
def extract_message_from_errors(body)
first = Array(body[:errors]).first
if first.is_a?(Hash)
[first[:message].chomp, first[:code]]
else
[first.chomp, nil]
end
end
end
# Initializes a new Error object
#
# @param message [Exception, String]
# @param rate_limit [Hash]
# @param code [Integer]
# @return [Twitter::Error]
def initialize(message = '', rate_limit = {}, code = nil)
super(message)
@rate_limit = Twitter::RateLimit.new(rate_limit)
@code = code
end
end
end
twitter-6.2.0/lib/twitter/factory.rb 0000664 0000000 0000000 00000001007 13200674762 0017472 0 ustar 00root root 0000000 0000000 module Twitter
class Factory
class << self
# Construct a new object
#
# @param method [Symbol]
# @param klass [Class]
# @param attrs [Hash]
# @raise [IndexError] Error raised when supplied argument is missing a key.
# @return [Twitter::Base]
def new(method, klass, attrs = {})
type = attrs.fetch(method.to_sym)
const_name = type.split('_').collect(&:capitalize).join
klass.const_get(const_name.to_sym).new(attrs)
end
end
end
end
twitter-6.2.0/lib/twitter/geo.rb 0000664 0000000 0000000 00000000340 13200674762 0016574 0 ustar 00root root 0000000 0000000 require 'equalizer'
require 'twitter/base'
module Twitter
class Geo < Twitter::Base
include Equalizer.new(:coordinates)
# @return [Array]
attr_reader :coordinates
alias coords coordinates
end
end
twitter-6.2.0/lib/twitter/geo/ 0000775 0000000 0000000 00000000000 13200674762 0016252 5 ustar 00root root 0000000 0000000 twitter-6.2.0/lib/twitter/geo/point.rb 0000664 0000000 0000000 00000000517 13200674762 0017733 0 ustar 00root root 0000000 0000000 require 'twitter/geo'
module Twitter
class Geo
class Point < Twitter::Geo
# @return [Integer]
def latitude
coordinates[0]
end
alias lat latitude
# @return [Integer]
def longitude
coordinates[1]
end
alias long longitude
alias lng longitude
end
end
end
twitter-6.2.0/lib/twitter/geo/polygon.rb 0000664 0000000 0000000 00000000145 13200674762 0020266 0 ustar 00root root 0000000 0000000 require 'twitter/geo'
module Twitter
class Geo
class Polygon < Twitter::Geo
end
end
end
twitter-6.2.0/lib/twitter/geo_factory.rb 0000664 0000000 0000000 00000000661 13200674762 0020331 0 ustar 00root root 0000000 0000000 require 'twitter/factory'
require 'twitter/geo/point'
require 'twitter/geo/polygon'
module Twitter
class GeoFactory < Twitter::Factory
class << self
# Construct a new geo object
#
# @param attrs [Hash]
# @raise [IndexError] Error raised when supplied argument is missing a :type key.
# @return [Twitter::Geo]
def new(attrs = {})
super(:type, Geo, attrs)
end
end
end
end
twitter-6.2.0/lib/twitter/geo_results.rb 0000664 0000000 0000000 00000001120 13200674762 0020352 0 ustar 00root root 0000000 0000000 require 'twitter/enumerable'
require 'twitter/utils'
module Twitter
class GeoResults
include Twitter::Enumerable
include Twitter::Utils
# @return [Hash]
attr_reader :attrs
alias to_h attrs
alias to_hash to_h
# Initializes a new GeoResults object
#
# @param attrs [Hash]
# @return [Twitter::GeoResults]
def initialize(attrs = {})
@attrs = attrs
@collection = @attrs[:result].fetch(:places, []).collect do |place|
Place.new(place)
end
end
# @return [String]
def token
@attrs[:token]
end
end
end
twitter-6.2.0/lib/twitter/headers.rb 0000664 0000000 0000000 00000002715 13200674762 0017445 0 ustar 00root root 0000000 0000000 require 'addressable/uri'
require 'base64'
require 'simple_oauth'
module Twitter
class Headers
def initialize(client, request_method, url, options = {})
@client = client
@request_method = request_method.to_sym
@uri = Addressable::URI.parse(url)
@bearer_token_request = options.delete(:bearer_token_request)
@options = options
end
def bearer_token_request?
!!@bearer_token_request
end
def oauth_auth_header
SimpleOAuth::Header.new(@request_method, @uri, @options, @client.credentials.merge(ignore_extra_keys: true))
end
def request_headers
headers = {}
headers[:user_agent] = @client.user_agent
if bearer_token_request?
headers[:accept] = '*/*'
headers[:authorization] = bearer_token_credentials_auth_header
else
headers[:authorization] = auth_header
end
headers
end
private
def auth_header
if @client.user_token?
oauth_auth_header.to_s
else
@client.bearer_token = @client.token unless @client.bearer_token?
bearer_auth_header
end
end
# @return [String]
def bearer_auth_header
"Bearer #{@client.bearer_token}"
end
# Generates authentication header for a bearer token request
#
# @return [String]
def bearer_token_credentials_auth_header
"Basic #{Base64.strict_encode64("#{@client.consumer_key}:#{@client.consumer_secret}")}"
end
end
end
twitter-6.2.0/lib/twitter/identity.rb 0000664 0000000 0000000 00000000665 13200674762 0017665 0 ustar 00root root 0000000 0000000 require 'equalizer'
require 'twitter/base'
module Twitter
class Identity < Twitter::Base
include Equalizer.new(:id)
# @return [Integer]
attr_reader :id
# Initializes a new object
#
# @param attrs [Hash]
# @raise [ArgumentError] Error raised when supplied argument is missing an :id key.
# @return [Twitter::Identity]
def initialize(attrs = {})
attrs.fetch(:id)
super
end
end
end
twitter-6.2.0/lib/twitter/language.rb 0000664 0000000 0000000 00000000217 13200674762 0017610 0 ustar 00root root 0000000 0000000 require 'twitter/base'
module Twitter
class Language < Twitter::Base
# @return [String]
attr_reader :code, :name, :status
end
end
twitter-6.2.0/lib/twitter/list.rb 0000664 0000000 0000000 00000002072 13200674762 0017001 0 ustar 00root root 0000000 0000000 require 'twitter/creatable'
require 'twitter/identity'
module Twitter
class List < Twitter::Identity
include Twitter::Creatable
# @return [Integer]
attr_reader :member_count, :subscriber_count
# @return [String]
attr_reader :description, :full_name, :mode, :name, :slug
object_attr_reader :User, :user
predicate_attr_reader :following
# @return [Addressable::URI] The URI to the list members.
def members_uri
Addressable::URI.parse("#{uri}/members") if uri?
end
memoize :members_uri
alias members_url members_uri
# @return [Addressable::URI] The URI to the list subscribers.
def subscribers_uri
Addressable::URI.parse("#{uri}/subscribers") if uri?
end
memoize :subscribers_uri
alias subscribers_url subscribers_uri
# @return [Addressable::URI] The URI to the list.
def uri
Addressable::URI.parse("https://twitter.com/#{user.screen_name}/#{slug}") if slug? && user.screen_name?
end
memoize :uri
alias url uri
def uri?
!!uri
end
memoize :uri?
end
end
twitter-6.2.0/lib/twitter/media/ 0000775 0000000 0000000 00000000000 13200674762 0016557 5 ustar 00root root 0000000 0000000 twitter-6.2.0/lib/twitter/media/animated_gif.rb 0000664 0000000 0000000 00000000155 13200674762 0021514 0 ustar 00root root 0000000 0000000 require 'twitter/media/video'
module Twitter
module Media
class AnimatedGif < Video
end
end
end
twitter-6.2.0/lib/twitter/media/photo.rb 0000664 0000000 0000000 00000001177 13200674762 0020243 0 ustar 00root root 0000000 0000000 require 'memoizable'
require 'twitter/identity'
module Twitter
module Media
class Photo < Twitter::Identity
include Memoizable
# @return [Array]
attr_reader :indices
# @return [String]
attr_reader :type
display_uri_attr_reader
uri_attr_reader :expanded_uri, :media_uri, :media_uri_https, :uri
# Returns an array of photo sizes
#
# @return [Array]
def sizes
@attrs.fetch(:sizes, []).each_with_object({}) do |(key, value), object|
object[key] = Size.new(value)
end
end
memoize :sizes
end
end
end
twitter-6.2.0/lib/twitter/media/video.rb 0000664 0000000 0000000 00000001566 13200674762 0020222 0 ustar 00root root 0000000 0000000 require 'memoizable'
require 'twitter/identity'
require 'twitter/media/video_info'
module Twitter
module Media
class Video < Twitter::Identity
include Memoizable
# @return [Array]
attr_reader :indices
# @return [String]
attr_reader :type
display_uri_attr_reader
uri_attr_reader :expanded_uri, :media_uri, :media_uri_https, :uri
# Returns an array of photo sizes
#
# @return [Array]
def sizes
@attrs.fetch(:sizes, []).each_with_object({}) do |(key, value), object|
object[key] = Size.new(value)
end
end
memoize :sizes
# Returns video info
#
# @return [Twitter::Media::VideoInfo]
def video_info
VideoInfo.new(@attrs[:video_info]) unless @attrs[:video_info].nil?
end
memoize :video_info
end
end
end
twitter-6.2.0/lib/twitter/media/video_info.rb 0000664 0000000 0000000 00000001023 13200674762 0021221 0 ustar 00root root 0000000 0000000 require 'memoizable'
require 'twitter/variant'
module Twitter
module Media
class VideoInfo < Twitter::Base
include Memoizable
# @return [Array]
def variants
@attrs.fetch(:variants, []).collect do |variant|
Variant.new(variant)
end
end
memoize :variants
end
end
end
twitter-6.2.0/lib/twitter/media_factory.rb 0000664 0000000 0000000 00000000740 13200674762 0020634 0 ustar 00root root 0000000 0000000 require 'twitter/factory'
require 'twitter/media/animated_gif'
require 'twitter/media/photo'
require 'twitter/media/video'
module Twitter
class MediaFactory < Twitter::Factory
class << self
# Construct a new media object
#
# @param attrs [Hash]
# @raise [IndexError] Error raised when supplied argument is missing a :type key.
# @return [Twitter::Media]
def new(attrs = {})
super(:type, Media, attrs)
end
end
end
end
twitter-6.2.0/lib/twitter/metadata.rb 0000664 0000000 0000000 00000000232 13200674762 0017602 0 ustar 00root root 0000000 0000000 require 'twitter/base'
module Twitter
class Metadata < Twitter::Base
# @return [String]
attr_reader :iso_language_code, :result_type
end
end
twitter-6.2.0/lib/twitter/null_object.rb 0000664 0000000 0000000 00000001551 13200674762 0020327 0 ustar 00root root 0000000 0000000 require 'naught'
module Twitter
NullObject = Naught.build do |config|
include Comparable
config.black_hole
config.define_explicit_conversions
config.define_implicit_conversions
config.predicates_return false
def !
true
end
def respond_to?(*)
true
end
def instance_of?(klass)
raise(TypeError, 'class or module required') unless klass.is_a?(Class)
self.class == klass
end
def kind_of?(mod)
raise(TypeError, 'class or module required') unless mod.is_a?(Module)
self.class.ancestors.include?(mod)
end
alias_method :is_a?, :kind_of?
def <=>(other)
if other.is_a?(self.class)
0
else
-1
end
end
def nil?
true
end
def as_json(*)
'null'
end
def to_json(*args)
nil.to_json(*args)
end
end
end
twitter-6.2.0/lib/twitter/oembed.rb 0000664 0000000 0000000 00000000465 13200674762 0017265 0 ustar 00root root 0000000 0000000 require 'twitter/base'
module Twitter
class OEmbed < Twitter::Base
# @return [Integer]
attr_reader :height, :width
# @return [String]
attr_reader :author_name, :cache_age, :html, :provider_name, :type,
:version
uri_attr_reader :author_uri, :provider_uri, :uri
end
end
twitter-6.2.0/lib/twitter/place.rb 0000664 0000000 0000000 00000002123 13200674762 0017107 0 ustar 00root root 0000000 0000000 require 'memoizable'
require 'twitter/identity'
module Twitter
class Place < Twitter::Identity
include Memoizable
# @return [Hash]
attr_reader :attributes
# @return [String]
attr_reader :country, :full_name, :name
alias woe_id id
alias woeid id
object_attr_reader :GeoFactory, :bounding_box
object_attr_reader :Place, :contained_within
alias contained? contained_within?
uri_attr_reader :uri
# Initializes a new place
#
# @param attrs [Hash]
# @raise [ArgumentError] Error raised when supplied argument is missing a :woeid key.
# @return [Twitter::Place]
def initialize(attrs = {})
attrs[:id] ||= attrs.fetch(:woeid)
super
end
# @return [String]
def country_code
@attrs[:country_code] || @attrs[:countryCode]
end
memoize :country_code
# @return [Integer]
def parent_id
@attrs[:parentid]
end
memoize :parent_id
# @return [String]
def place_type
@attrs[:place_type] || @attrs[:placeType] && @attrs[:placeType][:name]
end
memoize :place_type
end
end
twitter-6.2.0/lib/twitter/profile.rb 0000664 0000000 0000000 00000006646 13200674762 0017501 0 ustar 00root root 0000000 0000000 require 'addressable/uri'
require 'cgi'
require 'memoizable'
module Twitter
module Profile
PROFILE_IMAGE_SUFFIX_REGEX = /_normal(\.gif|\.jpe?g|\.png)$/i
PREDICATE_URI_METHOD_REGEX = /_uri\?$/
include Memoizable
class << self
private
def alias_predicate_uri_methods(method)
%w[_url? _uri_https? _url_https?].each do |replacement|
alias_method_sub(method, PREDICATE_URI_METHOD_REGEX, replacement)
end
end
def alias_method_sub(method, pattern, replacement)
alias_method(method.to_s.sub(pattern, replacement).to_sym, method)
end
end
# Return the URL to the user's profile banner image
#
# @param size [String, Symbol] The size of the image. Must be one of: 'mobile', 'mobile_retina', 'web', 'web_retina', 'ipad', or 'ipad_retina'
# @return [Addressable::URI]
def profile_banner_uri(size = :web)
parse_uri(insecure_uri([@attrs[:profile_banner_url], size].join('/'))) unless @attrs[:profile_banner_url].nil?
end
alias profile_banner_url profile_banner_uri
# Return the secure URL to the user's profile banner image
#
# @param size [String, Symbol] The size of the image. Must be one of: 'mobile', 'mobile_retina', 'web', 'web_retina', 'ipad', or 'ipad_retina'
# @return [Addressable::URI]
def profile_banner_uri_https(size = :web)
parse_uri([@attrs[:profile_banner_url], size].join('/')) unless @attrs[:profile_banner_url].nil?
end
alias profile_banner_url_https profile_banner_uri_https
# @return [Boolean]
def profile_banner_uri?
!!@attrs[:profile_banner_url]
end
memoize :profile_banner_uri?
alias_predicate_uri_methods :profile_banner_uri?
# Return the URL to the user's profile image
#
# @param size [String, Symbol] The size of the image. Must be one of: 'mini', 'normal', 'bigger' or 'original'
# @return [Addressable::URI]
def profile_image_uri(size = :normal)
parse_uri(insecure_uri(profile_image_uri_https(size))) unless @attrs[:profile_image_url_https].nil?
end
alias profile_image_url profile_image_uri
# Return the secure URL to the user's profile image
#
# @param size [String, Symbol] The size of the image. Must be one of: 'mini', 'normal', 'bigger' or 'original'
# @return [Addressable::URI]
def profile_image_uri_https(size = :normal)
# The profile image URL comes in looking like like this:
# https://a0.twimg.com/profile_images/1759857427/image1326743606_normal.png
# It can be converted to any of the following sizes:
# https://a0.twimg.com/profile_images/1759857427/image1326743606.png
# https://a0.twimg.com/profile_images/1759857427/image1326743606_mini.png
# https://a0.twimg.com/profile_images/1759857427/image1326743606_bigger.png
parse_uri(@attrs[:profile_image_url_https].sub(PROFILE_IMAGE_SUFFIX_REGEX, profile_image_suffix(size))) unless @attrs[:profile_image_url_https].nil?
end
alias profile_image_url_https profile_image_uri_https
# @return [Boolean]
def profile_image_uri?
!!@attrs[:profile_image_url_https]
end
memoize :profile_image_uri?
alias_predicate_uri_methods :profile_image_uri?
private
def parse_uri(uri)
Addressable::URI.parse(uri)
end
def insecure_uri(uri)
uri.to_s.sub(/^https/i, 'http')
end
def profile_image_suffix(size)
size.to_sym == :original ? '\\1' : "_#{size}\\1"
end
end
end
twitter-6.2.0/lib/twitter/profile_banner.rb 0000664 0000000 0000000 00000000574 13200674762 0021020 0 ustar 00root root 0000000 0000000 require 'memoizable'
require 'twitter/base'
module Twitter
class ProfileBanner < Twitter::Base
include Memoizable
# Returns an array of photo sizes
#
# @return [Array]
def sizes
@attrs.fetch(:sizes, []).each_with_object({}) do |(key, value), object|
object[key] = Size.new(value)
end
end
memoize :sizes
end
end
twitter-6.2.0/lib/twitter/rate_limit.rb 0000664 0000000 0000000 00000001254 13200674762 0020160 0 ustar 00root root 0000000 0000000 require 'memoizable'
module Twitter
class RateLimit < Twitter::Base
include Memoizable
# @return [Integer]
def limit
limit = @attrs['x-rate-limit-limit']
limit.to_i if limit
end
memoize :limit
# @return [Integer]
def remaining
remaining = @attrs['x-rate-limit-remaining']
remaining.to_i if remaining
end
memoize :remaining
# @return [Time]
def reset_at
reset = @attrs['x-rate-limit-reset']
Time.at(reset.to_i).utc if reset
end
memoize :reset_at
# @return [Integer]
def reset_in
[(reset_at - Time.now).ceil, 0].max if reset_at
end
alias retry_after reset_in
end
end
twitter-6.2.0/lib/twitter/relationship.rb 0000664 0000000 0000000 00000000537 13200674762 0020533 0 ustar 00root root 0000000 0000000 require 'twitter/base'
module Twitter
class Relationship < Twitter::Base
object_attr_reader :SourceUser, :source
object_attr_reader :TargetUser, :target
# Initializes a new object
#
# @param attrs [Hash]
# @return [Twitter::Relationship]
def initialize(attrs = {})
@attrs = attrs[:relationship]
end
end
end
twitter-6.2.0/lib/twitter/rest/ 0000775 0000000 0000000 00000000000 13200674762 0016455 5 ustar 00root root 0000000 0000000 twitter-6.2.0/lib/twitter/rest/api.rb 0000664 0000000 0000000 00000002710 13200674762 0017553 0 ustar 00root root 0000000 0000000 require 'twitter/rest/direct_messages'
require 'twitter/rest/favorites'
require 'twitter/rest/friends_and_followers'
require 'twitter/rest/help'
require 'twitter/rest/lists'
require 'twitter/rest/oauth'
require 'twitter/rest/places_and_geo'
require 'twitter/rest/saved_searches'
require 'twitter/rest/search'
require 'twitter/rest/spam_reporting'
require 'twitter/rest/suggested_users'
require 'twitter/rest/timelines'
require 'twitter/rest/trends'
require 'twitter/rest/tweets'
require 'twitter/rest/undocumented'
require 'twitter/rest/users'
module Twitter
module REST
# @note All methods have been separated into modules and follow the same grouping used in {http://dev.twitter.com/doc the Twitter API Documentation}.
# @see https://dev.twitter.com/overview/general/things-every-developer-should-know
module API
include Twitter::REST::DirectMessages
include Twitter::REST::Favorites
include Twitter::REST::FriendsAndFollowers
include Twitter::REST::Help
include Twitter::REST::Lists
include Twitter::REST::OAuth
include Twitter::REST::PlacesAndGeo
include Twitter::REST::SavedSearches
include Twitter::REST::Search
include Twitter::REST::SpamReporting
include Twitter::REST::SuggestedUsers
include Twitter::REST::Timelines
include Twitter::REST::Trends
include Twitter::REST::Tweets
include Twitter::REST::Undocumented
include Twitter::REST::Users
end
end
end
twitter-6.2.0/lib/twitter/rest/client.rb 0000664 0000000 0000000 00000000665 13200674762 0020267 0 ustar 00root root 0000000 0000000 require 'twitter/client'
require 'twitter/rest/api'
require 'twitter/rest/request'
require 'twitter/rest/utils'
module Twitter
module REST
class Client < Twitter::Client
include Twitter::REST::API
attr_accessor :bearer_token
# @return [Boolean]
def bearer_token?
!!bearer_token
end
# @return [Boolean]
def credentials?
super || bearer_token?
end
end
end
end
twitter-6.2.0/lib/twitter/rest/direct_messages.rb 0000664 0000000 0000000 00000017126 13200674762 0022152 0 ustar 00root root 0000000 0000000 require 'twitter/arguments'
require 'twitter/direct_message'
require 'twitter/rest/utils'
require 'twitter/user'
require 'twitter/utils'
module Twitter
module REST
module DirectMessages
include Twitter::REST::Utils
include Twitter::Utils
# Returns the 20 most recent direct messages sent to the authenticating user
#
# @see https://dev.twitter.com/rest/reference/get/direct_messages
# @note This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information.
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array] Direct messages sent to the authenticating user.
# @param options [Hash] A customizable set of options.
# @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
# @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
# @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
# @option options [Integer] :page Specifies the page of results to retrieve.
def direct_messages_received(options = {})
perform_get_with_objects('/1.1/direct_messages.json', options, Twitter::DirectMessage)
end
# Returns the 20 most recent direct messages sent by the authenticating user
#
# @see https://dev.twitter.com/rest/reference/get/direct_messages/sent
# @note This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information.
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array] Direct messages sent by the authenticating user.
# @param options [Hash] A customizable set of options.
# @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
# @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
# @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
# @option options [Integer] :page Specifies the page of results to retrieve.
def direct_messages_sent(options = {})
perform_get_with_objects('/1.1/direct_messages/sent.json', options, Twitter::DirectMessage)
end
# Returns a direct message
#
# @see https://dev.twitter.com/rest/reference/get/direct_messages/show
# @note This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information.
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::DirectMessage] The requested messages.
# @param id [Integer] A direct message ID.
# @param options [Hash] A customizable set of options.
def direct_message(id, options = {})
options = options.dup
options[:id] = id
perform_get_with_object('/1.1/direct_messages/show.json', options, Twitter::DirectMessage)
end
# @note This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information.
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array] The requested messages.
# @overload direct_messages(options = {})
# Returns the 20 most recent direct messages sent to the authenticating user
#
# @see https://dev.twitter.com/rest/reference/get/direct_messages
# @param options [Hash] A customizable set of options.
# @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
# @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
# @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
# @option options [Integer] :page Specifies the page of results to retrieve.
# @overload direct_messages(*ids)
# Returns direct messages
#
# @see https://dev.twitter.com/rest/reference/get/direct_messages/show
# @param ids [Enumerable] A collection of direct message IDs.
# @overload direct_messages(*ids, options)
# Returns direct messages
#
# @see https://dev.twitter.com/rest/reference/get/direct_messages/show
# @param ids [Enumerable] A collection of direct message IDs.
# @param options [Hash] A customizable set of options.
def direct_messages(*args)
arguments = Twitter::Arguments.new(args)
if arguments.empty?
direct_messages_received(arguments.options)
else
pmap(arguments) do |id|
direct_message(id, arguments.options)
end
end
end
# Destroys direct messages
#
# @see https://dev.twitter.com/rest/reference/post/direct_messages/destroy
# @note This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information.
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array] Deleted direct message.
# @overload destroy_direct_message(*ids)
# @param ids [Enumerable] A collection of direct message IDs.
# @overload destroy_direct_message(*ids, options)
# @param ids [Enumerable] A collection of direct message IDs.
# @param options [Hash] A customizable set of options.
def destroy_direct_message(*args)
parallel_objects_from_response(Twitter::DirectMessage, :post, '/1.1/direct_messages/destroy.json', args)
end
# Sends a new direct message to the specified user from the authenticating user
#
# @see https://dev.twitter.com/rest/reference/post/direct_messages/new
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::DirectMessage] The sent message.
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param text [String] The text of your direct message, up to 10,000 characters.
# @param options [Hash] A customizable set of options.
def create_direct_message(user, text, options = {})
options = options.dup
merge_user!(options, user)
options[:text] = text
perform_post_with_object('/1.1/direct_messages/new.json', options, Twitter::DirectMessage)
end
alias d create_direct_message
alias m create_direct_message
alias dm create_direct_message
end
end
end
twitter-6.2.0/lib/twitter/rest/favorites.rb 0000664 0000000 0000000 00000015053 13200674762 0021010 0 ustar 00root root 0000000 0000000 require 'twitter/arguments'
require 'twitter/error'
require 'twitter/rest/utils'
require 'twitter/tweet'
require 'twitter/user'
require 'twitter/utils'
module Twitter
module REST
module Favorites
include Twitter::REST::Utils
include Twitter::Utils
# @see https://dev.twitter.com/rest/reference/get/favorites/list
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array] favorite Tweets.
# @overload favorites(options = {})
# Returns the 20 most recent favorite Tweets for the authenticating user
#
# @param options [Hash] A customizable set of options.
# @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 100.
# @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
# @overload favorites(user, options = {})
# Returns the 20 most recent favorite Tweets for the specified user
#
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 100.
# @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
def favorites(*args)
arguments = Twitter::Arguments.new(args)
merge_user!(arguments.options, arguments.pop) if arguments.last
perform_get_with_objects('/1.1/favorites/list.json', arguments.options, Twitter::Tweet)
end
# Un-favorites the specified Tweets as the authenticating user
#
# @see https://dev.twitter.com/rest/reference/post/favorites/destroy
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array] The un-favorited Tweets.
# @overload unfavorite(*tweets)
# @param tweets [Enumerable] A collection of Tweet IDs, URIs, or objects.
# @overload unfavorite(*tweets, options)
# @param tweets [Enumerable] A collection of Tweet IDs, URIs, or objects.
# @param options [Hash] A customizable set of options.
def unfavorite(*args)
arguments = Twitter::Arguments.new(args)
pmap(arguments) do |tweet|
begin
perform_post_with_object('/1.1/favorites/destroy.json', arguments.options.merge(id: extract_id(tweet)), Twitter::Tweet)
rescue Twitter::Error::NotFound
next
end
end.compact
end
alias destroy_favorite unfavorite
# Un-favorites the specified Tweets as the authenticating user and raises an error if one is not found
#
# @see https://dev.twitter.com/rest/reference/post/favorites/destroy
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::NotFound] Error raised when tweet does not exist or has been deleted.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array] The un-favorited Tweets.
# @overload unfavorite!(*tweets)
# @param tweets [Enumerable] A collection of Tweet IDs, URIs, or objects.
# @overload unfavorite!(*tweets, options)
# @param tweets [Enumerable] A collection of Tweet IDs, URIs, or objects.
# @param options [Hash] A customizable set of options.
def unfavorite!(*args)
parallel_objects_from_response(Twitter::Tweet, :post, '/1.1/favorites/destroy.json', args)
end
# Favorites the specified Tweets as the authenticating user
#
# @see https://dev.twitter.com/rest/reference/post/favorites/create
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array] The favorited Tweets.
# @overload favorite(*tweets)
# @param tweets [Enumerable] A collection of Tweet IDs, URIs, or objects.
# @overload favorite(*tweets, options)
# @param tweets [Enumerable] A collection of Tweet IDs, URIs, or objects.
# @param options [Hash] A customizable set of options.
def favorite(*args)
arguments = Twitter::Arguments.new(args)
pmap(arguments) do |tweet|
begin
perform_post_with_object('/1.1/favorites/create.json', arguments.options.merge(id: extract_id(tweet)), Twitter::Tweet)
rescue Twitter::Error::AlreadyFavorited, Twitter::Error::NotFound
next
end
end.compact
end
alias fav favorite
alias fave favorite
# Favorites the specified Tweets as the authenticating user and raises an error if one has already been favorited
#
# @see https://dev.twitter.com/rest/reference/post/favorites/create
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::AlreadyFavorited] Error raised when tweet has already been favorited.
# @raise [Twitter::Error::NotFound] Error raised when tweet does not exist or has been deleted.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array] The favorited Tweets.
# @overload favorite!(*tweets)
# @param tweets [Enumerable] A collection of Tweet IDs, URIs, or objects.
# @overload favorite!(*tweets, options)
# @param tweets [Enumerable] A collection of Tweet IDs, URIs, or objects.
# @param options [Hash] A customizable set of options.
def favorite!(*args)
arguments = Twitter::Arguments.new(args)
pmap(arguments) do |tweet|
perform_post_with_object('/1.1/favorites/create.json', arguments.options.merge(id: extract_id(tweet)), Twitter::Tweet)
end
end
alias create_favorite! favorite!
alias fav! favorite!
alias fave! favorite!
end
end
end
twitter-6.2.0/lib/twitter/rest/friends_and_followers.rb 0000664 0000000 0000000 00000035150 13200674762 0023356 0 ustar 00root root 0000000 0000000 require 'twitter/arguments'
require 'twitter/cursor'
require 'twitter/relationship'
require 'twitter/rest/request'
require 'twitter/rest/utils'
require 'twitter/user'
require 'twitter/utils'
module Twitter
module REST
module FriendsAndFollowers
include Twitter::REST::Utils
include Twitter::Utils
# @see https://dev.twitter.com/rest/reference/get/friends/ids
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Cursor]
# @overload friend_ids(options = {})
# Returns an array of numeric IDs for every user the authenticated user is following
#
# @param options [Hash] A customizable set of options.
# @overload friend_ids(user, options = {})
# Returns an array of numeric IDs for every user the specified user is following
#
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param options [Hash] A customizable set of options.
def friend_ids(*args)
cursor_from_response_with_user(:ids, nil, '/1.1/friends/ids.json', args)
end
# @see https://dev.twitter.com/rest/reference/get/followers/ids
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Cursor]
# @overload follower_ids(options = {})
# Returns an array of numeric IDs for every user following the authenticated user
#
# @param options [Hash] A customizable set of options.
# @overload follower_ids(user, options = {})
# Returns an array of numeric IDs for every user following the specified user
#
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param options [Hash] A customizable set of options.
def follower_ids(*args)
cursor_from_response_with_user(:ids, nil, '/1.1/followers/ids.json', args)
end
# Returns the relationship of the authenticating user to the comma separated list of up to 100 screen_names or user_ids provided. Values for connections can be: following, following_requested, followed_by, none.
#
# @see https://dev.twitter.com/rest/reference/get/friendships/lookup
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array] The requested users.
# @overload friendships(*users)
# @param users [Enumerable] A collection of Twitter user IDs, screen names, or objects.
# @overload friendships(*users, options)
# @param users [Enumerable] A collection of Twitter user IDs, screen names, or objects.
# @param options [Hash] A customizable set of options.
def friendships(*args)
arguments = Twitter::Arguments.new(args)
merge_users!(arguments.options, arguments)
perform_get_with_objects('/1.1/friendships/lookup.json', arguments.options, Twitter::User)
end
# Returns an array of numeric IDs for every user who has a pending request to follow the authenticating user
#
# @see https://dev.twitter.com/rest/reference/get/friendships/incoming
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Cursor]
# @param options [Hash] A customizable set of options.
def friendships_incoming(options = {})
perform_get_with_cursor('/1.1/friendships/incoming.json', options, :ids)
end
# Returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request
#
# @see https://dev.twitter.com/rest/reference/get/friendships/outgoing
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Cursor]
# @param options [Hash] A customizable set of options.
def friendships_outgoing(options = {})
perform_get_with_cursor('/1.1/friendships/outgoing.json', options, :ids)
end
# Allows the authenticating user to follow the specified users, unless they are already followed
#
# @see https://dev.twitter.com/rest/reference/post/friendships/create
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array] The followed users.
# @overload follow(*users)
# @param users [Enumerable] A collection of Twitter user IDs, screen names, or objects.
# @overload follow(*users, options)
# @param users [Enumerable] A collection of Twitter user IDs, screen names, or objects.
# @param options [Hash] A customizable set of options.
# @option options [Boolean] :follow (false) Enable notifications for the target user.
def follow(*args)
arguments = Twitter::Arguments.new(args)
existing_friends = Thread.new do
friend_ids.to_a
end
new_friends = Thread.new do
users(args).collect(&:id)
end
follow!(new_friends.value - existing_friends.value, arguments.options)
end
alias create_friendship follow
# Allows the authenticating user to follow the specified users
#
# @see https://dev.twitter.com/rest/reference/post/friendships/create
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array] The followed users.
# @overload follow!(*users)
# @param users [Enumerable] A collection of Twitter user IDs, screen names, or objects.
# @overload follow!(*users, options)
# @param users [Enumerable] A collection of Twitter user IDs, screen names, or objects.
# @param options [Hash] A customizable set of options.
# @option options [Boolean] :follow (false) Enable notifications for the target user.
def follow!(*args)
arguments = Twitter::Arguments.new(args)
pmap(arguments) do |user|
perform_post_with_object('/1.1/friendships/create.json', merge_user(arguments.options, user), Twitter::User)
end.compact
end
alias create_friendship! follow!
# Allows the authenticating user to unfollow the specified users
#
# @see https://dev.twitter.com/rest/reference/post/friendships/destroy
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array] The unfollowed users.
# @overload unfollow(*users)
# @param users [Enumerable] A collection of Twitter user IDs, screen names, or objects.
# @overload unfollow(*users, options)
# @param users [Enumerable] A collection of Twitter user IDs, screen names, or objects.
# @param options [Hash] A customizable set of options.
def unfollow(*args)
parallel_users_from_response(:post, '/1.1/friendships/destroy.json', args)
end
alias destroy_friendship unfollow
# Allows one to enable or disable retweets and device notifications from the specified user.
#
# @see https://dev.twitter.com/rest/reference/post/friendships/update
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Relationship]
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Boolean] :device Enable/disable device notifications from the target user.
# @option options [Boolean] :retweets Enable/disable retweets from the target user.
def friendship_update(user, options = {})
merge_user!(options, user)
perform_post_with_object('/1.1/friendships/update.json', options, Twitter::Relationship)
end
# Returns detailed information about the relationship between two users
#
# @see https://dev.twitter.com/rest/reference/get/friendships/show
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Relationship]
# @param source [Integer, String, Twitter::User] The Twitter user ID, screen name, or object of the source user.
# @param target [Integer, String, Twitter::User] The Twitter user ID, screen name, or object of the target user.
# @param options [Hash] A customizable set of options.
def friendship(source, target, options = {})
options = options.dup
merge_user!(options, source, 'source')
options[:source_id] = options.delete(:source_user_id) unless options[:source_user_id].nil?
merge_user!(options, target, 'target')
options[:target_id] = options.delete(:target_user_id) unless options[:target_user_id].nil?
perform_get_with_object('/1.1/friendships/show.json', options, Twitter::Relationship)
end
alias friendship_show friendship
alias relationship friendship
# Test for the existence of friendship between two users
#
# @see https://dev.twitter.com/rest/reference/get/friendships/show
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Boolean] true if user_a follows user_b, otherwise false.
# @param source [Integer, String, Twitter::User] The Twitter user ID, screen name, or object of the source user.
# @param target [Integer, String, Twitter::User] The Twitter user ID, screen name, or object of the target user.
# @param options [Hash] A customizable set of options.
def friendship?(source, target, options = {})
friendship(source, target, options).source.following?
end
# Returns a cursored collection of user objects for users following the specified user.
#
# @see https://dev.twitter.com/rest/reference/get/followers/list
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Cursor]
# @overload followers(options = {})
# Returns a cursored collection of user objects for users following the authenticated user.
#
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :skip_status Do not include contributee's Tweets when set to true, 't' or 1.
# @option options [Boolean, String, Integer] :include_user_entities The user entities node will be disincluded when set to false.
# @overload followers(user, options = {})
# Returns a cursored collection of user objects for users following the specified user.
#
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :skip_status Do not include contributee's Tweets when set to true, 't' or 1.
# @option options [Boolean, String, Integer] :include_user_entities The user entities node will be disincluded when set to false.
def followers(*args)
cursor_from_response_with_user(:users, Twitter::User, '/1.1/followers/list.json', args)
end
# Returns a cursored collection of user objects for every user the specified user is following (otherwise known as their "friends").
#
# @see https://dev.twitter.com/rest/reference/get/friends/list
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Cursor]
# @overload friends(options = {})
# Returns a cursored collection of user objects for every user the authenticated user is following (otherwise known as their "friends").
#
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :skip_status Do not include contributee's Tweets when set to true, 't' or 1.
# @option options [Boolean, String, Integer] :include_user_entities The user entities node will be disincluded when set to false.
# @overload friends(user, options = {})
# Returns a cursored collection of user objects for every user the specified user is following (otherwise known as their "friends").
#
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :skip_status Do not include contributee's Tweets when set to true, 't' or 1.
# @option options [Boolean, String, Integer] :include_user_entities The user entities node will be disincluded when set to false.
def friends(*args)
cursor_from_response_with_user(:users, Twitter::User, '/1.1/friends/list.json', args)
end
alias following friends
# Returns a collection of user IDs that the currently authenticated user does not want to receive retweets from.
# @see https://dev.twitter.com/rest/reference/get/friendships/no_retweets/ids
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array]
# @param options [Hash] A customizable set of options.
def no_retweet_ids(options = {})
perform_get('/1.1/friendships/no_retweets/ids.json', options).collect(&:to_i)
end
alias no_retweets_ids no_retweet_ids
end
end
end
twitter-6.2.0/lib/twitter/rest/help.rb 0000664 0000000 0000000 00000004132 13200674762 0017732 0 ustar 00root root 0000000 0000000 require 'twitter/configuration'
require 'twitter/language'
require 'twitter/rest/request'
require 'twitter/rest/utils'
module Twitter
module REST
module Help
include Twitter::REST::Utils
# Returns the current configuration used by Twitter
#
# @see https://dev.twitter.com/rest/reference/get/help/configuration
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Configuration] Twitter's configuration.
def configuration(options = {})
perform_get_with_object('/1.1/help/configuration.json', options, Twitter::Configuration)
end
# Returns the list of languages supported by Twitter
#
# @see https://dev.twitter.com/rest/reference/get/help/languages
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array]
def languages(options = {})
perform_get_with_objects('/1.1/help/languages.json', options, Twitter::Language)
end
# Returns {https://twitter.com/privacy Twitter's Privacy Policy}
#
# @see https://dev.twitter.com/rest/reference/get/help/privacy
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [String]
def privacy(options = {})
perform_get('/1.1/help/privacy.json', options)[:privacy]
end
# Returns {https://twitter.com/tos Twitter's Terms of Service}
#
# @see https://dev.twitter.com/rest/reference/get/help/tos
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [String]
def tos(options = {})
perform_get('/1.1/help/tos.json', options)[:tos]
end
end
end
end
twitter-6.2.0/lib/twitter/rest/lists.rb 0000664 0000000 0000000 00000066715 13200674762 0020157 0 ustar 00root root 0000000 0000000 require 'addressable/uri'
require 'twitter/arguments'
require 'twitter/cursor'
require 'twitter/error'
require 'twitter/list'
require 'twitter/rest/request'
require 'twitter/rest/utils'
require 'twitter/tweet'
require 'twitter/user'
require 'twitter/utils'
require 'uri'
module Twitter
module REST
module Lists
include Twitter::REST::Utils
include Twitter::Utils
MAX_USERS_PER_REQUEST = 100
# Returns all lists the authenticating or specified user subscribes to, including their own
#
# @see https://dev.twitter.com/rest/reference/get/lists/list
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array]
# @overload lists(options = {})
# @param options [Hash] A customizable set of options.
# @option options [Boolean] :reverse Set this to true if you would like owned lists to be returned first.
# @overload lists(user, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Boolean] :reverse Set this to true if you would like owned lists to be returned first.
def lists(*args)
objects_from_response_with_user(Twitter::List, :get, '/1.1/lists/list.json', args)
end
alias lists_subscribed_to lists
# Show tweet timeline for members of the specified list
#
# @see https://dev.twitter.com/rest/reference/get/lists/statuses
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array]
# @overload list_timeline(list, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
# @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
# @option options [Integer] :count The number of results to retrieve.
# @overload list_timeline(user, list, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
# @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
# @option options [Integer] :count The number of results to retrieve.
def list_timeline(*args)
arguments = Twitter::Arguments.new(args)
merge_list!(arguments.options, arguments.pop)
merge_owner!(arguments.options, arguments.pop)
perform_get_with_objects('/1.1/lists/statuses.json', arguments.options, Twitter::Tweet)
end
# Removes the specified member from the list
#
# @see https://dev.twitter.com/rest/reference/post/lists/members/destroy
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::List] The list.
# @overload remove_list_member(list, user_to_remove, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param user_to_remove [Integer, String] The user id or screen name of the list member to remove.
# @param options [Hash] A customizable set of options.
# @overload remove_list_member(user, list, user_to_remove, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param user_to_remove [Integer, String] The user id or screen name of the list member to remove.
# @param options [Hash] A customizable set of options.
def remove_list_member(*args)
list_from_response_with_user('/1.1/lists/members/destroy.json', args)
end
# List the lists the specified user has been added to
#
# @see https://dev.twitter.com/rest/reference/get/lists/memberships
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Cursor]
# @overload memberships(options = {})
# @param options [Hash] A customizable set of options.
# @option options [Integer] :count The amount of results to return per page. Defaults to 20. No more than 1000 results will ever be returned in a single page.
# @option options [Boolean, String, Integer] :filter_to_owned_lists When set to true, t or 1, will return just lists the authenticating user owns, and the user represented by user_id or screen_name is a member of.
# @overload memberships(user, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Integer] :count The amount of results to return per page. Defaults to 20. No more than 1000 results will ever be returned in a single page.
# @option options [Boolean, String, Integer] :filter_to_owned_lists When set to true, t or 1, will return just lists the authenticating user owns, and the user represented by user_id or screen_name is a member of.
def memberships(*args)
cursor_from_response_with_user(:lists, Twitter::List, '/1.1/lists/memberships.json', args)
end
# Returns the subscribers of the specified list
#
# @see https://dev.twitter.com/rest/reference/get/lists/subscribers
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Cursor] The subscribers of the specified list.
# @overload list_subscribers(list, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
# @overload list_subscribers(user, list, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
def list_subscribers(*args)
cursor_from_response_with_list('/1.1/lists/subscribers.json', args)
end
# Make the authenticated user follow the specified list
#
# @see https://dev.twitter.com/rest/reference/post/lists/subscribers/create
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::List] The specified list.
# @overload list_subscribe(list, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
# @overload list_subscribe(user, list, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
def list_subscribe(*args)
list_from_response(:post, '/1.1/lists/subscribers/create.json', args)
end
# Check if a user is a subscriber of the specified list
#
# @see https://dev.twitter.com/rest/reference/get/lists/subscribers/show
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Boolean] true if user is a subscriber of the specified list, otherwise false.
# @overload list_subscriber?(list, user_to_check, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param user_to_check [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param options [Hash] A customizable set of options.
# @overload list_subscriber?(user, list, user_to_check, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param user_to_check [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param options [Hash] A customizable set of options.
# @return [Boolean] true if user is a subscriber of the specified list, otherwise false.
def list_subscriber?(*args)
list_user?(:get, '/1.1/lists/subscribers/show.json', args)
end
# Unsubscribes the authenticated user form the specified list
#
# @see https://dev.twitter.com/rest/reference/post/lists/subscribers/destroy
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::List] The specified list.
# @overload list_unsubscribe(list, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
# @overload list_unsubscribe(user, list, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
def list_unsubscribe(*args)
list_from_response(:post, '/1.1/lists/subscribers/destroy.json', args)
end
# Adds specified members to a list
#
# @see https://dev.twitter.com/rest/reference/post/lists/members/create_all
# @note Lists are limited to having 5,000 members, and you are limited to adding up to 100 members to a list at a time with this method.
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::Forbidden] Error raised when user has already been added.
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::List] The list.
# @overload add_list_members(list, users, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param users [Enumerable] A collection of Twitter user IDs, screen names, or objects.
# @param options [Hash] A customizable set of options.
# @overload add_list_members(user, list, users, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param users [Enumerable] A collection of Twitter user IDs, screen names, or objects.
# @param options [Hash] A customizable set of options.
def add_list_members(*args)
list_from_response_with_users('/1.1/lists/members/create_all.json', args)
end
# Check if a user is a member of the specified list
#
# @see https://dev.twitter.com/rest/reference/get/lists/members/show
# @authentication Requires user context
# @rate_limited Yes
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Boolean] true if user is a member of the specified list, otherwise false.
# @overload list_member?(list, user_to_check, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param user_to_check [Integer, String] The user ID or screen name of the list member.
# @param options [Hash] A customizable set of options.
# @overload list_member?(user, list, user_to_check, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param user_to_check [Integer, String] The user ID or screen name of the list member.
# @param options [Hash] A customizable set of options.
def list_member?(*args)
list_user?(:get, '/1.1/lists/members/show.json', args)
end
# Returns the members of the specified list
#
# @see https://dev.twitter.com/rest/reference/get/lists/members
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Cursor]
# @overload list_members(list, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
# @overload list_members(user, list, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
def list_members(*args)
cursor_from_response_with_list('/1.1/lists/members.json', args)
end
# Add a member to a list
#
# @see https://dev.twitter.com/rest/reference/post/lists/members/create
# @note Lists are limited to having 5,000 members.
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::List] The list.
# @overload add_list_member(list, user_to_add, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param user_to_add [Integer, String] The user id or screen name to add to the list.
# @param options [Hash] A customizable set of options.
# @overload add_list_member(user, list, user_to_add, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param user_to_add [Integer, String] The user id or screen name to add to the list.
# @param options [Hash] A customizable set of options.
def add_list_member(*args)
list_from_response_with_user('/1.1/lists/members/create.json', args)
end
# Deletes the specified list
#
# @see https://dev.twitter.com/rest/reference/post/lists/destroy
# @note Must be owned by the authenticated user.
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::List] The deleted list.
# @overload destroy_list(list, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
# @overload destroy_list(user, list, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
def destroy_list(*args)
list_from_response(:post, '/1.1/lists/destroy.json', args)
end
# Updates the specified list
#
# @see https://dev.twitter.com/rest/reference/post/lists/update
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::List] The created list.
# @overload list_update(list, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [String] :mode ('public') Whether your list is public or private. Values can be 'public' or 'private'.
# @option options [String] :description The description to give the list.
# @overload list_update(user, list, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [String] :mode ('public') Whether your list is public or private. Values can be 'public' or 'private'.
# @option options [String] :description The description to give the list.
def list_update(*args)
list_from_response(:post, '/1.1/lists/update.json', args)
end
# Creates a new list for the authenticated user
#
# @see https://dev.twitter.com/rest/reference/post/lists/create
# @note Accounts are limited to 20 lists.
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::List] The created list.
# @param name [String] The name for the list.
# @param options [Hash] A customizable set of options.
# @option options [String] :mode ('public') Whether your list is public or private. Values can be 'public' or 'private'.
# @option options [String] :description The description to give the list.
def create_list(name, options = {})
perform_post_with_object('/1.1/lists/create.json', options.merge(name: name), Twitter::List)
end
# Show the specified list
#
# @see https://dev.twitter.com/rest/reference/get/lists/show
# @note Private lists will only be shown if the authenticated user owns the specified list.
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::List] The specified list.
# @overload list(list, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
# @overload list(user, list, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
def list(*args)
list_from_response(:get, '/1.1/lists/show.json', args)
end
# List the lists the specified user follows
#
# @see https://dev.twitter.com/rest/reference/get/lists/subscriptions
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Cursor]
# @overload subscriptions(options = {})
# @param options [Hash] A customizable set of options.
# @overload subscriptions(user, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param options [Hash] A customizable set of options.
def subscriptions(*args)
cursor_from_response_with_user(:lists, Twitter::List, '/1.1/lists/subscriptions.json', args)
end
# Removes specified members from the list
#
# @see https://dev.twitter.com/rest/reference/post/lists/members/destroy_all
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::List] The list.
# @overload remove_list_members(list, users, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param users [Enumerable] A collection of Twitter user IDs, screen names, or objects.
# @param options [Hash] A customizable set of options.
# @overload remove_list_members(user, list, users, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param users [Enumerable] A collection of Twitter user IDs, screen names, or objects.
# @param options [Hash] A customizable set of options.
def remove_list_members(*args)
list_from_response_with_users('/1.1/lists/members/destroy_all.json', args)
end
# Returns the lists owned by the specified Twitter user
#
# @see https://dev.twitter.com/rest/reference/get/lists/ownerships
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array]
# @overload owned_lists(options = {})
# @param options [Hash] A customizable set of options.
# @option options [Integer] :count The amount of results to return per page. Defaults to 20. No more than 1000 results will ever be returned in a single page.
# @overload owned_lists(user, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Integer] :count The amount of results to return per page. Defaults to 20. No more than 1000 results will ever be returned in a single page.
def owned_lists(*args)
cursor_from_response_with_user(:lists, Twitter::List, '/1.1/lists/ownerships.json', args)
end
private
# @param request_method [Symbol]
# @param path [String]
# @param args [Array]
# @return [Array]
def list_from_response(request_method, path, args)
arguments = Twitter::Arguments.new(args)
merge_list!(arguments.options, arguments.pop)
merge_owner!(arguments.options, arguments.pop)
perform_request_with_object(request_method, path, arguments.options, Twitter::List)
end
def cursor_from_response_with_list(path, args)
arguments = Twitter::Arguments.new(args)
merge_list!(arguments.options, arguments.pop)
merge_owner!(arguments.options, arguments.pop)
perform_get_with_cursor(path, arguments.options, :users, Twitter::User)
end
def list_user?(request_method, path, args)
arguments = Twitter::Arguments.new(args)
merge_user!(arguments.options, arguments.pop)
merge_list!(arguments.options, arguments.pop)
merge_owner!(arguments.options, arguments.pop)
perform_request(request_method.to_sym, path, arguments.options)
true
rescue Twitter::Error::Forbidden, Twitter::Error::NotFound
false
end
def list_from_response_with_user(path, args)
arguments = Twitter::Arguments.new(args)
merge_user!(arguments.options, arguments.pop)
merge_list!(arguments.options, arguments.pop)
merge_owner!(arguments.options, arguments.pop)
perform_post_with_object(path, arguments.options, Twitter::List)
end
def list_from_response_with_users(path, args)
arguments = args.dup
options = arguments.last.is_a?(::Hash) ? arguments.pop : {}
members = arguments.pop
merge_list!(options, arguments.pop)
merge_owner!(options, arguments.pop)
pmap(members.each_slice(MAX_USERS_PER_REQUEST)) do |users|
perform_post_with_object(path, merge_users(options, users), Twitter::List)
end.last
end
# Take a list and merge it into the hash with the correct key
#
# @param hash [Hash]
# @param list [Integer, String, URI, Twitter::List] A Twitter list ID, slug, URI, or object.
def merge_list!(hash, list)
case list
when Integer then hash[:list_id] = list
when Twitter::List then merge_list_and_owner!(hash, list)
when String then merge_slug_and_owner!(hash, list)
when URI, Addressable::URI then merge_slug_and_owner!(hash, list.path)
end
end
def merge_slug_and_owner!(hash, path)
list = path.split('/')
hash[:slug] = list.pop
hash[:owner_screen_name] = list.pop unless list.empty?
end
def merge_list_and_owner!(hash, list)
merge_list!(hash, list.id)
merge_owner!(hash, list.user)
end
# Take an owner and merge it into the hash with the correct key
#
# @param hash [Hash]
# @param user[Integer, String, Twitter::User] A Twitter user ID, screen_name, or object.
# @return [Hash]
def merge_owner!(hash, user)
return hash if hash[:owner_id] || hash[:owner_screen_name]
if user
merge_user!(hash, user, 'owner')
hash[:owner_id] = hash.delete(:owner_user_id) unless hash[:owner_user_id].nil?
else
hash[:owner_id] = user_id
end
hash
end
end
end
end
twitter-6.2.0/lib/twitter/rest/oauth.rb 0000664 0000000 0000000 00000005675 13200674762 0020137 0 ustar 00root root 0000000 0000000 require 'twitter/headers'
require 'twitter/rest/utils'
module Twitter
module REST
module OAuth
include Twitter::REST::Utils
# Allows a registered application to obtain an OAuth 2 Bearer Token, which can be used to make API requests
# on an application's own behalf, without a user context.
#
# Only one bearer token may exist outstanding for an application, and repeated requests to this method
# will yield the same already-existent token until it has been invalidated.
#
# @see https://dev.twitter.com/rest/reference/post/oauth2/token
# @rate_limited No
# @authentication Required
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [String] The Bearer token.
# @param options [Hash] A customizable set of options.
# @example Generate a Bearer Token
# client = Twitter::REST::Client.new(consumer_key: 'abc', consumer_secret: 'def')
# bearer_token = client.token
def token(options = {})
options = options.dup
options[:bearer_token_request] = true
options[:grant_type] ||= 'client_credentials'
url = 'https://api.twitter.com/oauth2/token'
headers = Twitter::Headers.new(self, :post, url, options).request_headers
response = HTTP.headers(headers).post(url, form: options)
response.parse['access_token']
end
alias bearer_token token
# Allows a registered application to revoke an issued OAuth 2 Bearer Token by presenting its client credentials.
#
# @see https://dev.twitter.com/rest/reference/post/oauth2/invalidate_token
# @rate_limited No
# @authentication Required
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @param access_token [String] The bearer token to revoke.
# @param options [Hash] A customizable set of options.
# @return [String] The invalidated token. token_type should be nil.
def invalidate_token(access_token, options = {})
options = options.dup
options[:access_token] = access_token
perform_post('/oauth2/invalidate_token', options)[:access_token]
end
# Allows a registered application to revoke an issued OAuth 2 Bearer Token by presenting its client credentials.
#
# @see https://dev.twitter.com/rest/reference/post/oauth2/invalidate_token
# @rate_limited No
# @authentication Required
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [String] The token string.
def reverse_token
options = {x_auth_mode: 'reverse_auth'}
url = 'https://api.twitter.com/oauth/request_token'
auth_header = Twitter::Headers.new(self, :post, url, options).oauth_auth_header.to_s
HTTP.headers(authorization: auth_header).post(url, params: options).to_s
end
end
end
end
twitter-6.2.0/lib/twitter/rest/places_and_geo.rb 0000664 0000000 0000000 00000017110 13200674762 0021725 0 ustar 00root root 0000000 0000000 require 'twitter/geo_results'
require 'twitter/place'
require 'twitter/rest/utils'
module Twitter
module REST
module PlacesAndGeo
include Twitter::REST::Utils
# Returns all the information about a known place
#
# @see https://dev.twitter.com/rest/reference/get/geo/id/:place_id
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @param place_id [String] A place in the world. These IDs can be retrieved from {Twitter::REST::PlacesAndGeo#reverse_geocode}.
# @param options [Hash] A customizable set of options.
# @return [Twitter::Place] The requested place.
def place(place_id, options = {})
perform_get_with_object("/1.1/geo/id/#{place_id}.json", options, Twitter::Place)
end
# Searches for up to 20 places that can be used as a place_id
#
# @see https://dev.twitter.com/rest/reference/get/geo/reverse_geocode
# @note This request is an informative call and will deliver generalized results about geography.
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @param options [Hash] A customizable set of options.
# @option options [Float] :lat The latitude to search around. This option will be ignored unless it is inside the range -90.0 to +90.0 (North is positive) inclusive. It will also be ignored if there isn't a corresponding :long option.
# @option options [Float] :long The longitude to search around. The valid range for longitude is -180.0 to +180.0 (East is positive) inclusive. This option will be ignored if outside that range, if it is not a number, if geo_enabled is disabled, or if there not a corresponding :lat option.
# @option options [String] :accuracy ('0m') A hint on the "region" in which to search. If a number, then this is a radius in meters, but it can also take a string that is suffixed with ft to specify feet. If coming from a device, in practice, this value is whatever accuracy the device has measuring its location (whether it be coming from a GPS, WiFi triangulation, etc.).
# @option options [String] :granularity ('neighborhood') This is the minimal granularity of place types to return and must be one of: 'poi', 'neighborhood', 'city', 'admin' or 'country'.
# @option options [Integer] :max_results A hint as to the number of results to return. This does not guarantee that the number of results returned will equal max_results, but instead informs how many "nearby" results to return. Ideally, only pass in the number of places you intend to display to the user here.
# @return [Array]
def reverse_geocode(options = {})
perform_get_with_object('/1.1/geo/reverse_geocode.json', options, Twitter::GeoResults)
end
# Search for places that can be attached to a {Twitter::REST::Tweets#update}
#
# @see https://dev.twitter.com/rest/reference/get/geo/search
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @param options [Hash] A customizable set of options.
# @option options [Float] :lat The latitude to search around. This option will be ignored unless it is inside the range -90.0 to +90.0 (North is positive) inclusive. It will also be ignored if there isn't a corresponding :long option.
# @option options [Float] :long The longitude to search around. The valid range for longitude is -180.0 to +180.0 (East is positive) inclusive. This option will be ignored if outside that range, if it is not a number, if geo_enabled is disabled, or if there not a corresponding :lat option.
# @option options [String] :query Free-form text to match against while executing a geo-based query, best suited for finding nearby locations by name.
# @option options [String] :ip An IP address. Used when attempting to fix geolocation based off of the user's IP address.
# @option options [String] :granularity ('neighborhood') This is the minimal granularity of place types to return and must be one of: 'poi', 'neighborhood', 'city', 'admin' or 'country'.
# @option options [String] :accuracy ('0m') A hint on the "region" in which to search. If a number, then this is a radius in meters, but it can also take a string that is suffixed with ft to specify feet. If coming from a device, in practice, this value is whatever accuracy the device has measuring its location (whether it be coming from a GPS, WiFi triangulation, etc.).
# @option options [Integer] :max_results A hint as to the number of results to return. This does not guarantee that the number of results returned will equal max_results, but instead informs how many "nearby" results to return. Ideally, only pass in the number of places you intend to display to the user here.
# @option options [String] :contained_within This is the place_id which you would like to restrict the search results to. Setting this value means only places within the given place_id will be found.
# @option options [String] :"attribute:street_address" This option searches for places which have this given street address. There are other well-known and application-specific attributes available. Custom attributes are also permitted.
# @return [Array]
def geo_search(options = {})
perform_get_with_object('/1.1/geo/search.json', options, Twitter::GeoResults)
end
alias places_nearby geo_search
# Locates places near the given coordinates which are similar in name
#
# @see https://dev.twitter.com/rest/reference/get/geo/similar_places
# @note Conceptually, you would use this method to get a list of known places to choose from first. Then, if the desired place doesn't exist, make a request to {Twitter::REST::PlacesAndGeo#place} to create a new one. The token contained in the response is the token necessary to create a new place.
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @param options [Hash] A customizable set of options.
# @option options [Float] :lat The latitude to search around. This option will be ignored unless it is inside the range -90.0 to +90.0 (North is positive) inclusive. It will also be ignored if there isn't a corresponding :long option.
# @option options [Float] :long The longitude to search around. The valid range for longitude is -180.0 to +180.0 (East is positive) inclusive. This option will be ignored if outside that range, if it is not a number, if geo_enabled is disabled, or if there not a corresponding :lat option.
# @option options [String] :name The name a place is known as.
# @option options [String] :contained_within This is the place_id which you would like to restrict the search results to. Setting this value means only places within the given place_id will be found.
# @option options [String] :"attribute:street_address" This option searches for places which have this given street address. There are other well-known and application-specific attributes available. Custom attributes are also permitted.
# @return [Array]
def similar_places(options = {})
perform_get_with_object('/1.1/geo/similar_places.json', options, Twitter::GeoResults)
end
alias places_similar similar_places
end
end
end
twitter-6.2.0/lib/twitter/rest/request.rb 0000664 0000000 0000000 00000010166 13200674762 0020476 0 ustar 00root root 0000000 0000000 require 'addressable/uri'
require 'http'
require 'http/form_data'
require 'json'
require 'openssl'
require 'twitter/error'
require 'twitter/headers'
require 'twitter/rate_limit'
require 'twitter/utils'
module Twitter
module REST
class Request
include Twitter::Utils
BASE_URL = 'https://api.twitter.com'.freeze
attr_accessor :client, :headers, :options, :path, :rate_limit,
:request_method, :uri
alias verb request_method
# @param client [Twitter::Client]
# @param request_method [String, Symbol]
# @param path [String]
# @param options [Hash]
# @return [Twitter::REST::Request]
def initialize(client, request_method, path, options = {})
@client = client
@uri = Addressable::URI.parse(path.start_with?('http') ? path : BASE_URL + path)
set_multipart_options!(request_method, options)
@path = uri.path
@options = options
end
# @return [Array, Hash]
def perform
options_key = @request_method == :get ? :params : :form
response = http_client.headers(@headers).public_send(@request_method, @uri.to_s, options_key => @options)
response_body = response.body.empty? ? '' : symbolize_keys!(response.parse)
response_headers = response.headers
fail_or_return_response_body(response.code, response_body, response_headers)
end
private
def merge_multipart_file!(options)
key = options.delete(:key)
file = options.delete(:file)
options[key] = if file.is_a?(StringIO)
HTTP::FormData::File.new(file, mime_type: 'video/mp4')
else
HTTP::FormData::File.new(file, filename: File.basename(file), mime_type: mime_type(File.basename(file)))
end
end
def set_multipart_options!(request_method, options)
if request_method == :multipart_post
merge_multipart_file!(options)
@request_method = :post
@headers = Twitter::Headers.new(@client, @request_method, @uri).request_headers
else
@request_method = request_method
@headers = Twitter::Headers.new(@client, @request_method, @uri, options).request_headers
end
end
def mime_type(basename)
case basename
when /\.gif$/i
'image/gif'
when /\.jpe?g/i
'image/jpeg'
when /\.png$/i
'image/png'
else
'application/octet-stream'
end
end
def fail_or_return_response_body(code, body, headers)
error = error(code, body, headers)
raise(error) if error
@rate_limit = Twitter::RateLimit.new(headers)
body
end
def error(code, body, headers)
klass = Twitter::Error::ERRORS[code]
if klass == Twitter::Error::Forbidden
forbidden_error(body, headers)
elsif !klass.nil?
klass.from_response(body, headers)
end
end
def forbidden_error(body, headers)
error = Twitter::Error::Forbidden.from_response(body, headers)
klass = Twitter::Error::FORBIDDEN_MESSAGES[error.message]
if klass
klass.from_response(body, headers)
else
error
end
end
def symbolize_keys!(object)
if object.is_a?(Array)
object.each_with_index do |val, index|
object[index] = symbolize_keys!(val)
end
elsif object.is_a?(Hash)
object.dup.each_key do |key|
object[key.to_sym] = symbolize_keys!(object.delete(key))
end
end
object
end
# @return [HTTP::Client, HTTP]
def http_client
client = @client.proxy ? HTTP.via(*proxy) : HTTP
client = client.timeout(:per_operation, connect: @client.timeouts[:connect], read: @client.timeouts[:read], write: @client.timeouts[:write]) if @client.timeouts
client
end
# Return proxy values as a compacted array
#
# @return [Array]
def proxy
@client.proxy.values_at(:host, :port, :username, :password).compact
end
end
end
end
twitter-6.2.0/lib/twitter/rest/saved_searches.rb 0000664 0000000 0000000 00000010130 13200674762 0021754 0 ustar 00root root 0000000 0000000 require 'twitter/arguments'
require 'twitter/rest/utils'
require 'twitter/saved_search'
require 'twitter/utils'
module Twitter
module REST
module SavedSearches
include Twitter::REST::Utils
include Twitter::Utils
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array] The saved searches.
# @overload saved_search(options = {})
# Returns the authenticated user's saved search queries
#
# @see https://dev.twitter.com/rest/reference/get/saved_searches/list
# @param options [Hash] A customizable set of options.
# @overload saved_search(*ids)
# Retrieve the data for saved searches owned by the authenticating user
#
# @see https://dev.twitter.com/rest/reference/get/saved_searches/show/:id
# @param ids [Enumerable] A collection of saved search IDs.
# @overload saved_search(*ids, options)
# Retrieve the data for saved searches owned by the authenticating user
#
# @see https://dev.twitter.com/rest/reference/get/saved_searches/show/:id
# @param ids [Enumerable] A collection of saved search IDs.
# @param options [Hash] A customizable set of options.
def saved_searches(*args)
arguments = Twitter::Arguments.new(args)
if arguments.empty?
perform_get_with_objects('/1.1/saved_searches/list.json', arguments.options, Twitter::SavedSearch)
else
pmap(arguments) do |id|
saved_search(id, arguments.options)
end
end
end
# Retrieve the data for saved searches owned by the authenticating user
#
# @see https://dev.twitter.com/rest/reference/get/saved_searches/show/:id
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::SavedSearch] The saved searches.
# @param id [Integer] The ID of the saved search.
# @param options [Hash] A customizable set of options.
def saved_search(id, options = {})
perform_get_with_object("/1.1/saved_searches/show/#{id}.json", options, Twitter::SavedSearch)
end
# Creates a saved search for the authenticated user
#
# @see https://dev.twitter.com/rest/reference/post/saved_searches/create
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::SavedSearch] The created saved search.
# @param query [String] The query of the search the user would like to save.
# @param options [Hash] A customizable set of options.
def create_saved_search(query, options = {})
perform_post_with_object('/1.1/saved_searches/create.json', options.merge(query: query), Twitter::SavedSearch)
end
# Destroys saved searches for the authenticated user
#
# @see https://dev.twitter.com/rest/reference/post/saved_searches/destroy/:id
# @note The search specified by ID must be owned by the authenticating user.
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array] The deleted saved searches.
# @overload destroy_saved_search(*ids)
# @param ids [Enumerable] A collection of saved search IDs.
# @overload destroy_saved_search(*ids, options)
# @param ids [Enumerable] A collection of saved search IDs.
# @param options [Hash] A customizable set of options.
def destroy_saved_search(*args)
arguments = Twitter::Arguments.new(args)
pmap(arguments) do |id|
perform_post_with_object("/1.1/saved_searches/destroy/#{id}.json", arguments.options, Twitter::SavedSearch)
end
end
end
end
end
twitter-6.2.0/lib/twitter/rest/search.rb 0000664 0000000 0000000 00000006040 13200674762 0020247 0 ustar 00root root 0000000 0000000 require 'twitter/rest/request'
require 'twitter/search_results'
module Twitter
module REST
module Search
MAX_TWEETS_PER_REQUEST = 100
# Returns tweets that match a specified query.
#
# @see https://dev.twitter.com/rest/reference/get/search/tweets
# @see https://dev.twitter.com/rest/public/search
# @note Please note that Twitter's search service and, by extension, the Search API is not meant to be an exhaustive source of Tweets. Not all Tweets will be indexed or made available via the search interface.
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @param q [String] A search term.
# @param options [Hash] A customizable set of options.
# @option options [String] :geocode Returns tweets by users located within a given radius of the given latitude/longitude. The location is preferentially taking from the Geotagging API, but will fall back to their Twitter profile. The parameter value is specified by "latitude,longitude,radius", where radius units must be specified as either "mi" (miles) or "km" (kilometers). Note that you cannot use the near operator via the API to geocode arbitrary locations; however you can use this geocode parameter to search near geocodes directly.
# @option options [String] :lang Restricts tweets to the given language, given by an ISO 639-1 code.
# @option options [String] :locale Specify the language of the query you are sending (only ja is currently effective). This is intended for language-specific clients and the default should work in the majority of cases.
# @option options [String] :result_type Specifies what type of search results you would prefer to receive. Options are "mixed", "recent", and "popular". The current default is "mixed."
# @option options [Integer] :count The number of tweets to return per page, up to a maximum of 100.
# @option options [String] :until Optional. Returns tweets generated before the given date. Date should be formatted as YYYY-MM-DD.
# @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occured since the since_id, the since_id will be forced to the oldest ID available.
# @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
# @option options [Boolean] :include_entities The entities node will be disincluded when set to false.
# @return [Twitter::SearchResults] Return tweets that match a specified query with search metadata
def search(q, options = {})
options = options.dup
options[:count] ||= MAX_TWEETS_PER_REQUEST
request = Twitter::REST::Request.new(self, :get, '/1.1/search/tweets.json', options.merge(q: q))
Twitter::SearchResults.new(request)
end
end
end
end
twitter-6.2.0/lib/twitter/rest/spam_reporting.rb 0000664 0000000 0000000 00000002107 13200674762 0022033 0 ustar 00root root 0000000 0000000 require 'twitter/rest/utils'
require 'twitter/user'
module Twitter
module REST
module SpamReporting
include Twitter::REST::Utils
# The users specified are blocked by the authenticated user and reported as spammers
#
# @see https://dev.twitter.com/rest/reference/post/users/report_spam
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array] The reported users.
# @overload report_spam(*users)
# @param users [Enumerable] A collection of Twitter user IDs, screen names, or objects.
# @overload report_spam(*users, options)
# @param users [Enumerable] A collection of Twitter user IDs, screen names, or objects.
# @param options [Hash] A customizable set of options.
def report_spam(*args)
parallel_users_from_response(:post, '/1.1/users/report_spam.json', args)
end
end
end
end
twitter-6.2.0/lib/twitter/rest/suggested_users.rb 0000664 0000000 0000000 00000003741 13200674762 0022222 0 ustar 00root root 0000000 0000000 require 'twitter/arguments'
require 'twitter/rest/utils'
require 'twitter/suggestion'
require 'twitter/user'
module Twitter
module REST
module SuggestedUsers
include Twitter::REST::Utils
# @return [Array]
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @overload suggestions(options = {})
# Returns the list of suggested user categories
#
# @see https://dev.twitter.com/rest/reference/get/users/suggestions
# @param options [Hash] A customizable set of options.
# @overload suggestions(slug, options = {})
# Returns the users in a given category
#
# @see https://dev.twitter.com/rest/reference/get/users/suggestions/:slug
# @param slug [String] The short name of list or a category.
# @param options [Hash] A customizable set of options.
def suggestions(*args)
arguments = Twitter::Arguments.new(args)
if arguments.last
perform_get_with_object("/1.1/users/suggestions/#{arguments.pop}.json", arguments.options, Twitter::Suggestion)
else
perform_get_with_objects('/1.1/users/suggestions.json', arguments.options, Twitter::Suggestion)
end
end
# Access the users in a given category of the Twitter suggested user list and return their most recent Tweet if they are not a protected user
#
# @see https://dev.twitter.com/rest/reference/get/users/suggestions/:slug/members
# @rate_limited Yes
# @authentication Requires user context
# @param slug [String] The short name of list or a category.
# @param options [Hash] A customizable set of options.
# @return [Array]
def suggest_users(slug, options = {})
perform_get_with_objects("/1.1/users/suggestions/#{slug}/members.json", options, Twitter::User)
end
end
end
end
twitter-6.2.0/lib/twitter/rest/timelines.rb 0000664 0000000 0000000 00000033055 13200674762 0021001 0 ustar 00root root 0000000 0000000 require 'twitter/rest/utils'
require 'twitter/tweet'
require 'twitter/user'
module Twitter
module REST
module Timelines
include Twitter::REST::Utils
DEFAULT_TWEETS_PER_REQUEST = 20
MAX_TWEETS_PER_REQUEST = 200
# Returns the 20 most recent mentions (statuses containing @username) for the authenticating user
#
# @see https://dev.twitter.com/rest/reference/get/statuses/mentions_timeline
# @note This method can only return up to 800 Tweets.
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array]
# @param options [Hash] A customizable set of options.
# @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
# @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
# @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
def mentions_timeline(options = {})
perform_get_with_objects('/1.1/statuses/mentions_timeline.json', options, Twitter::Tweet)
end
alias mentions mentions_timeline
# Returns the 20 most recent Tweets posted by the specified user
#
# @see https://dev.twitter.com/rest/reference/get/statuses/user_timeline
# @note This method can only return up to 3,200 Tweets.
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array]
# @overload user_timeline(user, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
# @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
# @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
# @option options [Boolean, String, Integer] :exclude_replies This parameter will prevent replies from appearing in the returned timeline. Using exclude_replies with the count parameter will mean you will receive up-to count tweets - this is because the count parameter retrieves that many tweets before filtering out retweets and replies.
# @option options [Boolean, String, Integer] :contributor_details Specifies that the contributors element should be enhanced to include the screen_name of the contributor.
# @option options [Boolean, String, Integer] :include_rts Specifies that the timeline should include native retweets in addition to regular tweets. Note: If you're using the trim_user parameter in conjunction with include_rts, the retweets will no longer contain a full user object.
def user_timeline(*args)
objects_from_response_with_user(Twitter::Tweet, :get, '/1.1/statuses/user_timeline.json', args)
end
# Returns the 20 most recent retweets posted by the specified user
#
# @see https://dev.twitter.com/rest/reference/get/statuses/user_timeline
# @note This method can only return up to 3,200 Tweets.
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array]
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
# @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
# @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
# @option options [Boolean, String, Integer] :exclude_replies This parameter will prevent replies from appearing in the returned timeline. Using exclude_replies with the count parameter will mean you will receive up-to count tweets - this is because the count parameter retrieves that many tweets before filtering out retweets and replies.
# @option options [Boolean, String, Integer] :contributor_details Specifies that the contributors element should be enhanced to include the screen_name of the contributor.
def retweeted_by_user(user, options = {})
retweets_from_timeline(options) do |opts|
user_timeline(user, opts)
end
end
alias retweeted_by retweeted_by_user
# Returns the 20 most recent retweets posted by the authenticating user
#
# @see https://dev.twitter.com/rest/reference/get/statuses/user_timeline
# @note This method can only return up to 3,200 Tweets.
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array]
# @param options [Hash] A customizable set of options.
# @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
# @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
# @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
# @option options [Boolean, String, Integer] :exclude_replies This parameter will prevent replies from appearing in the returned timeline. Using exclude_replies with the count parameter will mean you will receive up-to count tweets - this is because the count parameter retrieves that many tweets before filtering out retweets and replies.
# @option options [Boolean, String, Integer] :contributor_details Specifies that the contributors element should be enhanced to include the screen_name of the contributor.
def retweeted_by_me(options = {})
retweets_from_timeline(options) do |opts|
user_timeline(opts)
end
end
# Returns the 20 most recent Tweets, including retweets if they exist, posted by the authenticating user and the users they follow
#
# @see https://dev.twitter.com/rest/reference/get/statuses/home_timeline
# @note This method can only return up to 800 Tweets, including retweets.
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array]
# @param options [Hash] A customizable set of options.
# @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
# @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
# @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
# @option options [Boolean, String, Integer] :exclude_replies This parameter will prevent replies from appearing in the returned timeline. Using exclude_replies with the count parameter will mean you will receive up-to count tweets - this is because the count parameter retrieves that many tweets before filtering out retweets and replies.
# @option options [Boolean, String, Integer] :include_rts Specifies that the timeline should include native retweets in addition to regular tweets. Note: If you're using the trim_user parameter in conjunction with include_rts, the retweets will no longer contain a full user object.
# @option options [Boolean, String, Integer] :contributor_details Specifies that the contributors element should be enhanced to include the screen_name of the contributor.
def home_timeline(options = {})
perform_get_with_objects('/1.1/statuses/home_timeline.json', options, Twitter::Tweet)
end
# Returns the 20 most recent retweets posted by users the authenticating user follow.
#
# @see https://dev.twitter.com/rest/reference/get/statuses/home_timeline
# @note This method can only return up to 800 Tweets, including retweets.
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array]
# @param options [Hash] A customizable set of options.
# @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
# @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
# @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
# @option options [Boolean, String, Integer] :exclude_replies This parameter will prevent replies from appearing in the returned timeline. Using exclude_replies with the count parameter will mean you will receive up-to count tweets - this is because the count parameter retrieves that many tweets before filtering out retweets and replies.
# @option options [Boolean, String, Integer] :contributor_details Specifies that the contributors element should be enhanced to include the screen_name of the contributor.
def retweeted_to_me(options = {})
retweets_from_timeline(options) do |opts|
home_timeline(opts)
end
end
# Returns the 20 most recent tweets of the authenticated user that have been retweeted by others
#
# @see https://dev.twitter.com/rest/reference/get/statuses/retweets_of_me
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array]
# @param options [Hash] A customizable set of options.
# @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
# @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
# @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
# @option options [Boolean, String, Integer] :include_user_entities The user entities node will be disincluded when set to false.
def retweets_of_me(options = {})
perform_get_with_objects('/1.1/statuses/retweets_of_me.json', options, Twitter::Tweet)
end
private
def retweets_from_timeline(options)
options[:include_rts] = true
count = options[:count] || DEFAULT_TWEETS_PER_REQUEST
collect_with_count(count) do |count_options|
select_retweets(yield(options.merge(count_options)))
end
end
# @param tweets [Array]
# @return [Array]
def select_retweets(tweets)
tweets.select(&:retweet?)
end
# @param count [Integer]
# @return [Array]
def collect_with_count(count)
options = {}
options[:count] = MAX_TWEETS_PER_REQUEST
collect_with_max_id do |max_id|
options[:max_id] = max_id unless max_id.nil?
if count > 0
tweets = yield(options)
count -= tweets.length
tweets
end
end.flatten.compact[0...count]
end
# @param collection [Array]
# @param max_id [Integer, NilClass]
# @return [Array]
def collect_with_max_id(collection = [], max_id = nil, &block)
tweets = yield(max_id)
return collection if tweets.nil?
collection += tweets
tweets.empty? ? collection.flatten : collect_with_max_id(collection, tweets.last.id - 1, &block)
end
end
end
end
twitter-6.2.0/lib/twitter/rest/trends.rb 0000664 0000000 0000000 00000005772 13200674762 0020314 0 ustar 00root root 0000000 0000000 require 'twitter/place'
require 'twitter/rest/request'
require 'twitter/rest/utils'
require 'twitter/trend_results'
module Twitter
module REST
module Trends
include Twitter::REST::Utils
# Returns the top 50 trending topics for a specific WOEID
#
# @see https://dev.twitter.com/rest/reference/get/trends/place
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @param id [Integer] The {https://developer.yahoo.com/geo/geoplanet Yahoo! Where On Earth ID} of the location to return trending information for. WOEIDs can be retrieved by calling {Twitter::REST::Trends#trends_available}. Global information is available by using 1 as the WOEID.
# @param options [Hash] A customizable set of options.
# @option options [String] :exclude Setting this equal to 'hashtags' will remove all hashtags from the trends list.
# @return [Array]
def trends(id = 1, options = {})
options = options.dup
options[:id] = id
response = perform_get('/1.1/trends/place.json', options).first
Twitter::TrendResults.new(response)
end
alias local_trends trends
alias trends_place trends
# Returns the locations that Twitter has trending topic information for
#
# @see https://dev.twitter.com/rest/reference/get/trends/available
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @param options [Hash] A customizable set of options.
# @return [Array]
def trends_available(options = {})
perform_get_with_objects('/1.1/trends/available.json', options, Twitter::Place)
end
alias trend_locations trends_available
# Returns the locations that Twitter has trending topic information for, closest to a specified location.
#
# @see https://dev.twitter.com/rest/reference/get/trends/closest
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @param options [Hash] A customizable set of options.
# @option options [Float] :lat If provided with a :long option the available trend locations will be sorted by distance, nearest to furthest, to the co-ordinate pair. The valid ranges for latitude are -90.0 to +90.0 (North is positive) inclusive.
# @option options [Float] :long If provided with a :lat option the available trend locations will be sorted by distance, nearest to furthest, to the co-ordinate pair. The valid ranges for longitude are -180.0 to +180.0 (East is positive) inclusive.
# @return [Array]
def trends_closest(options = {})
perform_get_with_objects('/1.1/trends/closest.json', options, Twitter::Place)
end
end
end
end
twitter-6.2.0/lib/twitter/rest/tweets.rb 0000664 0000000 0000000 00000064361 13200674762 0020327 0 ustar 00root root 0000000 0000000 require 'twitter/arguments'
require 'twitter/error'
require 'twitter/oembed'
require 'twitter/rest/request'
require 'twitter/rest/utils'
require 'twitter/tweet'
require 'twitter/utils'
module Twitter
module REST
module Tweets
include Twitter::REST::Utils
include Twitter::Utils
MAX_TWEETS_PER_REQUEST = 100
# Returns up to 100 of the first retweets of a given tweet
#
# @see https://dev.twitter.com/rest/reference/get/statuses/retweets/:id
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array]
# @param tweet [Integer, String, URI, Twitter::Tweet] A Tweet ID, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 100.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
def retweets(tweet, options = {})
perform_get_with_objects("/1.1/statuses/retweets/#{extract_id(tweet)}.json", options, Twitter::Tweet)
end
# Show up to 100 users who retweeted the Tweet
#
# @see https://dev.twitter.com/rest/reference/get/statuses/retweets/:id
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array]
# @param tweet [Integer, String, URI, Twitter::Tweet] A Tweet ID, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 100.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
# @option options [Boolean] :ids_only ('false') Only return user IDs instead of full user objects.
def retweeters_of(tweet, options = {})
options = options.dup
ids_only = !!options.delete(:ids_only)
retweeters = retweets(tweet, options).collect(&:user)
ids_only ? retweeters.collect(&:id) : retweeters
end
# Returns a Tweet
#
# @see https://dev.twitter.com/rest/reference/get/statuses/show/:id
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @raise [Twitter::Error::Forbidden] Error raised when supplied status is over 280 characters.
# @return [Twitter::Tweet] The requested Tweet.
# @param tweet [Integer, String, URI, Twitter::Tweet] A Tweet ID, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
def status(tweet, options = {})
perform_get_with_object("/1.1/statuses/show/#{extract_id(tweet)}.json", options, Twitter::Tweet)
end
# Returns Tweets
#
# @see https://dev.twitter.com/rest/reference/get/statuses/lookup
# @rate_limited Yes
# @authentication Required
# @return [Array] The requested Tweets.
# @overload statuses(*tweets)
# @param tweets [Enumerable] A collection of Tweet IDs, URIs, or objects.
# @overload statuses(*tweets, options)
# @param tweets [Enumerable] A collection of Tweet IDs, URIs, or objects.
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
def statuses(*args)
arguments = Twitter::Arguments.new(args)
flat_pmap(arguments.each_slice(MAX_TWEETS_PER_REQUEST)) do |tweets|
perform_post_with_objects('/1.1/statuses/lookup.json', arguments.options.merge(id: tweets.collect { |u| extract_id(u) }.join(',')), Twitter::Tweet)
end
end
# Destroys the specified Tweets
#
# @see https://dev.twitter.com/rest/reference/post/statuses/destroy/:id
# @note The authenticating user must be the author of the specified Tweets.
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array] The deleted Tweets.
# @overload destroy_status(*tweets)
# @param tweets [Enumerable] A collection of Tweet IDs, URIs, or objects.
# @overload destroy_status(*tweets, options)
# @param tweets [Enumerable] A collection of Tweet IDs, URIs, or objects.
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
def destroy_status(*args)
arguments = Twitter::Arguments.new(args)
pmap(arguments) do |tweet|
perform_post_with_object("/1.1/statuses/destroy/#{extract_id(tweet)}.json", arguments.options, Twitter::Tweet)
end
end
alias destroy_tweet destroy_status
# Updates the authenticating user's status
#
# @see https://dev.twitter.com/rest/reference/post/statuses/update
# @note A status update with text identical to the authenticating user's current status will be ignored to prevent duplicates.
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Tweet] The created Tweet. When the tweet is deemed a duplicate by Twitter, returns the last Tweet from the user's timeline.
# @param status [String] The text of your status update, up to 280 characters.
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :possibly_sensitive Set to true for content which may not be suitable for every audience.
# @option options [Twitter::Tweet] :in_reply_to_status An existing status that the update is in reply to. If the status being replied to was not originally posted by the authenticated user, the text of the status must begin with an @-mention, or twitter will reject the update.
# @option options [Integer] :in_reply_to_status_id The ID of an existing status that the update is in reply to.
# @option options [Float] :lat The latitude of the location this tweet refers to. This option will be ignored unless it is inside the range -90.0 to +90.0 (North is positive) inclusive. It will also be ignored if there isn't a corresponding :long option.
# @option options [Float] :long The longitude of the location this tweet refers to. The valid ranges for longitude is -180.0 to +180.0 (East is positive) inclusive. This option will be ignored if outside that range, if it is not a number, if geo_enabled is disabled, or if there not a corresponding :lat option.
# @option options [Twitter::Place] :place A place in the world. These can be retrieved from {Twitter::REST::PlacesAndGeo#reverse_geocode}.
# @option options [String] :place_id A place in the world. These IDs can be retrieved from {Twitter::REST::PlacesAndGeo#reverse_geocode}.
# @option options [String] :display_coordinates Whether or not to put a pin on the exact coordinates a tweet has been sent from.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
def update(status, options = {})
update!(status, options)
rescue Twitter::Error::DuplicateStatus
user_timeline(count: 1).first
end
# Updates the authenticating user's status
#
# @see https://dev.twitter.com/rest/reference/post/statuses/update
# @note A status update with text identical to the authenticating user's current status will be ignored to prevent duplicates.
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @raise [Twitter::Error::DuplicateStatus] Error raised when a duplicate status is posted.
# @return [Twitter::Tweet] The created Tweet.
# @param status [String] The text of your status update, up to 280 characters.
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :possibly_sensitive Set to true for content which may not be suitable for every audience.
# @option options [Twitter::Tweet] :in_reply_to_status An existing status that the update is in reply to. If the status being replied to was not originally posted by the authenticated user, the text of the status must begin with an @-mention, or twitter will reject the update.
# @option options [Integer] :in_reply_to_status_id The ID of an existing status that the update is in reply to.
# @option options [Float] :lat The latitude of the location this tweet refers to. This option will be ignored unless it is inside the range -90.0 to +90.0 (North is positive) inclusive. It will also be ignored if there isn't a corresponding :long option.
# @option options [Float] :long The longitude of the location this tweet refers to. The valid ranges for longitude is -180.0 to +180.0 (East is positive) inclusive. This option will be ignored if outside that range, if it is not a number, if geo_enabled is disabled, or if there not a corresponding :lat option.
# @option options [Twitter::Place] :place A place in the world. These can be retrieved from {Twitter::REST::PlacesAndGeo#reverse_geocode}.
# @option options [String] :place_id A place in the world. These IDs can be retrieved from {Twitter::REST::PlacesAndGeo#reverse_geocode}.
# @option options [String] :display_coordinates Whether or not to put a pin on the exact coordinates a tweet has been sent from.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
def update!(status, options = {})
hash = options.dup
hash[:in_reply_to_status_id] = hash.delete(:in_reply_to_status).id unless hash[:in_reply_to_status].nil?
hash[:place_id] = hash.delete(:place).woeid unless hash[:place].nil?
perform_post_with_object('/1.1/statuses/update.json', hash.merge(status: status), Twitter::Tweet)
end
# Retweets the specified Tweets as the authenticating user
#
# @see https://dev.twitter.com/rest/reference/post/statuses/retweet/:id
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array] The original tweets with retweet details embedded.
# @overload retweet(*tweets)
# @param tweets [Enumerable] A collection of Tweet IDs, URIs, or objects.
# @overload retweet(*tweets, options)
# @param tweets [Enumerable] A collection of Tweet IDs, URIs, or objects.
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
def retweet(*args)
arguments = Twitter::Arguments.new(args)
pmap(arguments) do |tweet|
begin
post_retweet(extract_id(tweet), arguments.options)
rescue Twitter::Error::AlreadyRetweeted, Twitter::Error::NotFound
next
end
end.compact
end
# Retweets the specified Tweets as the authenticating user and raises an error if one has already been retweeted
#
# @see https://dev.twitter.com/rest/reference/post/statuses/retweet/:id
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::AlreadyRetweeted] Error raised when tweet has already been retweeted.
# @raise [Twitter::Error::NotFound] Error raised when tweet does not exist or has been deleted.
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array] The original tweets with retweet details embedded.
# @overload retweet!(*tweets)
# @param tweets [Enumerable] A collection of Tweet IDs, URIs, or objects.
# @overload retweet!(*tweets, options)
# @param tweets [Enumerable] A collection of Tweet IDs, URIs, or objects.
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
def retweet!(*args)
arguments = Twitter::Arguments.new(args)
pmap(arguments) do |tweet|
post_retweet(extract_id(tweet), arguments.options)
end.compact
end
# Updates the authenticating user's status with media
#
# @see https://dev.twitter.com/rest/reference/post/statuses/update_with_media
# @note A status update with text/media identical to the authenticating user's current status will NOT be ignored
# @rate_limited No
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Tweet] The created Tweet.
# @param status [String] The text of your status update, up to 280 characters.
# @param media [File, Array] An image file or array of image files (PNG, JPEG or GIF).
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :possibly_sensitive Set to true for content which may not be suitable for every audience.
# @option options [Twitter::Tweet] :in_reply_to_status An existing status that the update is in reply to.
# @option options [Integer] :in_reply_to_status_id The ID of an existing Tweet that the update is in reply to.
# @option options [Float] :lat The latitude of the location this tweet refers to. This option will be ignored unless it is inside the range -90.0 to +90.0 (North is positive) inclusive. It will also be ignored if there isn't a corresponding :long option.
# @option options [Float] :long The longitude of the location this tweet refers to. The valid ranges for longitude is -180.0 to +180.0 (East is positive) inclusive. This option will be ignored if outside that range, if it is not a number, if geo_enabled is disabled, or if there not a corresponding :lat option.
# @option options [Twitter::Place] :place A place in the world. These can be retrieved from {Twitter::REST::PlacesAndGeo#reverse_geocode}.
# @option options [String] :place_id A place in the world. These IDs can be retrieved from {Twitter::REST::PlacesAndGeo#reverse_geocode}.
# @option options [String] :display_coordinates Whether or not to put a pin on the exact coordinates a tweet has been sent from.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
def update_with_media(status, media, options = {})
options = options.dup
media_ids = pmap(array_wrap(media)) do |medium|
upload(medium)[:media_id]
end
update!(status, options.merge(media_ids: media_ids.join(',')))
end
# Returns oEmbed for a Tweet
#
# @see https://dev.twitter.com/rest/reference/get/statuses/oembed
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::OEmbed] OEmbed for the requested Tweet.
# @param tweet [Integer, String, URI, Twitter::Tweet] A Tweet ID, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Integer] :maxwidth The maximum width in pixels that the embed should be rendered at. This value is constrained to be between 250 and 550 pixels.
# @option options [Boolean, String, Integer] :hide_media Specifies whether the embedded Tweet should automatically expand images which were uploaded via {https://dev.twitter.com/rest/reference/post/statuses/update_with_media POST statuses/update_with_media}. When set to either true, t or 1 images will not be expanded. Defaults to false.
# @option options [Boolean, String, Integer] :hide_thread Specifies whether the embedded Tweet should automatically show the original message in the case that the embedded Tweet is a reply. When set to either true, t or 1 the original Tweet will not be shown. Defaults to false.
# @option options [Boolean, String, Integer] :omit_script Specifies whether the embedded Tweet HTML should include a `