class Zenduty::APIClient
Public Class Methods
new(access_token)
click to toggle source
# File lib/zenduty/api.rb, line 11 def initialize(access_token) @api_url = "https://www.zenduty.com" @access_token = access_token end
Public Instance Methods
_delete(endpoint, body={})
click to toggle source
# File lib/zenduty/api.rb, line 32 def _delete(endpoint, body={}) header = {"Content-type"=>"application/json","Authorization"=>"Token #{@access_token}"} HTTParty.delete(@api_url+endpoint, body:body.to_json, headers:header) end
_get(endpoint,body={})
click to toggle source
# File lib/zenduty/api.rb, line 16 def _get(endpoint,body={}) header = {'Content-type'=> "application/json", "Authorization"=>"Token #{@access_token}"} HTTParty.get(@api_url+endpoint, body:body.to_json, headers: header ) end
_patch(endpoint, body={})
click to toggle source
# File lib/zenduty/api.rb, line 27 def _patch(endpoint, body={}) header = {'Content-type'=> "application/json", "Authorization"=>"Token #{@access_token}"} HTTParty.patch(@api_url+endpoint, body: body.to_json, headers: header) end
_post(endpoint, body={})
click to toggle source
# File lib/zenduty/api.rb, line 21 def _post(endpoint, body={}) #print body header = {'Content-type'=> "application/json", "Authorization"=>"Token #{@access_token}"} HTTParty.post(@api_url+endpoint, body: body.to_json, headers: header) end