Sha256: a64e383f02ceb70391c0b242d8c0b76b93b8e701791ff45569730a7948576447

Contents?: true

Size: 556 Bytes

Versions: 1

Compression:

Stored size: 556 Bytes

Contents

module Instapaper
  class Client
    # Defines methods related to users
    module User

      # Gets an OAuth access token for a user.
      def access_token(username, password)
        response = post('oauth/access_token', { :x_auth_username => username, :x_auth_password => password, :x_auth_mode => "client_auth"}, true)
        params = response.body.split("&")
        values = params.map {|part| part.split("=") }.flatten
        if values.length == 1
          values.unshift('error')
        end
        Hash[*values]
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
instapaper-0.3.0 lib/instapaper/client/user.rb