Class: Services::Twitter

Inherits:
Service
  • Object
show all
Defined in:
app/models/services/twitter.rb

Constant Summary

MAX_CHARACTERS =
140
SHORTENED_URL_LENGTH =
21
%r{https?://\S+}

Instance Method Summary collapse

Instance Method Details

#delete_post(post) ⇒ Object



23
24
25
26
27
28
# File 'app/models/services/twitter.rb', line 23

def delete_post post
  if post.present? && post.tweet_id.present?
    Rails.logger.debug "event=delete_from_service type=twitter sender_id=#{self.user_id}"
    delete_from_twitter post.tweet_id
  end
end

#post(post, url = '') ⇒ Object



12
13
14
15
16
17
# File 'app/models/services/twitter.rb', line 12

def post post, url=''
  Rails.logger.debug "event=post_to_service type=twitter sender_id=#{self.user_id}"
  tweet = attempt_post post
  post.tweet_id = tweet.id
  post.save
end

#profile_photo_urlObject



19
20
21
# File 'app/models/services/twitter.rb', line 19

def profile_photo_url
  client.user(nickname).profile_image_url_https "original"
end

#providerObject



8
9
10
# File 'app/models/services/twitter.rb', line 8

def provider
  "twitter"
end