Sha256: deda51d86c3e1e7e432375a835ce6fa49d784fbdafce2a99356535e0d7cec69f

Contents?: true

Size: 657 Bytes

Versions: 1

Compression:

Stored size: 657 Bytes

Contents

require 'instapaper/credentials'
require 'instapaper/http/qline_parser'

module Instapaper
  module API
    # Defines methods related to OAuth
    module OAuth
      # Gets an OAuth access token for a user.
      def access_token(username, password)
        response = perform_post_with_unparsed_response('/api/1.1/oauth/access_token', x_auth_username: username, x_auth_password: password, x_auth_mode: 'client_auth')
        parsed_response = QLineParser.parse(response)
        raise Instapaper::Error::OAuthError, parsed_response['error'] if parsed_response.key?('error')

        Instapaper::Credentials.new(parsed_response)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
instapaper-1.0.1 lib/instapaper/api/oauth.rb