module OverwatchApi::Request
Public Instance Methods
get(path, options = {})
click to toggle source
# File lib/overwatch_api/request.rb, line 5 def get(path, options = {}) response = request(:get, path, options) raise OverwatchApi::ResponseError.new(response["message"]) unless response.code == 200 return response end
Private Instance Methods
headers()
click to toggle source
# File lib/overwatch_api/request.rb, line 13 def headers raise OverwatchApi::NoApiKeyError .new("No API key set.") unless OverwatchApi.api_key { "X-Mashape-Key" => OverwatchApi.api_key } # @TODO if not on mashape... end
request(method, path, options = {})
click to toggle source
# File lib/overwatch_api/request.rb, line 20 def request(method, path, options = {}) # @TODO probably only GET requests, but to be determined case method when :get options = { headers: headers, query: options } response = OverwatchApi.get( URI.encode(endpoint + path), options ) else raise OverwatchApi::UnsupportedMethodError.new end end