Class: EventMachine::Middleware::OAuth2

### Home Classes Methods

### In Files

- lib/em-http/middleware/oauth2.rb

### Parent

Object

### Methods

- ::new
- #request
- #update_uri!

### Included Modules

- EM::HttpEncoding

### Class/Module Index

Quicksearch

- EventMachine
- EventMachine::HTTPMethods
- EventMachine::HttpClient
- EventMachine::HttpClient::CookieJar
- EventMachine::HttpConnection
- EventMachine::HttpDecoders
- EventMachine::HttpDecoders::Base
- EventMachine::HttpDecoders::DecoderError
- EventMachine::HttpDecoders::Deflate
- EventMachine::HttpDecoders::GZip
- EventMachine::HttpDecoders::GZipHeader
- EventMachine::HttpEncoding
- EventMachine::HttpRequest
- EventMachine::HttpResponseHeader
- EventMachine::HttpStatus
- EventMachine::HttpStubConnection
- EventMachine::Middleware
- EventMachine::Middleware::DigestAuth
- EventMachine::Middleware::JSONResponse
- EventMachine::Middleware::OAuth
- EventMachine::Middleware::OAuth2
- EventMachine::MultiRequest
- HttpClientOptions
- HttpConnectionOptions
- String

No matching classes.

# EventMachine::Middleware::OAuth2

### Attributes

access_token[RW]

### Public Class Methods

new(opts={}) click to toggle source

    # File lib/em-http/middleware/oauth2.rb, line 7
    def initialize(opts={})
      self.access_token = opts[:access_token] or raise "No :access_token provided"
    end

### Public Instance Methods

request(client, head, body) click to toggle source

    # File lib/em-http/middleware/oauth2.rb, line 11
    def request(client, head, body)
      uri = client.req.uri.dup
      update_uri! uri
      client.req.set_uri uri

      [head, body]
    end

update_uri!(uri) click to toggle source

    # File lib/em-http/middleware/oauth2.rb, line 19
    def update_uri!(uri)
      if uri.query.nil?
        uri.query = encode_param(:access_token, access_token)
      else
        uri.query += "&#{encode_param(:access_token, access_token)}"
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.