class Api
Public Class Methods
new(api_key)
click to toggle source
# File lib/api.rb, line 5 def initialize(api_key) @api_endpoint = 'https://api.vatzen.com/v1/' @headers = { 'x-api-key' => api_key, 'Content-Type' => 'application/json', 'Accept' => 'application/json' } end
Public Instance Methods
api_get(path, query = {})
click to toggle source
# File lib/api.rb, line 14 def api_get(path, query = {}) response = HTTParty.get(@api_endpoint + path, :query => query, :headers => @headers) response.parsed_response end
api_post(path, body = {}, query = {})
click to toggle source
# File lib/api.rb, line 19 def api_post(path, body = {}, query = {}) response = HTTParty.post(@api_endpoint + path, :body => body.to_json, :query => query, :headers => @headers) response.parsed_response end