hotel_price 0.2.3 → 0.2.4

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: 3c9d7a1e1951f2c204dd858f69763db0b532ab041c2f86b3467654343f4e49df
4
- data.tar.gz: 3049419b19b1ea0e952eb327af9366e7e508d7cc45a551fd0c6454aa2d45bf5b
3
+ metadata.gz: a15be651d24b2be15d291114fa91cc82d1ef8a1cf140c9564ca466173b22fe58
4
+ data.tar.gz: af0612a4bbd76192a0134d6f270a81826b10200c6fe4a018e4a83f99485c1a45
5
5
  SHA512:
6
- metadata.gz: 2e4d6f1152410739ab1b03aa4018ed74ff9870f6cfa76a83ce19807246478d976a894b0ed12ea1f830e3bc53921aa6544d07cef0b3c14fb2a6fe14ac315412d8
7
- data.tar.gz: 8d76ffa7b0ba2cd6103bb87b5fb94fe2f9aaae6a313b7e776557fb398e82ffb7adcd5b71ef82e9fcc7c7db40146290bb2d1de2f142fa58d47029c8b5bd524e92
6
+ metadata.gz: 8cb17881077dcb30af86c4ee9c1fa4fa6bdd771a6f793e704220b6ff71906eb214b370b20504f7295e027f93e37e3f04649435ac7725398c09290ca7c3fff2a2
7
+ data.tar.gz: 20c350c2803d53101489e5cdd89fc99da33ff8097f900aeb11ac661acb89fb9d731bc1d6b826d7b182ad7d086be2ee03f94fe376c888939d45073287aef9b857
data/.rubocop.yml CHANGED
@@ -11,7 +11,8 @@ AllCops:
11
11
  TargetRubyVersion: 2.6.5
12
12
 
13
13
  ##################### Style ##################################
14
-
14
+ Style/ClassAndModuleChildren:
15
+ Enabled: false
15
16
  # redirect_to xxx and return のイディオムを維持したい
16
17
  Style/AndOr:
17
18
  EnforcedStyle: conditionals
@@ -7,5 +7,33 @@ module HotelPrice::Jalan
7
7
  def test
8
8
  @api_key
9
9
  end
10
+
11
+ def get_price
12
+ if @doc.css("NumberOfResults").text == "0"
13
+ {
14
+ date: DateTime.now.strftime("%Y-%m-%d"),
15
+ branch_id: @user_info[:branch_id],
16
+ stay_date: @user_info[:checkindate],
17
+ adult_num: @user_info[:adult_num],
18
+ jalan_hotel_id: @user_info[:jalan_hotel_id],
19
+ plan_num: 0,
20
+ min_price: 0
21
+ }
22
+ else
23
+ {
24
+ date: DateTime.now.strftime("%Y-%m-%d"),
25
+ branch_id: @user_info[:branch_id],
26
+ channel: "jalan",
27
+ stay_date: @user_info[:checkindate],
28
+ adult_num: @user_info[:adult_num],
29
+ jalan_hotel_id: @user_info[:jalan_hotel_id],
30
+ hotel_name: @doc.css("Plan").css("Hotel HotelName").text,
31
+ room_name: @doc.css("Plan").css("RoomName").text,
32
+ plan_name: @doc.css("Plan").css("PlanName").text,
33
+ plan_num: @doc.css("NumberOfResults").text,
34
+ min_price: @doc.css("Plan").css("Stay Rate").text
35
+ }
36
+ end
37
+ end
10
38
  end
11
39
  end
@@ -0,0 +1,19 @@
1
+ module HotelPrice::Rakuten
2
+ class RakutenScraper
3
+ def self.review rakuten_hotel_id
4
+ driver = self.get_selenium_driver
5
+ driver.get("https://travel.rakuten.co.jp/HOTEL/#{rakuten_hotel_id.to_s}/review.html")
6
+ sleep 2
7
+ comment_area = driver.find_elements(:class_name, "commentBox")
8
+ data = comment_area.map do |f|
9
+ {
10
+ date: f.find_element(class_name: "time").text,
11
+ rakuten_hotel_id: rakuten_hotel_id,
12
+ comment: f.find_element(class_name: "commentSentence").text
13
+ }
14
+ end
15
+ driver.quit
16
+ data
17
+ end
18
+ end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module HotelPrice
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hotel_price
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fumitake Kawasaki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-29 00:00:00.000000000 Z
11
+ date: 2020-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,6 +94,7 @@ files:
94
94
  - lib/hotel_price/rakuten.rb
95
95
  - lib/hotel_price/rakuten/rakuten_api.rb
96
96
  - lib/hotel_price/rakuten/rakuten_console.rb
97
+ - lib/hotel_price/rakuten/rakuten_scraper.rb
97
98
  - lib/hotel_price/version.rb
98
99
  homepage: https://github.com/el-fudo/hotel_price
99
100
  licenses: