Class: Paprite::Proxy
- Inherits:
-
Object
- Object
- Paprite::Proxy
- Defined in:
- lib/paprite/proxy/proxy.rb
Class Method Summary collapse
-
.authenticate(domain, ip) ⇒ Object
Tells papr to request first OAuth token, as well as provides the domain for the callback url to be constructed off of.
-
.callback(verifier) ⇒ Object
forwards the OAuth verifier to Papr.
-
.confirm_login(user) ⇒ Object
– papr.
-
.ping_loop ⇒ Object
Pings Papr every second (after a 4sec delay) to see if authentication is completed Papr will respond with either ‘false’ if uncomplete or with a unique string to be saved into a cookie.
Class Method Details
.authenticate(domain, ip) ⇒ Object
Tells papr to request first OAuth token, as well as provides the domain for the callback url to be constructed off of.
11 12 13 14 15 16 |
# File 'lib/paprite/proxy/proxy.rb', line 11 def authenticate(domain, ip) url = "http://papr.heroku.com/twitter/authenticate?domain=#{domain.to_s}&ip=#{ip.to_s}" res = Net::HTTP.get_response(URI.parse(url)) response = res.body return response end |
.callback(verifier) ⇒ Object
forwards the OAuth verifier to Papr
29 30 31 32 33 34 |
# File 'lib/paprite/proxy/proxy.rb', line 29 def callback(verifier) url = 'http://papr.heroku.com/twitter/callback?oauth_verifier=' + verifier.to_s res = Net::HTTP.get_response(URI.parse(url)) response = res.body return response end |
.confirm_login(user) ⇒ Object
– papr
37 38 39 40 41 42 |
# File 'lib/paprite/proxy/proxy.rb', line 37 def confirm_login(user) url = 'http://papr.heroku.com/confirm/login?user=' + user res = Net::HTTP.get_response(URI.parse(url)) response = res.body return response end |
.ping_loop ⇒ Object
Pings Papr every second (after a 4sec delay) to see if authentication is completed Papr will respond with either ‘false’ if uncomplete or with a unique string to be saved into a cookie
21 22 23 24 25 26 |
# File 'lib/paprite/proxy/proxy.rb', line 21 def ping_loop url = 'http://papr.heroku.com/twitter/ping_loop' res = Net::HTTP.get_response(URI.parse(url)) response = res.body return response end |