galerts 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/galerts/defaults.rb +1 -5
- data/lib/galerts/manager.rb +17 -17
- data/lib/galerts/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcec32e3b8383a1aa6771821c6332a7880a0c968
|
4
|
+
data.tar.gz: 4ad04df3667af46fa3da7e5fd8ee11a913aa268d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a33bdb5177e1ed786f3c8cd7b5b5471257d6bee8f59aa5655d6ae6e80d39d2c8291ac206cd5c89f78c9b5fdd90651203b3ba1b0e688b2ed017aa0b3f9483f69a
|
7
|
+
data.tar.gz: dd314ed9515f10f312febdcfb6180dec6b1ccabdcb5cfe368657bc33f37f55347aca49045f62c81bf51bc8eaba74812c40ce27a18116268a9f8c5d1786c4b2d0
|
data/README.md
CHANGED
@@ -15,8 +15,8 @@ alerts webpage.
|
|
15
15
|
- Create new alert for any google domain.
|
16
16
|
- Update existing alert.
|
17
17
|
- Delete an alert.
|
18
|
-
- Find alerts by query, id, data_id, feed_url, domain, language,
|
19
|
-
region, delivery.
|
18
|
+
- Find alerts by query, id, data_id, data_id_2, feed_url, domain, language,
|
19
|
+
how_many, region, delivery.
|
20
20
|
|
21
21
|
## Installation
|
22
22
|
|
data/lib/galerts/defaults.rb
CHANGED
@@ -20,6 +20,7 @@ module Galerts
|
|
20
20
|
ALERT_SOMETHING_WENT_WRONG = "[null,7,null,\"\"]"
|
21
21
|
ALERT_NOT_EXIST = "[null,5,null,\"\"]"
|
22
22
|
ALERT_LIMIT_EXCEEDED = "[null,4,null,\"\"]"
|
23
|
+
|
23
24
|
# Google Value
|
24
25
|
BEST_RESULTS = 'Only the best results'
|
25
26
|
ALL_RESULTS = 'All results'
|
@@ -29,7 +30,6 @@ module Galerts
|
|
29
30
|
BEST_RESULTS => 3
|
30
31
|
}
|
31
32
|
|
32
|
-
|
33
33
|
RSS = 'rss'
|
34
34
|
EMAIL = 'email'
|
35
35
|
|
@@ -38,7 +38,6 @@ module Galerts
|
|
38
38
|
RSS => 2
|
39
39
|
}
|
40
40
|
|
41
|
-
|
42
41
|
RT = 'As it happens'
|
43
42
|
DAILY = 'Once a day'
|
44
43
|
WEEKLY = 'Once a week'
|
@@ -49,7 +48,6 @@ module Galerts
|
|
49
48
|
WEEKLY => 3
|
50
49
|
}
|
51
50
|
|
52
|
-
|
53
51
|
BLOGS = 'Blogs'
|
54
52
|
NEWS = 'News'
|
55
53
|
WEB = 'Web'
|
@@ -66,6 +64,4 @@ module Galerts
|
|
66
64
|
BOOKS => 6,
|
67
65
|
DISCUSSIONS => 7
|
68
66
|
}
|
69
|
-
|
70
|
-
|
71
67
|
end
|
data/lib/galerts/manager.rb
CHANGED
@@ -54,22 +54,23 @@ module Galerts
|
|
54
54
|
contents = contents.gsub('null', 'nil')
|
55
55
|
contents = eval(contents.gsub("window.STATE = ", ""))
|
56
56
|
|
57
|
-
contents[1]
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
57
|
+
if contents[1]
|
58
|
+
contents[1][1].each do |alert|
|
59
|
+
result << Alert.new(alert[2][3][1], {
|
60
|
+
id: alert[2][6][0][11],
|
61
|
+
query: alert[2][3][1],
|
62
|
+
feed_url: "#{ALERTS_URL}/feeds/#{alert.last}/#{alert[2][6][0][11]}",
|
63
|
+
data_id: alert[1],
|
64
|
+
data_id_2: alert[2][6][0].last,
|
65
|
+
domain: alert[2][3][2],
|
66
|
+
language: alert[2][3][3][1],
|
67
|
+
region: alert[2][3].last == 1 ? alert[2][3][3][2] : ANYWHERE,
|
68
|
+
frequency: FREQ_TYPES.invert[alert[2][6][0][4]],
|
69
|
+
sources: SOURCES_TYPES.invert[alert[2][4]],
|
70
|
+
how_many: HOW_MANY_TYPES.invert[alert[2][5]],
|
71
|
+
delivery: DELIVERY_TYPES.invert[alert[2][6][0][1]]
|
72
|
+
})
|
73
|
+
end
|
73
74
|
end
|
74
75
|
result
|
75
76
|
end
|
@@ -110,7 +111,6 @@ module Galerts
|
|
110
111
|
# TODO: need more readable
|
111
112
|
if action == 0 # create
|
112
113
|
params = {
|
113
|
-
# 'params' => "[null,[null,null,null,[null,\"#{alert.query}\",\"#{alert.domain}\",[null,\"#{alert.language}\",\"#{region}\"],null,null,null,#{anywhere ? 0 : 1},1],#{sources_text},#{HOW_MANY_TYPES[alert.how_many]},[[null,#{delivery_and_frequency},\"#{alert.language + '-' + region.upcase}\",null,null,null,null,null,'0']]]]"
|
114
114
|
'params' => "[null,[null,null,null,[null,\"#{alert.query}\",\"#{alert.domain}\",[null,\"#{alert.language}\",\"#{region}\"],null,null,null,#{anywhere ? 0 : 1},1],#{sources_text},#{HOW_MANY_TYPES[alert.how_many]},[[null,#{delivery_and_frequency},\"#{alert.language + '-' + region.upcase}\",null,null,null,null,null,'0',null,null,\"#{alert.data_id_2}\"]]]]"
|
115
115
|
}
|
116
116
|
return URI.encode_www_form(params)
|
data/lib/galerts/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: galerts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emre Can Yılmaz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|