Module: Jibeset::OAuth

Included in:
API
Defined in:
lib/jibeset/oauth.rb

Overview

Defines HTTP request methods

Instance Method Summary collapse

Instance Method Details

#authorize_url(options = {}) ⇒ Object

Return URL for OAuth authorization



5
6
7
8
9
10
11
# File 'lib/jibeset/oauth.rb', line 5

def authorize_url(options={})
  options[:response_type] ||= "code"
  options[:redirect_uri] = oauth_callback
  authorize_path = options[:authorize_path] || "/oauth/authorize/"
  params = access_token_params.merge(options)
  connection.build_url(authorize_path, params).to_s
end

#get_access_token(code, options = {}) ⇒ Object

Return an access token from authorization



14
15
16
17
18
19
# File 'lib/jibeset/oauth.rb', line 14

def get_access_token(code, options={})
  options[:grant_type] ||= "authorization_code"
  options[:redirect_uri] = oauth_callback
  params = access_token_params.merge(options)
  post("/oauth/token/", params.merge(:code => code), false, unformatted=true)
end