class Openlive::Request

Public Class Methods

delete(path, params = {}, headers = {}) click to toggle source

Perform a delete request against the OpenLIVE API.

@param [String] path the URI path to perform the request against @param [Hash] params @param [Hash] headers

@return [Openlive::Response]

# File lib/openlive/request.rb, line 49
def delete(path, params = {}, headers = {})
  headers["Content-Type"] ||= "application/json"

  response = connection.send(
    :delete,
    path,
    params,
    default_headers.merge(headers)
  )

  Response.new(response)
end
get(path, params = {}, headers = {}) click to toggle source

Perform a get request against the OpenLIVE API.

@param [String] path the URI path to perform the request against @param [Hash] params @param [Hash] headers

@return [Openlive::Response]

# File lib/openlive/request.rb, line 11
def get(path, params = {}, headers = {})
  response = connection.send(
    :get,
    path,
    default_params.merge(params),
    default_headers.merge(headers)
  )

  Response.new(response)
end
post(path, params = {}, headers = {}) click to toggle source

Perform a post request against the OpenLIVE API.

@param [String] path the URI path to perform the request against @param [Hash] params @param [Hash] headers

@return [Openlive::Response]

# File lib/openlive/request.rb, line 29
def post(path, params = {}, headers = {})
  headers["Content-Type"] ||= "application/json"

  response = connection.send(
    :post,
    path,
    JSON.generate(default_params.merge(params)),
    default_headers.merge(headers)
  )

  Response.new(response)
end

Private Class Methods

default_headers() click to toggle source
# File lib/openlive/request.rb, line 68
def default_headers
  {}
end
default_params() click to toggle source
# File lib/openlive/request.rb, line 64
def default_params
  {}
end