Class: Twterm::Client
- Inherits:
-
Object
- Object
- Twterm::Client
- Includes:
- RESTClient, StreamingClient
- Defined in:
- lib/twterm/client.rb
Constant Summary collapse
- @@instances =
[]
Constants included from StreamingClient
StreamingClient::CONSUMER_KEY, StreamingClient::CONSUMER_SECRET
Constants included from RESTClient
RESTClient::CONSUMER_KEY, RESTClient::CONSUMER_SECRET
Instance Attribute Summary collapse
-
#screen_name ⇒ Object
readonly
Returns the value of attribute screen_name.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(user_id, screen_name, access_token, access_token_secret) ⇒ Client
constructor
A new instance of Client.
Methods included from StreamingClient
#connect_user_stream, #initialize_user_stream
Methods included from Publisher
Methods included from Utils
Methods included from RESTClient
#block, #create_direct_message, #destroy_status, #direct_message_conversations, #direct_messages_received, #direct_messages_sent, #favorite, #favorites, #fetch_muted_users, #follow, #followers, #friends, #home_timeline, #list, #list_timeline, #lists, #lookup_friendships, #mentions, #mute, #post, #rest_client, #retweet, #saved_search, #search, #send_request, #send_request_without_catch, #show_status, #show_user, #unblock, #unfavorite, #unfollow, #unmute, #user_timeline
Constructor Details
#initialize(user_id, screen_name, access_token, access_token_secret) ⇒ Client
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/twterm/client.rb', line 13 def initialize(user_id, screen_name, access_token, access_token_secret) @user_id, @screen_name = user_id, screen_name @access_token, @access_token_secret = access_token, access_token_secret @callbacks = {} @mute_filter = -> _ { true } fetch_muted_users do |muted_user_ids| @mute_filter = lambda do |status| !muted_user_ids.include?(status.user.id) && !(status.retweeted_status.is_a?(Twitter::NullObject) && muted_user_ids.include?(status.retweeted_status.user.id)) end end initialize_user_stream @@instances << self end |
Instance Attribute Details
#screen_name ⇒ Object (readonly)
Returns the value of attribute screen_name.
9 10 11 |
# File 'lib/twterm/client.rb', line 9 def screen_name @screen_name end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
9 10 11 |
# File 'lib/twterm/client.rb', line 9 def user_id @user_id end |
Class Method Details
.current ⇒ Object
41 42 43 |
# File 'lib/twterm/client.rb', line 41 def self.current @@instances[0] end |
.new(user_id, screen_name, token, secret) ⇒ Object
35 36 37 38 39 |
# File 'lib/twterm/client.rb', line 35 def self.new(user_id, screen_name, token, secret) detector = -> (instance) { instance.user_id == user_id } instance = @@instances.find(&detector) instance.nil? ? super : instance end |