hotel_price 0.1.9 → 0.2.0

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
  SHA256:
3
- metadata.gz: 3f5cf1ce8a18aee7662744da792a43d3f73bbec4edc61bb98f435a03a548d1cf
4
- data.tar.gz: ff69477d5f32d2cbab87b43455ce0ff895696b7908339f5e842bdb3b95eef587
3
+ metadata.gz: 46062e452bbaf140402021de2e18bbfab7d75f263817d1e9e390fe1a75992c22
4
+ data.tar.gz: b3b82149d0d899bc52146174be0ab0b63e13b89338d8fb95ab6476d2bd9e2310
5
5
  SHA512:
6
- metadata.gz: 9b7f8890f483e19fb7b8440c94451437f7e6dc8b41007ebdd9f3003728714d3e46977673fcc0cfa2a6f9c1ca3a2324e0d5b6d43b7d95ec6b238a43bfee96e213
7
- data.tar.gz: 9de4ed1c37fd4ea15ea7cce7de9ca27c7940ef19fc14883a59971e9d28fad2dbce42892d36f5e9fac3205440b196e4bed54ec4dc39226855946f2f906ad3683a
6
+ metadata.gz: 96187515114012df0d4c0c5430d4db0a72816cf017cb4dda5a076b3b2e70b1a190bc73549e4950bbfd6d21a32c775a51fe221c08479f25c6cd395c5d17c6e377
7
+ data.tar.gz: '09da4b388b9d72406510b14986dcc8c0c13ae0f768f665494f20307939f6777243086c6c1aea35d3ff0d9e3b94c7a2462e3e346695167ccd469425bcc1e1dc53'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hotel_price (0.1.9)
4
+ hotel_price (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'rakuten_travel_review'
3
3
 
4
- puts RakutenTravelReview.rakuten_travel
4
+ puts RakutenTravelReview.rakuten_travel ARGV[0]
data/lib/hotel_price.rb CHANGED
@@ -15,6 +15,7 @@ module HotelPrice
15
15
  comment_area = driver.find_elements(:class_name, "commentReputationBoth")
16
16
  data = comment_area.map do |f|
17
17
  {
18
+ status: "success",
18
19
  date: f.find_element(class_name: "time").text,
19
20
  rakuten_hotel_id: 7770,
20
21
  comment: f.find_element(class_name: "commentSentence").text
@@ -1,3 +1,3 @@
1
1
  module HotelPrice
2
- VERSION = "0.1.9"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -3,17 +3,25 @@ require "selenium-webdriver"
3
3
 
4
4
  module RakutenTravelReview
5
5
  class Error < StandardError; end
6
- def self.rakuten_travel
6
+ def self.rakuten_travel rakuten_hotel_id
7
7
  # firefox_capabilities = Selenium::WebDriver::Remote::Capabilities.firefox
8
8
  # @driver = Selenium::WebDriver.for(:remote, url: "http://hub:4444/wd/hub", desired_capabilities: firefox_capabilities)
9
9
  options = Selenium::WebDriver::Firefox::Options.new
10
10
  options.add_argument("-headless")
11
- driver = Selenium::WebDriver.for :firefox, options: options
12
- base_url = "https://travel.rakuten.co.jp/HOTEL/7770/review.html"
13
- driver.get base_url
11
+ driver = Selenium::WebDriver.for :firefox#, options: options
12
+ rakuten_travel_hotel_id = rakuten_hotel_id.to_s
13
+ driver.get("https://travel.rakuten.co.jp/HOTEL/#{rakuten_travel_hotel_id.to_s}/review.html")
14
14
  sleep 2
15
- title = driver.find_element(:tag_name, "p").text
15
+ comment_area = driver.find_elements(:class_name, "commentBox")
16
+ data = comment_area.map do |f|
17
+ {
18
+ status: "success",
19
+ date: f.find_element(class_name: "time").text,
20
+ rakuten_hotel_id: rakuten_hotel_id,
21
+ comment: f.find_element(class_name: "commentSentence").text
22
+ }
23
+ end
16
24
  driver.quit
17
- title
25
+ data
18
26
  end
19
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hotel_price
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fumitake Kawasaki