Sha256: 8f5f86f62ee89fc6b8c3adadf70dd8365c706c1ccabec788d34f3c5fe2b82d1b

Contents?: true

Size: 775 Bytes

Versions: 1

Compression:

Stored size: 775 Bytes

Contents

module Instagram
  # Defines HTTP request methods
  module OAuth
    # Return URL for OAuth authorization
    def authorize_url(options={})
      options[:response_type] ||= "code"
      params = access_token_params.merge(options)
      connection.build_url("/oauth/authorize/", params).to_s
    end

    # Return an access token from authorization
    def get_access_token(code, options={})
      options[:grant_type] ||= "authorization_code"
      params = access_token_params.merge(options)
      post("/oauth/access_token/", connection.build_url("",params.merge(:code => code)).query, raw=false, unformatted=true)
    end

    private

    def access_token_params
      {
        :client_id => client_id,
        :client_secret => client_secret
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
instagram-innonate-0.8 lib/instagram/oauth.rb