Refactor app in to its own slice
This commit is contained in:
30
slices/main/queries/blogroll/index.rb
Normal file
30
slices/main/queries/blogroll/index.rb
Normal file
@@ -0,0 +1,30 @@
|
||||
require "httparty"
|
||||
|
||||
module Main
|
||||
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
|
Reference in New Issue
Block a user