galerts 1.0.1 → 1.0.2

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: f88f40fdf2987be7f58b77b1da44519638f3b054
4
- data.tar.gz: 1137978841c12eb83f4ee1943d9cb25eb698ab87
3
+ metadata.gz: 754bc4e4b5883644b7a93a63a3372d1086d43741
4
+ data.tar.gz: 011be19a0fab9712232f7c8710d65dbbeabc8ef3
5
5
  SHA512:
6
- metadata.gz: 4bd8dd01be0edc8a28a053919699292d6d4c6d524c3f2a60aef7ef7634e30db95be30049e47dbee57029c19f5fb059c191163d4447adf874b5241f0e0154674e
7
- data.tar.gz: ef9a7f1a250887d296e20db23459d558481edc1bc648741bb31fe1e31e4cf8ccbb36047078878820598316a1332de4fb351e5f1770531b096c136e65d0ffcf5f
6
+ metadata.gz: 4390f68cc9dd7a3da82a00ddaf777aa03425cd4a0f6bf0981d7888d36b4bc797eb6e66e271e4d9a1ae38fa46c7a035d7feec9578a38bed2085fc29ed10b1c1db
7
+ data.tar.gz: dfaa9fcfd4a287c46ce6e22956d239b7311f4b9486712f4269a2b48332d42db1dc1d9dac0b633ecbeba202879c9cec38245923accd39d2ee8d46748031b5cb44
@@ -0,0 +1,25 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
4
+ - 2.0.0
5
+ - 1.9.3
6
+ - ruby-head
7
+ matrix:
8
+ include:
9
+ - rvm: jruby-19mode
10
+ - rvm: jruby-20mode
11
+ - rvm: jruby-21mode
12
+ - rvm: jruby-head
13
+ - rvm: rbx-2
14
+ allow_failures:
15
+ - rvm: jruby-20mode
16
+ - rvm: jruby-21mode
17
+ - rvm: ruby-head
18
+ - rvm: jruby-head
19
+ - rvm: rbx
20
+ - rvm: rbx-2
21
+ fast_finish: true
22
+ branches:
23
+ only: master
24
+
25
+
data/Gemfile CHANGED
@@ -1,3 +1,7 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
+
5
+ group :test, :development do
6
+ gem 'rake'
7
+ end
data/README.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Galerts
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/galerts.png)][gem]
4
+ [![Build Status](https://secure.travis-ci.org/pivotus/galerts.png?branch=master)][travis]
5
+
6
+ [gem]: http://badge.fury.io/rb/galerts
7
+ [travis]: http://travis-ci.org/pivotus/galerts
8
+
3
9
  Simple Ruby library that uses Mechanize to scrape Google Alerts from the google
4
10
  alerts webpage.
5
11
 
@@ -21,7 +27,7 @@ gem install galerts
21
27
  ## Example
22
28
 
23
29
  ```ruby
24
- require 'google_alerts'
30
+ require 'galerts'
25
31
 
26
32
  manager = Galerts::Manager.new('example@gmail.com', 'password')
27
33
 
data/Rakefile CHANGED
@@ -1 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ task :default => [:build]
4
+
5
+ desc 'Build Gem'
6
+ task :build do
7
+ `gem build galerts.gemspec`
8
+ end
@@ -54,9 +54,9 @@ module Galerts
54
54
 
55
55
  contents[1][1].each do |alert|
56
56
  result << Alert.new(alert[2][3][1], {
57
- id: alert[2].last.last.last,
57
+ id: alert[2][6][0][11],
58
58
  query: alert[2][3][1],
59
- feed_url: "#{ALERTS_URL}/feeds/#{alert.last}/#{alert[2].last.last.last}",
59
+ feed_url: "#{ALERTS_URL}/feeds/#{alert.last}/#{alert[2][6][0][11]}",
60
60
  data_id: alert[1],
61
61
  domain: alert[2][3][2],
62
62
  language: alert[2][3][3][1],
@@ -130,7 +130,7 @@ module Galerts
130
130
  response = @agent.post("#{CREATE_ALERT_URL}x=#{x}", build_params(alert, 0), {'Content-Type' => 'application/x-www-form-urlencoded'})
131
131
 
132
132
  if response.body == ALERT_EXIST
133
- raise "Alert exist!"
133
+ find_by_query(query).first
134
134
  elsif response.body == ALERT_SOMETHING_WENT_WRONG
135
135
  raise "Something went wrong!" # internal error, html changed maybe
136
136
  else
@@ -151,7 +151,7 @@ module Galerts
151
151
  response = @agent.post("#{MODIFY_ALERT_URL}x=#{x}", build_params(alert, 1), {'Content-Type' => 'application/x-www-form-urlencoded'})
152
152
 
153
153
  if response.body == ALERT_EXIST
154
- raise "Alert exist!"
154
+ find_by_query(query).first
155
155
  elsif response.body == ALERT_SOMETHING_WENT_WRONG
156
156
  raise "Something went wrong!" # internal error, html changed maybe
157
157
  else
@@ -1,3 +1,3 @@
1
1
  module Galerts
2
- VERSION = '1.0.1'.freeze unless defined?(::Galerts::VERSION)
2
+ VERSION = '1.0.2'.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.1
4
+ version: 1.0.2
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: 2014-09-23 00:00:00.000000000 Z
11
+ date: 2014-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize
@@ -31,6 +31,7 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
+ - ".travis.yml"
34
35
  - Gemfile
35
36
  - README.md
36
37
  - Rakefile