Class: Stars::Convore

Inherits:
Service show all
Defined in:
lib/stars/services/convore.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Service

posts, #username

Instance Attribute Details

#postsObject (readonly)

Returns the value of attribute posts.



4
5
6
# File 'lib/stars/services/convore.rb', line 4

def posts
  @posts
end

Class Method Details

.more(post) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/stars/services/convore.rb', line 26

def self.more(post)
return <<-CONVORE

Convore doesn't have a stars API yet. So we're just scraping your total stars 
for now. Kind of a bummer, isn't it? You should probably send @ericflo a tweet 
and complain about it. Tell him I didn't send you.

Anyway, you have #{post.stars_count} stars with Convore right now. Check it:
  #{post.url}

CONVORE
end

Instance Method Details

#htmlObject



18
19
20
# File 'lib/stars/services/convore.rb', line 18

def html
  Nokogiri::HTML(open("https://convore.com/users/#{username}"))
end

#nameObject



6
7
8
# File 'lib/stars/services/convore.rb', line 6

def name
  "convore"
end

#starsObject



22
23
24
# File 'lib/stars/services/convore.rb', line 22

def stars
  html.css('.stars-received strong').first.content.to_i
end