Class: OpenID::SimpleHTTPClient

### Home Classes Methods

### In Files

- lib/openid/consumer.rb

### Parent

Object

### Methods

- #get
- #post

### Class/Module Index

Quicksearch

- OpenID
- OpenID::Association
- OpenID::AssociationManager
- OpenID::AuthenticationError
- OpenID::BaseAssociationManager
- OpenID::Consumer
- OpenID::ConsumerAssociation
- OpenID::DiffieHelmanAssociator
- OpenID::DumbAssociationManager
- OpenID::NoArgumentsError
- OpenID::NoOpenIDArgs
- OpenID::ProtocolError
- OpenID::Request
- OpenID::Response
- OpenID::ServerAssociation
- OpenID::SimpleHTTPClient
- OpenID::UserCancelled
- OpenID::UserSetupNeeded
- OpenID::ValueMismatchError
- String
- String::OpenID
- Bignum
- Crypto_math
- DateTime
- Fixnum

No matching classes.

# OpenID::SimpleHTTPClient

Provides a very simple interface to get from and post to http servers

### Public Instance Methods

get(url) click to toggle source

Returns the the url which was retrieved, and the retrived data (data.base_uri, data)

    # File lib/openid/consumer.rb, line 33
    def get(url)
            uri = URI.parse(url)
            begin
                    data = uri.read
            ensure
                    if data
                            return data.base_uri, data
                    else
                            return nil, nil
                    end
            end
    end

post(url, body) click to toggle source

Takes the url to post body to. Returns the url retrieved, and the body of the response received.

    # File lib/openid/consumer.rb, line 47
    def post(url, body)
            uri = URI.parse(url)
            response = nil
            Net::HTTP.start(uri.host, uri.port) { |http|
                    response = http.post(uri.request_uri(), body)
            }
            # TODO: some error checking here

            # TODO: return actually retrieved url

            return url, response.body
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.