Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class TagsController < ApplicationController
- def index
- @tags = Tags.find(:all, :order => "count DESC")
- end
- def update
- @user = "..."
- @pass = "..."
- @path = "/v1/tags/get"
- http = Net::HTTP.new('api.del.icio.us', 443)
- http.use_ssl = true
- http.start { |http|
- req = Net::HTTP::Get.new(@path, {'User-Agent' => 'PecK AF83IsDelicious 0.2'})
- req.basic_auth('@user', '@pass')
- @xml = http.request(req).body
- }
- REXML::Document.new(@xml).elements.each('tags/tag') do |element|
- @t = Tags.new
- @t.count = element.attributes['count']
- @t.tag = element.attributes['tag']
- @t.save
- end
- redirect_to(:action => 'index')
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement