Class: Warden::Oauthed::Oauth::User

Inherits:
Struct
  • Object
show all
Defined in:
lib/warden-oauthed/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attribsObject

Returns the value of attribute attribs

Returns:

  • (Object)

    the current value of attribs



4
5
6
# File 'lib/warden-oauthed/user.rb', line 4

def attribs
  @attribs
end

#tokenObject

Returns the value of attribute token

Returns:

  • (Object)

    the current value of token



4
5
6
# File 'lib/warden-oauthed/user.rb', line 4

def token
  @token
end

Instance Method Details

#oauthed_raw_request(path, _params = {}) ⇒ Object



5
6
7
8
9
10
# File 'lib/warden-oauthed/user.rb', line 5

def oauthed_raw_request(path, _params = {})
  puts "#{ENV['API_BASE_URL']}/#{path}"
  req = Faraday.new(url: "#{ENV['API_BASE_URL']}/#{path}")
  req.authorization :Bearer, token
  req.get.body
end

#oauthed_request(path, params = {}) ⇒ Object



12
13
14
# File 'lib/warden-oauthed/user.rb', line 12

def oauthed_request(path, params = {})
  MultiJson.load(oauthed_raw_request(path, params))
end