module Scalingo::Request
Constants
- REQUEST_METHODS
Protected Instance Methods
request(method, path, options)
click to toggle source
# File lib/scalingo/request.rb, line 19 def request(method, path, options) auth_api = options.delete(:auth_api) endpoint = options.delete(:endpoint) connection = build_connection if auth_api connection.url_prefix = URI(auth_endpoint) elsif endpoint connection.url_prefix = endpoint else raise MissingRegion if !region connection.url_prefix = URI(region_api_endpoint(region)) end response = connection.send(method) do |request| request.headers['Authorization'] = "Bearer #{current_jwt}" case method when :get, :delete request.url(path, options) when :post, :patch, :put request.path = path request.body = options if !options.empty? end end return response.body end