Class: Engagement::CommentCounter::Disqus

Inherits:
Object
  • Object
show all
Defined in:
lib/engagement/comment_counter/disqus.rb

Instance Method Summary collapse

Constructor Details

#initialize(forum_api_key) ⇒ Disqus

Returns a new instance of Disqus.



7
8
9
# File 'lib/engagement/comment_counter/disqus.rb', line 7

def initialize(forum_api_key)
  @forum_api_key = forum_api_key
end

Instance Method Details

#comments_count(url) ⇒ Object

When we don’t own the thread we currently return 0 to prevent an exception from being raised. We’re not sure that this is the best long-term solution.



14
15
16
17
18
19
20
# File 'lib/engagement/comment_counter/disqus.rb', line 14

def comments_count(url)
  if (thread_id = thread_id_for(url))
    comments_count_for_thread_id thread_id
  else
    0
  end
end