gss 0.0.6 → 0.0.7

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.
Files changed (6) hide show
  1. checksums.yaml +8 -8
  2. data/README.md +50 -42
  3. data/gss.gemspec +1 -1
  4. data/lib/gss.rb +3 -20
  5. data/lib/gss/version.rb +1 -1
  6. metadata +2 -2
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MTYwMzFmNWU5OTRhMjM4YjdmNDBlZjg4ZWI2NGZhMzk1OTJhNjIyNw==
4
+ MmIxYjQ5MzQ2ZDZjZmY2YWE3ZWFjM2JiYjJiNmRiYzlhZmI3ZDFhYg==
5
5
  data.tar.gz: !binary |-
6
- ODEyNGUzODJhZDgxMmI3YjI4MmEzMGZhODA0ZmQwNTFmNmQxYTNiZg==
6
+ NjlmNTJlNDQyNGZmNmVmNjU3MTUzZWY4ZDhiYmZhNWYwZDhlYjY3ZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZWE4YTA0MTVlMWQ4NzJjOWJmNzc2NTE5NmZhMTJiODdkNDM5OWY5NDhjYjk2
10
- YzVmMDg1NGM3ODM2ZGU5NDMzZDdjODdiY2MzMDI5NGE4ZDUyYTJmNjhlODQ1
11
- NmJhNTc3YTM1NjBjOTgxNDlmNjliOTJlYjJmMjZmYjRmZmZjYTM=
9
+ NWJmZjUzZjk2MzE0ZmYzNWNmZWNjMTczMWQzMmE1NjBlZTdmZDQ1ZmU5MGJi
10
+ ZDQxYzU0M2VmMTZmMjE3M2UxNzg1ZDU0ODY3OWRmZWUzNjUxM2ZiYzRlM2Uw
11
+ MTQ4YzQyMzM3OTNhYjI5YjcxZmQ3ZDAxYTVjMDYwYmFlMjJhZWM=
12
12
  data.tar.gz: !binary |-
13
- MjdmMTRiNGMxNmNhMDNiZTY3OTExMWU4MTRhMGY3ODI5YmU2YTExNGZiNzJl
14
- MzQyOTU2YzYyZDExZTA4ZGE4MzMwNTJiNTExYmRhMWZmZjVmYzU5OGI5ZTQ4
15
- MDgyNWNmMTdlM2QzNTViNDE4ZjZlZTYzM2VlMzkwMjMzNmFkMDY=
13
+ Y2I3ZWY0NDJlNmJlMDFjNTBkYjI3NTkyOTEwODQwNGY5MTUwMTg0ODE1ZGFj
14
+ MjExYjRiYjQ3ODE4NWQwMTEyNjUzODQyY2ZhNjMyNWM2MGVkYWE2NGFiNzIy
15
+ NTkxOGI3M2QzMDc2NzllZmExODJkZDZlMzdlZDZkMjQ0NTA3ODI=
data/README.md CHANGED
@@ -1,42 +1,50 @@
1
- # Gss
2
-
3
- This module is small but powerful if you like to webscrape. Give Gss a site and a search query and it will return the top results for your search.
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'gss'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself as:
16
-
17
- $ gem install gss
18
-
19
- ## Usage
20
-
21
- Here is the one line that you would want it for.
22
- (top_result, top_results) = Gss.return_results("imdb.com", "Amazing Spiderman")
23
-
24
- top_result is a Hash object has holds three values:
25
- name - The name of the link.
26
- url - The url to go to that site.
27
- description - The short summary about what the link is about.
28
-
29
- top_results is an array of Hash objects containing the top ten results
30
- The hash objects are the same as top_result.
31
- In fact top_results[0] would be equal top_result.
32
- To get second link would be top_results[1]
33
-
34
- That is all that there is to it, but it is very helpful.
35
-
36
- ## Contributing
37
-
38
- 1. Fork it ( https://github.com/[my-github-username]/gss/fork )
39
- 2. Create your feature branch (`git checkout -b my-new-feature`)
40
- 3. Commit your changes (`git commit -am 'Add some feature'`)
41
- 4. Push to the branch (`git push origin my-new-feature`)
42
- 5. Create a new Pull Request
1
+ # Gss
2
+
3
+ This module is small but powerful if you like to webscrape. Give Gss a site and a search query and it will return the top results for your search.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'gss'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install gss
18
+
19
+ ## Usage
20
+
21
+ Here is the one line that you would want it for.
22
+
23
+ ```
24
+ #!ruby
25
+
26
+ (top_result, top_results) = Gss.return_results("imdb.com", "Amazing Spiderman")
27
+ ```
28
+
29
+
30
+ `top_result` is a Hash object has holds three values:
31
+
32
+ 1. name - The name of the link.
33
+ 2. url - The url to go to that site.
34
+ 3. description - The short summary about what the link is about.
35
+
36
+ `top_results` is an array of Hash objects containing the top ten results
37
+
38
+ * The hash objects are the same as top_result.
39
+ * In fact `top_results[0]` would be equal to `top_result`.
40
+ * To get the second link would be `top_results[1]`
41
+
42
+ That is all that there is to it, but it is very helpful.
43
+
44
+ ## Contributing
45
+
46
+ 1. Fork it ( https://bitbucket.org/[my-github-username]/gss/fork )
47
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
48
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
49
+ 4. Push to the branch (`git push origin my-new-feature`)
50
+ 5. Create a new Pull Request
@@ -5,7 +5,7 @@ require 'gss/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "gss"
8
- spec.version = "0.0.6"
8
+ spec.version = Gss::VERSION
9
9
  spec.authors = ["rfitzger"]
10
10
  spec.email = ["ritchiefitz1@gmail.com"]
11
11
  spec.summary = %q{Grabs top google results from a given site with a given string.}
data/lib/gss.rb CHANGED
@@ -18,26 +18,9 @@ module Gss
18
18
  @search_for = search_for.gsub(" ", "+")
19
19
  @gss_url = "https://www.google.com/search?q=site%3A#{@site_name}+#{@search_for}"
20
20
  @noko = Nokogiri::HTML(open(@gss_url))
21
-
22
- return [top_result(), top_results()]
23
- end
24
-
25
- # This will return a Hash object containing information about
26
- # the top link.
27
- #
28
- # Access hash:
29
- # name - link title.
30
- # url - link to the site.
31
- # description - short snippet about link.
32
- #
33
- # @return result [Hash] contains info about the top link.
34
- def self.top_result()
35
- result = Hash.new
36
- result[:name] = @noko.css("li.g a")[0].text
37
- result[:url] = "http://google.com" + @noko.css("li.g h3 a")[0]["href"]
38
- result[:description] = @noko.css("li.g span.st")[0].text
39
-
40
- return result
21
+ results = top_results()
22
+
23
+ return [results[0], results]
41
24
  end
42
25
 
43
26
  # This will return as array of Hash objects containing information about
@@ -1,3 +1,3 @@
1
1
  module Gss
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gss
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - rfitzger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-16 00:00:00.000000000 Z
11
+ date: 2014-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler