telegram_bot_engine 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 14f170bf1a00f88a7a92e5f5a5715903855c3b84370d5aee33356ee6596494f7
|
|
4
|
+
data.tar.gz: e853b4600c0a4961283fad2f1c01bc71e9b488411e0a51a998504cfb3b1dd479
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d9c5d4a8be4625cfdfe64b9b874aea384e71811f1561122e5a3c0bfbf9dfba4c22d8fea604d3e98dde9f9fadff4939c36d8ffe4ebb1a9e869a48e279f001b21b
|
|
7
|
+
data.tar.gz: 53df73d3e4df5db59527a3604bad4be9fb601febc20ec507174ff5e795b0f2ca6595f37e3d15128b6fc3dfcc2b126afb55a08d03080fb6e5e30042fbf8262f53
|
|
@@ -7,11 +7,16 @@ module TelegramBotEngine
|
|
|
7
7
|
|
|
8
8
|
def index
|
|
9
9
|
unless Event.table_exists?
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
respond_to do |format|
|
|
11
|
+
format.html do
|
|
12
|
+
@events = []
|
|
13
|
+
@total_count = 0
|
|
14
|
+
@page = 1
|
|
15
|
+
@total_pages = 0
|
|
16
|
+
flash.now[:alert] = "Events table not found. Run: rails telegram_bot_engine:install:migrations && rails db:migrate"
|
|
17
|
+
end
|
|
18
|
+
format.json { render json: { error: "Events table not found" }, status: :service_unavailable }
|
|
19
|
+
end
|
|
15
20
|
return
|
|
16
21
|
end
|
|
17
22
|
|
|
@@ -24,6 +29,31 @@ module TelegramBotEngine
|
|
|
24
29
|
@page = [params[:page].to_i, 1].max
|
|
25
30
|
@events = @events.offset((@page - 1) * PER_PAGE).limit(PER_PAGE)
|
|
26
31
|
@total_pages = (@total_count.to_f / PER_PAGE).ceil
|
|
32
|
+
|
|
33
|
+
respond_to do |format|
|
|
34
|
+
format.html
|
|
35
|
+
format.json do
|
|
36
|
+
render json: {
|
|
37
|
+
events: @events.map { |e|
|
|
38
|
+
{
|
|
39
|
+
id: e.id,
|
|
40
|
+
event_type: e.event_type,
|
|
41
|
+
action: e.action,
|
|
42
|
+
chat_id: e.chat_id,
|
|
43
|
+
username: e.username,
|
|
44
|
+
details: e.details,
|
|
45
|
+
created_at: e.created_at.iso8601
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
meta: {
|
|
49
|
+
total_count: @total_count,
|
|
50
|
+
page: @page,
|
|
51
|
+
total_pages: @total_pages,
|
|
52
|
+
per_page: PER_PAGE
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
end
|
|
56
|
+
end
|
|
27
57
|
end
|
|
28
58
|
end
|
|
29
59
|
end
|