class Oauth::Models::Consumers::SimpleClient
This is just a simple
Attributes
token[R]
Public Class Methods
new(token)
click to toggle source
# File lib/oauth/models/consumers/simple_client.rb, line 9 def initialize(token) @token = token end
Public Instance Methods
delete(path)
click to toggle source
# File lib/oauth/models/consumers/simple_client.rb, line 18 def delete(path) parse(token.delete(path, {'Accept' => 'application/json'})) end
get(path)
click to toggle source
# File lib/oauth/models/consumers/simple_client.rb, line 26 def get(path) parse(token.get(path, {'Accept' => 'application/json'})) end
post(path,params={})
click to toggle source
# File lib/oauth/models/consumers/simple_client.rb, line 22 def post(path,params={}) parse(token.post(path,params, {'Accept' => 'application/json'})) end
put(path,params={})
click to toggle source
# File lib/oauth/models/consumers/simple_client.rb, line 14 def put(path,params={}) parse(token.put(path,params, {'Accept' => 'application/json'})) end
Protected Instance Methods
parse(response)
click to toggle source
# File lib/oauth/models/consumers/simple_client.rb, line 32 def parse(response) return false unless response if ["200","201"].include? response.code unless response.body.blank? JSON.parse(response.body) else true end else logger.debug "Got Response code: #{response.code}" false end end