lib/chatrix/matrix.rb
# Helper method for performing requests to the homeserver.
#
# @param method [Symbol] HTTP request method to use. Use only symbols
#   available as keys in {METHODS}.
# @param path [String] The API path to query, relative to the base
#   API path, eg. `/login`.
# @param opts [Hash] Additional request options.
#
# @option opts [Hash] :params Additional parameters to include in the
#   query string (part of the URL, not put in the request body).
# @option opts [Hash,#read] :content Content to put in the request body.
#   If set, must be a Hash or a stream object.
# @option opts [Hash{String => String}] :headers Additional headers to
#   include in the request.
# @option opts [String,nil] :base If this is set, it will be used as the
#   base URI for the request instead of the default (`@base_uri`).
#
# @yield [fragment] HTTParty will call the block during the request.
#
# @return [HTTParty::Response] The HTTParty response object.
Helper method for performing requests to the homeserver.
Helper method for performing requests to the homeserver .
def make_request(method, path, opts = {}, &block)
      path = (opts[:base] || @base_uri) + URI.encode(path)
      options = make_options opts[:params], opts[:content], opts[:headers]
      parse_response METHODS[method].call(path, options, &block)
    end
def make_request ( method , path , opts = { } , & block ) path = ( opts [ :base ] || @base_uri ) + URI . encode ( path ) options = make_options opts [ :params ] , opts [ :content ] , opts [ :headers ] parse_response METHODS [ method ] . call ( path , options , & block ) end
Helper method for performing requests to the homeserver.
Helper method for performing requests to the homeserver .
The HTTParty response object.
The HTTParty response object .
HTTParty::Response
method
HTTP request method to use. Use only symbols available as keys in {METHODS}.
HTTP request method to use . Use only symbols available as keys in { METHODS } .
path
The API path to query, relative to the base API path, eg.
The API path to query relative to the base API path eg .
opts
:base If this is set, it will be used as the base URI for the request instead of the default (`@base_uri`).
: base If this is set it will be used as the base URI for the request instead of the default ( ` @base_uri ` ) .
block
]
HTTParty will call the block during the request.
HTTParty will call the block during the request .