forest_liana 1.3.23 → 1.3.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/forest_liana/resources_controller.rb +1 -8
- data/app/services/forest_liana/has_many_getter.rb +6 -1
- data/app/services/forest_liana/operator_date_interval_parser.rb +1 -1
- data/lib/forest_liana/version.rb +1 -1
- metadata +2 -4
- data/app/controllers/forest_liana/actions_controller.rb +0 -15
- data/app/services/forest_liana/activity_logger.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc99c05a0ea02c1b114bb4f3948217c4d5a82115
|
4
|
+
data.tar.gz: 009e5c28b3cb8bec9d11a01fdfc199882753e505
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c092eef29c2f5fc175835fefbcd91c3f7065d9937e01b857c8ed72e9b774cced323ab13892e17418295115ab9f659bde33c7b7de9bcd7def05be560dd1feb36a
|
7
|
+
data.tar.gz: ff7ff0b8899e1dfc42c408462e26fae3f9c83cb2214c5cea448ef4162e7f9ce725d2a62542da4c89e83f0d1d92c19c274723ceb15d8c10c27e4d1b7a8335a244
|
@@ -29,9 +29,6 @@ module ForestLiana
|
|
29
29
|
getter = ResourceCreator.new(@resource, params)
|
30
30
|
getter.perform
|
31
31
|
|
32
|
-
ActivityLogger.new.perform(current_user, 'created', params[:collection],
|
33
|
-
getter.record.id)
|
34
|
-
|
35
32
|
render serializer: nil,
|
36
33
|
json: serialize_model(getter.record, include: includes)
|
37
34
|
end
|
@@ -40,17 +37,13 @@ module ForestLiana
|
|
40
37
|
getter = ResourceUpdater.new(@resource, params)
|
41
38
|
getter.perform
|
42
39
|
|
43
|
-
ActivityLogger.new.perform(current_user, 'updated', params[:collection],
|
44
|
-
getter.record.id)
|
45
|
-
|
46
40
|
render serializer: nil,
|
47
41
|
json: serialize_model(getter.record, include: includes)
|
48
42
|
end
|
49
43
|
|
50
44
|
def destroy
|
51
45
|
@resource.destroy_all(id: params[:id])
|
52
|
-
|
53
|
-
params[:id])
|
46
|
+
|
54
47
|
render nothing: true, status: 204
|
55
48
|
end
|
56
49
|
|
@@ -24,6 +24,11 @@ module ForestLiana
|
|
24
24
|
|
25
25
|
private
|
26
26
|
|
27
|
+
def association_table_name
|
28
|
+
@resource.reflect_on_association(@params[:association_name])
|
29
|
+
.try(:table_name)
|
30
|
+
end
|
31
|
+
|
27
32
|
def offset
|
28
33
|
return 0 unless pagination?
|
29
34
|
|
@@ -56,7 +61,7 @@ module ForestLiana
|
|
56
61
|
field.slice!(0) if order == :desc
|
57
62
|
|
58
63
|
@records = @records
|
59
|
-
.order("#{
|
64
|
+
.order("#{association_table_name}.#{field} #{order.upcase}")
|
60
65
|
else
|
61
66
|
@records
|
62
67
|
end
|
@@ -29,7 +29,7 @@ module ForestLiana
|
|
29
29
|
return nil unless is_interval_date_value()
|
30
30
|
|
31
31
|
match = PERIODS_LAST_X_DAYS.match(@value)
|
32
|
-
return ">= #{Integer(match[1]).day.ago}" if match && match[1]
|
32
|
+
return ">= '#{Integer(match[1]).day.ago}'" if match && match[1]
|
33
33
|
|
34
34
|
duration = PERIODS[@value.to_sym][:duration]
|
35
35
|
period = PERIODS[@value.to_sym][:period]
|
data/lib/forest_liana/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forest_liana
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sandro Munda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -136,7 +136,6 @@ files:
|
|
136
136
|
- app/assets/javascripts/forest_liana/application.js
|
137
137
|
- app/assets/stylesheets/forest_liana/application.css
|
138
138
|
- app/assets/stylesheets/scaffold.css
|
139
|
-
- app/controllers/forest_liana/actions_controller.rb
|
140
139
|
- app/controllers/forest_liana/apimaps_controller.rb
|
141
140
|
- app/controllers/forest_liana/application_controller.rb
|
142
141
|
- app/controllers/forest_liana/associations_controller.rb
|
@@ -160,7 +159,6 @@ files:
|
|
160
159
|
- app/serializers/forest_liana/stripe_card_serializer.rb
|
161
160
|
- app/serializers/forest_liana/stripe_invoice_serializer.rb
|
162
161
|
- app/serializers/forest_liana/stripe_payment_serializer.rb
|
163
|
-
- app/services/forest_liana/activity_logger.rb
|
164
162
|
- app/services/forest_liana/allowed_users_getter.rb
|
165
163
|
- app/services/forest_liana/has_many_getter.rb
|
166
164
|
- app/services/forest_liana/intercom_attributes_getter.rb
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module ForestLiana
|
2
|
-
class ActionsController < ForestLiana::ApplicationController
|
3
|
-
after_action :log_activities
|
4
|
-
|
5
|
-
def log_activities
|
6
|
-
params[:data][:attributes][:ids].each do |record_id|
|
7
|
-
collection = params[:data][:attributes][:collection_name]
|
8
|
-
action_name = "triggered the action \"#{params[:action].capitalize}\""
|
9
|
-
ActivityLogger.new.perform(current_user, action_name, collection,
|
10
|
-
record_id)
|
11
|
-
end
|
12
|
-
true
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'jwt'
|
2
|
-
|
3
|
-
class ForestLiana::ActivityLogger
|
4
|
-
|
5
|
-
def perform(session, action, collection_name, resource_id)
|
6
|
-
uri = URI.parse("#{forest_url}/api/activity-logs")
|
7
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
8
|
-
http.use_ssl = true if forest_url.start_with?('https')
|
9
|
-
|
10
|
-
http.start do |client|
|
11
|
-
request = Net::HTTP::Post.new(uri.path)
|
12
|
-
request['Content-Type'] = 'application/json'
|
13
|
-
request['forest-secret-key'] = ForestLiana.secret_key
|
14
|
-
request.body = {
|
15
|
-
action: action,
|
16
|
-
collection: collection_name,
|
17
|
-
resource: resource_id,
|
18
|
-
user: session['data']['id']
|
19
|
-
}.to_json
|
20
|
-
|
21
|
-
client.request(request)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def forest_url
|
28
|
-
ENV['FOREST_URL'] || 'https://forestadmin-server.herokuapp.com';
|
29
|
-
end
|
30
|
-
end
|