Class/Module Index [+]

Quicksearch

Github::Request

Defines HTTP verbs


Defines HTTP verbs

Public Instance Methods

delete_request(path, params={}) click to toggle source
# File lib/github_api/request.rb, line 26
def delete_request(path, params={})
  request(:delete, path, params)
end
get_request(path, params={}) click to toggle source
# File lib/github_api/request.rb, line 10
def get_request(path, params={})
  request(:get, path, params).auto_paginate
end
patch_request(path, params={}) click to toggle source
# File lib/github_api/request.rb, line 14
def patch_request(path, params={})
  request(:patch, path, params)
end
post_request(path, params={}) click to toggle source
# File lib/github_api/request.rb, line 18
def post_request(path, params={})
  request(:post, path, params)
end
put_request(path, params={}) click to toggle source
# File lib/github_api/request.rb, line 22
def put_request(path, params={})
  request(:put, path, params)
end
request(method, path, params, options) click to toggle source
# File lib/github_api/requestable.rb, line 29
def request(method, path, params, options)
  if !METHODS.include?(method)
    raise ArgumentError, "unkown http method: #{method}"
  end
  # _extract_mime_type(params, options)

  puts "EXECUTED: #{method} - #{path} with #{params} and #{options}" if ENV['DEBUG']

  conn = connection(options)
  path = (conn.path_prefix + path).gsub(/\/\//,'/') if conn.path_prefix != '/'

  response = conn.send(method) do |request|
    case method.to_sym
    when *(METHODS - METHODS_WITH_BODIES)
      request.body = params.delete('data') if params.has_key?('data')
      request.url(path, params)
    when *METHODS_WITH_BODIES
      request.path = path
      request.body = extract_data_from_params(params) unless params.empty?
    end
  end
  response.body
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.