A class responsible for dispatching http requests
Defined Under NamespaceModules: Verbs Classes: BasicAuth, Jsonize, OAuth2
Constant Summary collapse[:get, :head, :post, :put, :delete, :patch]
[:post, :put, :patch]
Constants::ACCEPT, Constants::ACCEPTED_OAUTH_SCOPES, Constants::ACCEPT_CHARSET, Constants::CACHE_CONTROL, Constants::CONTENT_LENGTH, Constants::CONTENT_TYPE, Constants::DATE, Constants::ETAG, Constants::HEADER_LAST, Constants::HEADER_LINK, Constants::HEADER_NEXT, Constants::LOCATION, Constants::META_FIRST, Constants::META_LAST, Constants::META_NEXT, Constants::META_PREV, Constants::META_REL, Constants::OAUTH_SCOPES, Constants::PARAM_PAGE, Constants::PARAM_PER_PAGE, Constants::PARAM_START_PAGE, Constants::RATELIMIT_LIMIT, Constants::RATELIMIT_REMAINING, Constants::RATELIMIT_RESET, Constants::SERVER, Constants::USER_AGENT
Instance Attribute Summary collapseReturn http verb.
Return api this request is associated with.
Return url.
Performs a request.
Create a new Request.
#connection, #default_headers, #default_options, #stack
Constructor Details #initialize(action, path, api) ⇒ Github::Request38 39 40 41 42
# File 'lib/github_api/request.rb', line 38 def initialize(action, path, api) @action = action @path = path @api = api endInstance Attribute Details #action ⇒ Symbol
21 22 23
# File 'lib/github_api/request.rb', line 21 def action @action end#api ⇒ Github::API
Return api this request is associated with
31 32 33
# File 'lib/github_api/request.rb', line 31 def api @api end#path ⇒ String
26 27 28
# File 'lib/github_api/request.rb', line 26 def path @path endInstance Method Details #call(current_options, params) ⇒ Github::ResponseWrapper
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Performs a request
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
# File 'lib/github_api/request.rb', line 52 def call(current_options, params) unless HTTP_METHODS.include?(action) raise ArgumentError, "unknown http method: #{action}" end puts "EXECUTED: #{action} - #{path} with PARAMS: #{params.request_params}" if ENV['DEBUG'] request_options = params.options connection_options = current_options.merge(request_options) conn = connection(api, connection_options) self.path = Utils::Url.normalize(self.path) if conn.path_prefix != '/' && self.path.index(conn.path_prefix) != 0 self.path = (conn.path_prefix + self.path).gsub(/\/(\/)*/, '/') end response = conn.send(action) do |request| case action.to_sym when *(HTTP_METHODS - METHODS_WITH_BODIES) request.body = params.data if params.key?('data') if params.key?('encoder') request.params.params_encoder(params.encoder) end request.url(self.path, params.request_params) when *METHODS_WITH_BODIES request.url(self.path, connection_options[:query] || {}) request.body = params.data unless params.empty? end end ResponseWrapper.new(response, api) end
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4