module LinkedinV2::Helpers::Handler
Public Instance Methods
conn(api)
click to toggle source
# File lib/linkedin_v2/helpers/handler.rb, line 12 def conn(api) RestClient::Resource.new(api, headers: headers) end
headers()
click to toggle source
# File lib/linkedin_v2/helpers/handler.rb, line 16 def headers { "Authorization": "Bearer #{token}", "Content-Type": "application/json", } end
post_headers()
click to toggle source
# File lib/linkedin_v2/helpers/handler.rb, line 20 def post_headers { "X-Restli-Protocol-Version": "2.0.0" } end
request(method, endpoint, params = {}, additional_headers = {}, api = API_URL)
click to toggle source
# File lib/linkedin_v2/helpers/handler.rb, line 4 def request(method, endpoint, params = {}, additional_headers = {}, api = API_URL) attrs = [ params, additional_headers ].reject(&:empty?) JSON.parse(conn(api)[endpoint].public_send(method, *attrs)) rescue RestClient::ExceptionWithResponse => exception raise LinkedinResponseError.new("response error", details: exception.response) end