class STAC::Client::HTTPClient
Attributes
connection[R]
Public Class Methods
new(**options)
click to toggle source
# File lib/stac/client/http_client.rb, line 14 def initialize(**options) options = options.dup options[:headers] = DEFAULT_HEADERS.merge(options[:headers].to_h) @connection = Faraday.new(options) do |conn| conn.request :json conn.response :json conn.response :raise_error # TODO: Raise gem specific errors instead of Faraday errors end end
Public Instance Methods
get(url, params: {}, headers: {})
click to toggle source
Makes a HTTP GET request and returns the response body.
# File lib/stac/client/http_client.rb, line 25 def get(url, params: {}, headers: {}) response = @connection.get(url, params, headers) response.body end
post(url, params: {}, headers: {})
click to toggle source
Makes a HTTP POST request and returns the response body.
# File lib/stac/client/http_client.rb, line 31 def post(url, params: {}, headers: {}) response = @connection.post(url, params, headers) response.body end