Repository URL to install this package:
|
Version:
1.1.1 ▾
|
j_api_agent
/
api_server.rb
|
|---|
require 'j_api_agent'
#resp = JApiAgent::TwitterAgent::TwFriends.all_friends_ids(:screen_name=>'flyerhzm')
#res = JApiAgent::TwitterAgent::TwUserProfile.batch(:delayed,:user_id,resp)
#resp = JApiAgent::TwitterAgent::TwUserProfile.execute(:realtime,:screen_name=>'zyinghai')
#JApiAgent::TwitterCollection::TwProfiles.output_profiles("aa.txt",resp)
#JApiAgent::TwitterCollection::TwProfiles.fetch('zyinghai')
#feed = JApiAgent::RssAgent::RssFeed.execute(:realtime, 'http://feeds.feedburner.com/jugnooblog')
#File.open('Article.txt','w') do |f|
#f.write(feed.map(&:to_json))
#end
require "grape"
class ApiServer < Grape::API
format :json
default_format :json
get "/api" do
JApiAgent::TwitterAgent::TwUserProfile.execute(:realtime, :screen_name => "jugnoome")
end
get "/rss" do
JApiAgent::RssAgent::RssFeed.execute(:realtime,"http://feeds.feedburner.com/JugnooBlog").map { |x| x.to_jsonify }
end
resource "/twitter" do
get "timeline" do
JApiAgent::TwitterAgent::TwHomeFeed.execute(:realtime, :screen_name => "jugnoome").each{|x| x.to_json}
end
get "mentions" do
JApiAgent::TwitterAgent::TwSearch.execute(:realtime, "@jugnoome").each{|x| x.to_json}
end
end
get "/youtube" do
JApiAgent::YoutubeAgent::YoutubeVideos.execute(:realtime, :user => 'jugnoomevideo').each {|x| x.to_json }
end
end