module DesignerNews::Connection
Public Instance Methods
connection()
click to toggle source
# File lib/designer_news/mixins/connection.rb, line 8 def connection @connection ||= Faraday.new(url: @api_endpoint, builder: @middleware) do |conn| conn.headers[:user_agent] = user_agent conn.headers[:Authorization] = "Bearer #{access_token}" end end
request(method, path, data, options={})
click to toggle source
# File lib/designer_news/mixins/connection.rb, line 3 def request(method, path, data, options={}) @last_response = response = connection.send(method, URI.encode(path.to_s), data, options) JSON.parse(response.body) end