5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'app/services/forest_liana/activity_logger.rb', line 5
def perform(session, action, collection_name, resource_id)
uri = URI.parse("#{forest_url}/api/activity-logs")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if forest_url.start_with?('https')
http.start do |client|
request = Net::HTTP::Post.new(uri.path)
request['Content-Type'] = 'application/json'
request['forest-secret-key'] = ForestLiana.secret_key
request.body = {
action: action,
collection: collection_name,
resource: resource_id,
user: session['data']['id']
}.to_json
client.request(request)
end
end
|