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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1927bb3f13800cfe9ddcaf6c383d889fbbbe1c87
4
- data.tar.gz: 056d5825cd3e7f496e7a11f0adb85d1b0713257b
3
+ metadata.gz: fcec32e3b8383a1aa6771821c6332a7880a0c968
4
+ data.tar.gz: 4ad04df3667af46fa3da7e5fd8ee11a913aa268d
5
5
  SHA512:
6
- metadata.gz: e880895f8a19ed362c90d6bba1d71fde1208ab7b85b11ca51c6863f1d0a6bfbdc9c17ef548eb4e2dd24454074a4f01bb4d49e5288533b56591017a4f987a9497
7
- data.tar.gz: 045a1ead22b3f32571b63759846b41e506ca345c078a61950e7ba3f258d4e2665d9bd06460b1548f6770d0e2602f84400cb713f3a18bbdee343d69a6d64e0dcc
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, how_many,
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
 
@@ -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
@@ -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][1].each do |alert|
58
- result << Alert.new(alert[2][3][1], {
59
- id: alert[2][6][0][11],
60
- query: alert[2][3][1],
61
- feed_url: "#{ALERTS_URL}/feeds/#{alert.last}/#{alert[2][6][0][11]}",
62
- data_id: alert[1],
63
- data_id_2: alert[2][6][0].last,
64
- domain: alert[2][3][2],
65
- language: alert[2][3][3][1],
66
- region: alert[2][3].last == 1 ? alert[2][3][3][2] : ANYWHERE,
67
- frequency: FREQ_TYPES.invert[alert[2][6][0][4]],
68
- sources: SOURCES_TYPES.invert[alert[2][4]],
69
- how_many: HOW_MANY_TYPES.invert[alert[2][5]],
70
- delivery: DELIVERY_TYPES.invert[alert[2][6][0][1]]
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)
@@ -1,3 +1,3 @@
1
1
  module Galerts
2
- VERSION = '1.0.8'.freeze unless defined?(::Galerts::VERSION)
2
+ VERSION = '1.0.9'.freeze unless defined?(::Galerts::VERSION)
3
3
  end
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.8
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-06-03 00:00:00.000000000 Z
11
+ date: 2015-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize