Class: StumbleUpon::Favourites

Inherits:
Site
  • Object
show all
Defined in:
lib/stumbleupon.rb

Instance Attribute Summary

Attributes inherited from Site

#posts

Instance Method Summary collapse

Methods inherited from Site

#ask_for_credentials, #balance, #credentials, #credentials=, #date, #identifier, #imported_links, #initialize, #save!, #to_post, #to_s, #undo_import!

Constructor Details

This class inherits a constructor from Site

Instance Method Details

#nameObject



11
12
13
# File 'lib/stumbleupon.rb', line 11

def name
  "stumbleupon"
end

#update!Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/stumbleupon.rb', line 15

def update!
  puts "Updating Stumbleupon"
  balance
  i = 0

  results = []
  new_results = nil

  while !new_results || !new_results.empty?
    puts "fetching stumbleupon page #{i}"
    new_results = StumbleUpon.fetch_page(credentials["user"], i).select{|x| !@ids.include? identifier(x)}

    results += new_results
    i += 1
  end


  @posts += results
  balance
  results.map{|u| to_post(u)}
end