lib/yammer-oauth2/client.rb in yammer-oauth2-0.3.1 vs lib/yammer-oauth2/client.rb in yammer-oauth2-0.3.2

- old
+ new

@@ -6,11 +6,11 @@ DEFAULT_URL = 'https://www.yammer.com' def initialize(client_id, client_secret, opts={}) site_url = opts.delete(:site_url) || DEFAULT_URL super(site_url, client_id, client_secret, opts) - @token_path = '/oauth2/token' + @token_path = '/oauth2/access_token' @authorize_path = '/dialogs/oauth' yield self if block_given? self end @@ -57,19 +57,20 @@ # @see https://developer.yammer.com/api/oauth2.html#server-side # # @opts [Hash] additional parameters to be include in URL eg. scope, state, etc # # >> client = YammerClient.new(config) - # >> client.webserver_authorization_url({ + # >> client.webserver_token_url({ # :client_secret => @client_secret # :code => 'G3Y6jU3a', # :redirect_uri => 'https://localhost/oauth/cb', # }) # >> https://www.yammer.com/oauth2/access_token?client_id={client_id}& # redirect_uri=http%3A%2F%2Flocalhost%2Foauth%2Fcb&client_secret={client_secret}& # grant_type=authorization_code&code=aXW2c6bYz # - def webserver_token_url(opts={}) + def webserver_token_path(code, opts={}) + opts[:code] = code opts[:scope] = normalize_scope(opts[:scope]) if opts[:scope] opts[:client_secret] = @client_secret authorization_code.token_path(opts) end