forked from Gitlink/forgeplus
merge from develop
This commit is contained in:
commit
29bfeabb20
|
@ -8,8 +8,11 @@ class Trace::ClientService < ApplicationService
|
|||
def authed_post(token, url, params={})
|
||||
puts "[trace][POST] request params: #{params}"
|
||||
puts "[trace][POST] request token: #{token}"
|
||||
conn.headers['Authorization'] = token
|
||||
conn.post(full_url(url), params[:data])
|
||||
conn.post do |req|
|
||||
req.url full_url(url, 'post')
|
||||
req.headers['Authorization'] = token
|
||||
req.body = params[:data].as_json
|
||||
end
|
||||
end
|
||||
|
||||
def http_authed_post(token, url, params={})
|
||||
|
@ -55,8 +58,11 @@ class Trace::ClientService < ApplicationService
|
|||
def authed_delete(token, url, params={})
|
||||
puts "[trace][DELETE] request params: #{params}"
|
||||
puts "[trace][DELETE] request token: #{token}"
|
||||
conn.headers['Authorization'] = token
|
||||
conn.delete(full_url(url), params[:data])
|
||||
conn.delete do |req|
|
||||
req.url full_url(url, 'delete')
|
||||
req.headers['Authorization'] = token
|
||||
req.body = params[:data].as_json
|
||||
end
|
||||
end
|
||||
|
||||
def patch(url, params={})
|
||||
|
@ -67,8 +73,11 @@ class Trace::ClientService < ApplicationService
|
|||
def authed_patch(token, url, params={})
|
||||
puts "[trace][PATCH] request params: #{params}"
|
||||
puts "[trace][PATCH] request token: #{token}"
|
||||
conn.headers['Authorization'] = token
|
||||
conn.patch(full_url(url), params[:data])
|
||||
conn.patch do |req|
|
||||
req.url full_url(url, 'patch')
|
||||
req.headers['Authorization'] = token
|
||||
req.body = params[:data].as_json
|
||||
end
|
||||
end
|
||||
|
||||
def put(url, params={})
|
||||
|
@ -79,8 +88,11 @@ class Trace::ClientService < ApplicationService
|
|||
def authed_put(token, url, params={})
|
||||
puts "[trace][PUT] request params: #{params}"
|
||||
puts "[trace][PUT] request token: #{token}"
|
||||
conn.headers['Authorization'] = token
|
||||
conn.put(full_url(url), params[:data])
|
||||
conn.put do |req|
|
||||
req.url full_url(url, 'put')
|
||||
req.headers['Authorization'] = token
|
||||
req.body = params[:data].as_json
|
||||
end
|
||||
end
|
||||
|
||||
def conn
|
||||
|
|
Loading…
Reference in New Issue