Files
adamantium/app/queries/blogroll/index.rb
2024-02-11 14:40:46 +11:00

31 lines
751 B
Ruby

require "httparty"
module Adamantium
module Queries
module Blogroll
class Index
include Deps["settings"]
def call
resp = HTTParty.get("https://#{settings.rss_url}/api/greader.php/reader/api/0/subscription/list?output=json", {
headers: {
"Authorization" => "GoogleLogin auth=#{auth_token}"
}
})
resp.body
end
private
def auth_token
auth_url = "https://#{settings.rss_url}/api/greader.php/accounts/ClientLogin?Email=#{settings.rss_username}&Passwd=#{settings.rss_password}"
resp = HTTParty.get(auth_url)
auth = resp.match(/SID=(.*)/)
auth[1].strip
end
end
end
end
end