lib/dnsimple/client/oauth.rb in dnsimple-3.0.0.pre.beta2 vs lib/dnsimple/client/oauth.rb in dnsimple-3.0.0

- old
+ new

@@ -11,11 +11,11 @@ # @param client_secret [String] Client Secret you received when the application was registered with DNSimple. # @option options [String] :redirect_uri The redirect URL sent for the authorization, used to validate the request. # @return [String] The url to redirect the user to authorize. def exchange_authorization_for_token(code, client_id, client_secret, options = {}) attributes = { code: code, client_id: client_id, client_secret: client_secret, grant_type: "authorization_code" } - attributes[:state] = options.delete(:state) if options.has_key?(:state) - attributes[:redirect_uri] = options.delete(:redirect_uri) if options.has_key?(:redirect_uri) + attributes[:state] = options.delete(:state) if options.key?(:state) + attributes[:redirect_uri] = options.delete(:redirect_uri) if options.key?(:redirect_uri) response = client.post(Client.versioned("/oauth/access_token"), attributes, options) Struct::OauthToken.new(response) end # Gets the URL to authorize an user for an application via the OAuth2 flow.