Class: ApontadorOauth2::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/apontador_oauth2/request.rb

Class Method Summary collapse

Class Method Details

.json(data) ⇒ Object



15
16
17
# File 'lib/apontador_oauth2/request.rb', line 15

def self.json(data)
 JSON.parse(data)
end

.send(options) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/apontador_oauth2/request.rb', line 3

def self.send(options)
  conn = Faraday.new(:url => options[:url])
  res = conn.get do |req|
    req.url(options[:path])
    req.headers['Content-Type']  =  "application/json"
    req.headers['Authorization'] =  "Bearer #{options[:token]}"
    req.headers['Accept']        =  "application/json"
    req.body = {:user => options[:user]}.to_json if options[:user]
  end
 res
end