counting_stars 0.1.0 → 0.2.0

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
  SHA1:
3
- metadata.gz: 570bbe1a86b9ba867561d762b18391f3a5727336
4
- data.tar.gz: 8af0bef2c6da82b9eaac91893e563a9204569a3b
3
+ metadata.gz: 4d943addfa3e0c0639d3300791d432f8f1ed72c5
4
+ data.tar.gz: faef94eccc28d972bbe1a25c59838d9e48d9aaed
5
5
  SHA512:
6
- metadata.gz: 0513afe5a7e0c6d95414b1ee7e1159cd088875b91b06a318757910cfd574c0044a0fa7815b504bbb458e50571d314b672c4412866b01118cd0b1e51ed93e8a00
7
- data.tar.gz: 501a020ecd3bc1de69b1a6bd82d322eddc6dbe9ee11a335541850e3f0754c5ab29f1d2da5e006c8c448f015d7e2fe1b235ee341b1b1b09a08ebaa7505e7cd21a
6
+ metadata.gz: 4c927cbe86f650936810f691736486dd37bb7d814392035b9184eca0c43f439a0bfff271b6d6186fdc40f0468645d32d2b89c60112c05ee16c626ff0493ccaaa
7
+ data.tar.gz: 6480dd4c4b7cfc91be64d18947968a23203cede3b4d8b798956c1533c0395f696f84a049c0e5b40753ec2f96e1c89e6165523bbd56fd70b1133edd0333fba74f
data/.travis.yml CHANGED
@@ -1,3 +1,11 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.2.0
4
+
5
+ before_install:
6
+ - gem install bundler
7
+
8
+ addons:
9
+ code_climate:
10
+ repo_token:
11
+ secure: "JYgaUE2ngLH97PCXs4eJv0AXm5p/Xa830CwVylz6EeAU4DbYeD2SqIlUdaqtPdSEciK+ZJYcnG4Wv0i81RxfXg4x/ZXA4iZN/+L5uUmQ2+ADKrv5UbUOUK6tW0/WqjS273y01LEpAG0LM5jlMD2uFmbgSfC/yGWxvIonlQW510g="
data/README.md CHANGED
@@ -1,8 +1,13 @@
1
- # CountingStars
1
+ # Counting Stars
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/counting_stars`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ [![Build Status](https://travis-ci.org/krmbzds/counting_stars.svg)](https://travis-ci.org/krmbzds/counting_stars)
4
+ [![Test Coverage](https://codeclimate.com/github/krmbzds/counting_stars/badges/coverage.svg)](https://codeclimate.com/github/krmbzds/counting_stars)
5
+ [![Code Climate](https://codeclimate.com/github/krmbzds/counting_stars/badges/gpa.svg)](https://codeclimate.com/github/krmbzds/counting_stars)
6
+ [![Gem Version](https://badge.fury.io/rb/counting_stars.svg)](http://badge.fury.io/rb/counting_stars)
7
+ [![Dependency Status](https://gemnasium.com/krmbzds/counting_stars.svg)](https://gemnasium.com/krmbzds/counting_stars)
4
8
 
5
- TODO: Delete this and the text above, and describe your gem
9
+
10
+ A simple ruby library for extracting rating and metadata information from Google Search.
6
11
 
7
12
  ## Installation
8
13
 
@@ -22,17 +27,32 @@ Or install it yourself as:
22
27
 
23
28
  ## Usage
24
29
 
25
- TODO: Write usage instructions here
30
+ ### As a Ruby Module
31
+
32
+ ```rb
33
+ require 'counting_stars'
34
+
35
+ CountingStars::count("Marriott's Grande Ocean", "booking.com")
36
+ => ["Rating: 9.4/10", "26 reviews"]
26
37
 
27
- ## Development
38
+ CountingStars::count("Marriott's Grande Ocean", "tripadvisor.com")
39
+ => ["Rating: 4.5", "501 reviews", "Price range: $$$"]
40
+
41
+ # Now you can also use shorthand methods
42
+ CountingStars::booking("Marriott's Grande Ocean")
43
+ => {:rating=>"9.4", :reviews=>"26"}
44
+
45
+ CountingStars::tripadvisor("Marriott's Grande Ocean")
46
+ => {:rating=>"4", :reviews=>"506", :price_range=>"$$$"}
47
+ ```
28
48
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
49
+ ### Commmandline
30
50
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
51
+ :rocket: Coming soon.
32
52
 
33
53
  ## Contributing
34
54
 
35
- 1. Fork it ( https://github.com/[my-github-username]/counting_stars/fork )
55
+ 1. Fork it ( https://github.com/krmbzds/counting_stars/fork )
36
56
  2. Create your feature branch (`git checkout -b my-new-feature`)
37
57
  3. Commit your changes (`git commit -am 'Add some feature'`)
38
58
  4. Push to the branch (`git push origin my-new-feature`)
data/Rakefile CHANGED
@@ -1,2 +1,5 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
2
3
 
4
+ task :default => :spec
5
+ RSpec::Core::RakeTask.new
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency 'rake', '~> 10.0'
26
26
  spec.add_development_dependency 'bundler', '~> 1.8'
27
27
  spec.add_development_dependency 'rspec', '~> 3.2', '>= 3.2.0'
28
+ spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.4', '>=0.4.7'
28
29
  end
@@ -6,6 +6,10 @@ require 'counting_stars/version'
6
6
 
7
7
  module CountingStars
8
8
 
9
+ INTEGER = /\d+/
10
+ DECIMAL = /\d+\.\d+/
11
+ DOLLARS = /\$+/
12
+
9
13
  def self.count(query, site)
10
14
  request "#{query} site:#{site}"
11
15
  end
@@ -22,4 +26,14 @@ module CountingStars
22
26
  page.gsub(/[[:space:]]/, ' ').lstrip.split(' - ')
23
27
  end
24
28
 
29
+ def self.booking(query)
30
+ response = count(query, 'booking.com')
31
+ { rating: response[0][DECIMAL], reviews: response[1][INTEGER] }
32
+ end
33
+
34
+ def self.tripadvisor(query)
35
+ response = count(query, 'tripadvisor.com')
36
+ { rating: response[0][INTEGER], reviews: response[1][INTEGER], price_range: response[2][DOLLARS] }
37
+ end
38
+
25
39
  end
@@ -1,3 +1,3 @@
1
1
  module CountingStars
2
- VERSION = "0.1.0"
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: counting_stars
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kerem Bozdas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-27 00:00:00.000000000 Z
11
+ date: 2015-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -98,6 +98,26 @@ dependencies:
98
98
  - - ">="
99
99
  - !ruby/object:Gem::Version
100
100
  version: 3.2.0
101
+ - !ruby/object:Gem::Dependency
102
+ name: codeclimate-test-reporter
103
+ requirement: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - "~>"
106
+ - !ruby/object:Gem::Version
107
+ version: '0.4'
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 0.4.7
111
+ type: :development
112
+ prerelease: false
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.4'
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: 0.4.7
101
121
  description: A simple tool for extracting rating and metadata information from Google
102
122
  Search.
103
123
  email: