Sha256: 1b3accd2e23622abcb2ea02c4c4bb92af4cf5573eb0a44f6284d7b3b5187c30b
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
require 'rest_client' module Airborne module RestClientRequester def make_request(method, url, options = {}) headers = base_headers.merge(options[:headers] || {}) res = if method == :post || method == :patch || method == :put begin request_body = options[:body].nil? ? '' : options[:body] request_body = request_body.to_json if options[:body].is_a?(Hash) RestClient::Request.execute(:method => method, :url => get_url(url), :payload => request_body, :headers => headers , :verify_ssl => Airborne.configuration.verify_ssl) rescue RestClient::Exception => e e.response end else begin RestClient::Request.execute(:method => method, :url => get_url(url), :headers => headers, :verify_ssl => Airborne.configuration.verify_ssl) rescue RestClient::Exception => e e.response end end res end private def base_headers { content_type: :json }.merge(Airborne.configuration.headers || {}) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hops-airborne-0.2.16 | lib/airborne/rest_client_requester.rb |
hops-airborne-0.2.15 | lib/airborne/rest_client_requester.rb |