class OmniAuth::Strategies::FreshBooks
Public Instance Methods
callback_phase()
click to toggle source
Calls superclass method
# File lib/omniauth/strategies/freshbooks.rb, line 59 def callback_phase options.client_options.site = session["oauth"][name.to_s]["site"] if session["oauth"].present? super end
raw_info()
click to toggle source
# File lib/omniauth/strategies/freshbooks.rb, line 64 def raw_info @raw_info ||= MultiXml.parse(access_token.post("/api/2.1/xml-in", '<?xml version="1.0" encoding="utf-8"?><request method="staff.current"></request>').body).fetch("response").fetch("staff") end
redirect(*args)
click to toggle source
Calls superclass method
# File lib/omniauth/strategies/freshbooks.rb, line 36 def redirect(*args) session["oauth"][name.to_s].merge!({ "site" => options.client_options.site }) super end
request_phase()
click to toggle source
Calls superclass method
# File lib/omniauth/strategies/freshbooks.rb, line 43 def request_phase options.client_options.site = options.site.presence || session["omniauth.params"]["site"].presence unless options.client_options.site OmniAuth::Form.build(title: (options.title.presence || "FreshBooks Authentication")) do |form| form.text_field "URL", "site" end.to_response else super end rescue URI::InvalidURIError return fail!(:invalid_site) rescue Net::HTTPRetriableError return fail!(:invalid_site) end