class Denotificator::APIClient
Attributes
auth_token[R]
connection[R]
user_agent[R]
Public Class Methods
new(url, user_agent, auth_token)
click to toggle source
# File lib/denotificator/api_client.rb, line 7 def initialize url, user_agent, auth_token @connection = Faraday.new url: url @user_agent = user_agent @auth_token = auth_token end
Public Instance Methods
get_http_response(uri)
click to toggle source
# File lib/denotificator/api_client.rb, line 13 def get_http_response uri connection.get uri, &headers end
headers()
click to toggle source
# File lib/denotificator/api_client.rb, line 21 def headers -> request { request.headers['User-Agent'] = user_agent request.headers['Authorization'] = "token #{auth_token}" } end
put_http_response(uri, payload)
click to toggle source
# File lib/denotificator/api_client.rb, line 17 def put_http_response uri, payload connection.put uri, &headers end