Class: TwitterFriendly::Client
- Inherits:
-
Object
- Object
- TwitterFriendly::Client
- Extended by:
- Forwardable, Caching, CachingAndLogging
- Defined in:
- lib/twitter_friendly/client.rb
Constant Summary
Constants included from REST::Tweets
REST::Tweets::MAX_IDS_PER_REQUEST
Constants included from REST::Lists
REST::Lists::MAX_LISTS_PER_REQUEST, REST::Lists::MAX_MEMBERS_PER_REQUEST
Constants included from REST::Favorites
REST::Favorites::MAX_TWEETS_PER_REQUEST
Constants included from REST::Search
REST::Search::MAX_TWEETS_PER_REQUEST
Constants included from REST::Timelines
REST::Timelines::MAX_TWEETS_PER_REQUEST
Constants included from REST::Users
REST::Users::MAX_USERS_PER_REQUEST
Constants included from REST::FriendsAndFollowers
REST::FriendsAndFollowers::MAX_IDS_PER_REQUEST
Instance Method Summary collapse
- #cache ⇒ Object
-
#initialize(*args) ⇒ Client
constructor
A new instance of Client.
- #internal_client ⇒ Object
- #logger ⇒ Object
- #subscriber_attached? ⇒ Boolean
- #twitter ⇒ Object
Methods included from CachingAndLogging
Methods included from Caching
caching_resources_with_cursor, caching_tweets_with_max_id, caching_users
Methods included from RateLimit
Methods included from REST::Tweets
Methods included from REST::Lists
#list, #list_members, #memberships
Methods included from REST::Favorites
Methods included from REST::Search
Methods included from REST::Timelines
#home_timeline, #mentions_timeline, #user_timeline
Methods included from REST::Users
#blocked_ids, #user, #user?, #users, #verify_credentials
Methods included from REST::FriendsAndFollowers
#follower_ids, #followers, #friend_ids, #friend_ids_and_follower_ids, #friends, #friends_and_followers, #friendship?
Methods included from REST::Parallel
Methods included from REST::Collector
#fetch_resources_with_cursor, #fetch_tweets_with_max_id
Methods included from REST::Utils
Methods included from Utils
#authenticating_user?, #authorized_user?, #uid_or_screen_name?
Constructor Details
#initialize(*args) ⇒ Client
Returns a new instance of Client.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/twitter_friendly/client.rb', line 27 def initialize(*args) = args. @twitter = Twitter::REST::Client.new(.slice(:access_token, :access_token_secret, :consumer_key, :consumer_secret)) .except!(:access_token, :access_token_secret, :consumer_key, :consumer_secret) @cache = TwitterFriendly::Cache.new(.slice(:cache_dir, :expires_in, :race_condition_ttl)) .except!(:cache_dir, :expires_in, :race_condition_ttl) @logger = TwitterFriendly::Logger.new(.slice(:log_dir, :log_level)) unless subscriber_attached? if @logger.level == ::Logger::DEBUG @@subscriber_attached = true TwitterFriendly::Logging.logger = @logger TwitterFriendly::TFLogSubscriber.attach_to :twitter_friendly TwitterFriendly::ASLogSubscriber.attach_to :active_support end end end |
Instance Method Details
#cache ⇒ Object
48 49 50 |
# File 'lib/twitter_friendly/client.rb', line 48 def cache @cache end |
#internal_client ⇒ Object
56 57 58 |
# File 'lib/twitter_friendly/client.rb', line 56 def internal_client @twitter end |
#logger ⇒ Object
52 53 54 |
# File 'lib/twitter_friendly/client.rb', line 52 def logger @logger end |
#subscriber_attached? ⇒ Boolean
65 66 67 |
# File 'lib/twitter_friendly/client.rb', line 65 def subscriber_attached? @@subscriber_attached ||= false end |
#twitter ⇒ Object
60 61 62 63 |
# File 'lib/twitter_friendly/client.rb', line 60 def twitter logger.warn "DEPRECATION WARNING: Use #internal_client instead of #twitter" internal_client end |