This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################# | |
# VENUE SEARCH => http://www.lastfm.fr/api/show?service=396 # | |
# TRACK SEARCH => http://www.lastfm.fr/api/show?service=286 # | |
# ARTIST SEARCH => http://www.lastfm.fr/api/show?service=272 # | |
# ALBUM SEARCH => http://www.lastfm.fr/api/show?service=357 # | |
################################################################# | |
@keyword = params[:search][:keyword] | |
keyword = CGI::escape(@keyword) | |
api = "xxxxx" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def google_login # securite faible | |
if params[:token] | |
user = User.find(session[:user]) | |
token = params[:token] | |
http = Net::HTTP.new('www.google.com', 443) | |
http.use_ssl = true | |
path = '/accounts/AuthSubSessionToken' | |
headers = {'Authorization' => "AuthSubtoken=\"#{token}\""} | |
resp, data = http.get(path, headers) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@keyword = params[:search][:keyword] | |
keyword = CGI::escape(@keyword) | |
api = "xxxxx" | |
method = "flickr.photos.search" | |
remote_url = "http://api.flickr.com/services/rest/?method=#{method}&api_key=#{api}&tags=#{keyword}&per_page=20" | |
@doc = Hpricot.parse(open(remote_url)) | |
render(:update) do |page| | |
page.replace_html "api_content", :partial => "flickr/search" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def photo | |
@photo_url = CGI::unescape("#{params[:photo_url]}") | |
id = params[:id] | |
# affiche la photo sur son format le plus grand dispo dans l'api | |
# la photo n'est pour le moment pas enregistré | |
# l'appel est caché | |
check = Item.find(:first, :conditions => {:item_type_id => 5, :remote_url => @photo_url}) | |
if check.nil? | |
api = "xxxxxx" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@photoset_id = params[:id] | |
api_key = "xxxxx" | |
method = "flickr.photosets.getPhotos" | |
remote_url = "http://api.flickr.com/services/rest/?method=#{method}&api_key=#{api_key}&photoset_id=#{@photoset_id}" | |
@doc = Hpricot.parse(open(remote_url)) | |
******* | |
- @doc.search('photo').collect do |e| | |
- id = e['id'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'rexml/document' | |
http = Net::HTTP.new('docs.google.com', 80) | |
path = "/feeds/documents/private/full" | |
headers = {'Authorization' => "AuthSubtoken=\"#{api.token}\""} | |
resp, data = http.get(path, headers) | |
@doc = Hpricot.XML(open(data.body)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
http = Net::HTTP.new('www.google.com', 80) | |
path = "/m8/feeds/contacts/default/base?max-results=10000" | |
headers = {'Authorization' => "AuthSubtoken=\"#{api.token}\""} | |
resp, data = http.get(path, headers) | |
@doc = Hpricot.XML(open(data.body)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'rexml/document' | |
http = Net::HTTP.new('www.google.com', 80) | |
path = "/calendar/feeds/default/private/full" | |
headers = {'Authorization' => "AuthSub token=\"#{api.token}\"", "GData-Version" => "2"} | |
resp, data = http.get(path, headers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'rexml/document' | |
http = Net::HTTP.new('www.google.com', 443) | |
http.use_ssl = true | |
path = "/webmasters/tools/feeds/sites/" | |
headers = {'Authorization' => "AuthSub token=\"#{api.token}\""} | |
resp, data = http.get(path, headers) | |
@doc = Hpricot.XML(open(data.body)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'rexml/document' | |
http = Net::HTTP.new('finance.google.com', 80) | |
path = "/finance/feeds/default/portfolios" | |
headers = {'Authorization' => "AuthSubtoken=\"#{api.token}\""} | |
resp, data = http.get(path, headers) | |
@doc = Hpricot.XML(open(data.body)) |