Module: Tweetkit::Client::Tweets

Included in:
Tweetkit::Client
Defined in:
lib/tweetkit/client/tweets.rb

Instance Method Summary collapse

Instance Method Details

#delete_tweet(id) ⇒ Object



29
30
31
# File 'lib/tweetkit/client/tweets.rb', line 29

def delete_tweet(id)
  delete "tweets/#{id}"
end

#post_tweet(**options) ⇒ Object



25
26
27
# File 'lib/tweetkit/client/tweets.rb', line 25

def post_tweet(**options)
  post "tweets", **options
end

#search(query = '', type: :tweet, **options, &block) ⇒ Object



19
20
21
22
23
# File 'lib/tweetkit/client/tweets.rb', line 19

def search(query = '', type: :tweet, **options, &block)
  search = Search.new(query)
  search.evaluate(&block) if block_given?
  get 'tweets/search/recent', **options.merge!({ query: search.current_query })
end

#tweet(id, **options) ⇒ Object



6
7
8
# File 'lib/tweetkit/client/tweets.rb', line 6

def tweet(id, **options)
  get "tweets/#{id}", **options
end

#tweets(ids, **options) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/tweetkit/client/tweets.rb', line 10

def tweets(ids, **options)
  if ids.is_a? Array
    ids = ids.join(',')
  else
    ids = ids.delete(' ')
  end
  get 'tweets', **options.merge!({ ids: ids })
end