Class: UserStream::API

### Home Classes Methods

### In Files

- lib/user_stream/api.rb

### Parent

Object

### Methods

- ::new
- #access_token
- #consumer
- #get
- #post
- #request

### Class/Module Index

Quicksearch

- UserStream
- UserStream::API
- UserStream::Client
- UserStream::Configuration
- UserStream::Error
- UserStream::Forbidden
- UserStream::NotAcceptable
- UserStream::RangeUnacceptable
- UserStream::RateLimited
- UserStream::ServerInternalError
- UserStream::ServiceOverloaded
- UserStream::TooLong
- UserStream::Unauhtorized
- UserStream::Unknown

No matching classes.

# UserStream::API

### Public Class Methods

new(options = {}) click to toggle source

Creates a new API

    # File lib/user_stream/api.rb, line 12
    def initialize(options = {})
      options = UserStream.options.merge(options)
      Configuration::OPTIONS_KEYS.each do |key|
        send("#{key}=", options[key])
      end
    end

### Public Instance Methods

access_token() click to toggle source

Create a new access token

    # File lib/user_stream/api.rb, line 44
    def access_token
      OAuth::AccessToken.new(consumer, oauth_token, oauth_token_secret)
    end

consumer() click to toggle source

Create a new consumer

    # File lib/user_stream/api.rb, line 39
    def consumer
      OAuth::Consumer.new(consumer_key, consumer_secret, :site => endpoint)
    end

get(path, params = {}, &block) click to toggle source

Perform an HTTP GET request

    # File lib/user_stream/api.rb, line 20
    def get(path, params = {}, &block)
      request(:get, path, params, &block)
    end

post(path, params = {}, &block) click to toggle source

Perform an HTTP POST request

    # File lib/user_stream/api.rb, line 25
    def post(path, params = {}, &block)
      request(:post, path, params, &block)
    end

request(method, path, params = {}, &block) click to toggle source

Perform an HTTP request

    # File lib/user_stream/api.rb, line 30
    def request(method, path, params = {}, &block)
      token = access_token
      http = token.consumer.http
      http.read_timeout = timeout
      request = token.consumer.create_signed_request(method, path, token, {}, params, header)
      process(http, request, &block)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.