Class: TwitterWithAutoPagination::Client

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Analysis::API, Parallel, REST::API, RateLimit
Defined in:
lib/twitter_with_auto_pagination/client.rb

Constant Summary

Constants included from Analysis::Timelines

Analysis::Timelines::EVERY_DAY, Analysis::Timelines::EVERY_HOUR, Analysis::Timelines::HOUR_COUNT, Analysis::Timelines::HOUR_NIL_COUNT, Analysis::Timelines::WDAY_COUNT, Analysis::Timelines::WDAY_NIL_COUNT

Constants included from REST::Utils

REST::Utils::DEFAULT_CALL_LIMIT

Constants included from REST::Extension::Clusters

REST::Extension::Clusters::PROFILE_EXCLUDE_REGEXP, REST::Extension::Clusters::PROFILE_EXCLUDE_WORDS, REST::Extension::Clusters::PROFILE_SPECIAL_REGEXP, REST::Extension::Clusters::PROFILE_SPECIAL_WORDS

Constants included from REST::Users

REST::Users::MAX_USERS_PER_REQUEST

Constants included from REST::Timelines

REST::Timelines::MAX_TWEETS_PER_REQUEST

Constants included from REST::Search

REST::Search::MAX_TWEETS_PER_REQUEST

Constants included from REST::FriendsAndFollowers

REST::FriendsAndFollowers::MAX_IDS_PER_REQUEST

Constants included from REST::Favorites

REST::Favorites::MAX_TWEETS_PER_REQUEST

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Analysis::Timelines

#count_hour, #count_wday, #twitter_addiction_series, #usage_stats, #usage_stats_hour_drilldown_series, #usage_stats_hour_series_data, #usage_stats_wday_drilldown_series, #usage_stats_wday_series_data

Methods included from Collector

#collect_with_cursor, #collect_with_max_id

Methods included from REST::Extension::Clusters

#count_freq_hashtags, #fetch_lists, #hashtag_clusters, #list_clusters, #tweet_clusters

Methods included from REST::Users

#blocked_ids, #user, #user?, #users, #verify_credentials

Methods included from REST::Lists

#list_members, #memberships

Methods included from REST::FriendsAndFollowers

#followers, #friend_ids_and_follower_ids, #friends, #friends_and_followers, #friendship?

Methods included from Parallel

#fetch_parallelly, #parallel

Methods included from RateLimit

#rate_limit

Constructor Details

#initialize(*args) ⇒ Client

Returns a new instance of Client.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/twitter_with_auto_pagination/client.rb', line 24

def initialize(*args)
  options = args.extract_options!

  @cache = TwitterWithAutoPagination::Cache.new(options)
  Logging.logger = logger = TwitterWithAutoPagination::Logger.new(options)

  unless subscriber_attached?
    @@subscriber_attached = true
    if logger.debug?
      # Super slow
      TwitterWithAutoPagination::AllLogSubscriber.attach_to :twitter
      TwitterWithAutoPagination::ASLogSubscriber.attach_to :active_support
    elsif logger.info?
      TwitterWithAutoPagination::ApiCallLogSubscriber.attach_to :twitter
    end
  end

  @twitter = Twitter::REST::Client.new(options)
end

Instance Attribute Details

#cacheObject (readonly)

Returns the value of attribute cache.



15
16
17
# File 'lib/twitter_with_auto_pagination/client.rb', line 15

def cache
  @cache
end

#twitterObject (readonly)

Returns the value of attribute twitter.



15
16
17
# File 'lib/twitter_with_auto_pagination/client.rb', line 15

def twitter
  @twitter
end

Class Method Details

.loggerObject



44
45
46
# File 'lib/twitter_with_auto_pagination/client.rb', line 44

def self.logger
  Logging.logger
end

Instance Method Details

#call_countObject

Deprecated



53
54
55
# File 'lib/twitter_with_auto_pagination/client.rb', line 53

def call_count
  -1
end

#subscriber_attached?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/twitter_with_auto_pagination/client.rb', line 48

def subscriber_attached?
  @@subscriber_attached ||= false
end