hotel_price 0.5.9 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.rubocop.yml +65 -104
- data/Gemfile.lock +15 -15
- data/hotel_price.gemspec +11 -10
- data/lib/hotel_price/booking/booking_scraper.rb +1 -2
- data/lib/hotel_price/expedia/jalan/jalan_api.rb +41 -0
- data/lib/hotel_price/expedia/jalan/jalan_console.rb +12 -0
- data/lib/hotel_price/expedia/jalan/jalan_scraper.rb +53 -0
- data/lib/hotel_price/version.rb +1 -1
- metadata +24 -22
- data/.DS_Store +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb5d2bbe6a153d6df58d558653addef88e4b54c83e5d9fc2784e8b9cb5e1a911
|
4
|
+
data.tar.gz: eb2f765f334d8c22827df5877356be34a74a114f91909439ce2efc43dc166c8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38428d2d3bcd9098d1d18050901bfe75ed5042be5b93a49d24bd45c0eb5bc7d9a270c0d0c3265c6ec8fdabb949a2ba5e0ee5269312b2dc141a69c826767befe7
|
7
|
+
data.tar.gz: 4958ec209501d14d06d58bf9ddf6c1df34bacf78a6f0cd3da7a1fbd17084cce69978854848e6d5d301f5645967665665c226d0aef300fac05414408b9de643ba
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,49 +1,33 @@
|
|
1
|
-
# target_version:
|
2
|
-
# rubocop v0.34.2
|
3
|
-
|
4
|
-
# 自動生成されるものはチェック対象から除外する
|
5
1
|
AllCops:
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
DisplayCopNames: true
|
11
|
-
TargetRubyVersion: 2.6.5
|
2
|
+
EnabledByDefault: true
|
3
|
+
|
4
|
+
Style/AndOr:
|
5
|
+
Enabled: false
|
12
6
|
|
13
|
-
##################### Style ##################################
|
14
7
|
Style/ClassAndModuleChildren:
|
15
8
|
Enabled: false
|
16
|
-
# redirect_to xxx and return のイディオムを維持したい
|
17
|
-
Style/AndOr:
|
18
|
-
EnforcedStyle: conditionals
|
19
9
|
|
20
|
-
# 日本語のコメントを許可する
|
21
10
|
Style/AsciiComments:
|
22
11
|
Enabled: false
|
23
12
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
Style/
|
28
|
-
|
29
|
-
|
30
|
-
|
13
|
+
Style/SymbolArray:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Style/WordArray:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Style/MixinGrouping:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
Style/RescueStandardError:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Style/MethodCallWithArgsParentheses:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
Style/DocumentationMethod:
|
29
|
+
Enabled: false
|
31
30
|
|
32
|
-
# option 等、明示的にハッシュにした方が分かりやすい場合もある
|
33
|
-
Style/BracesAroundHashParameters:
|
34
|
-
Enabled: false
|
35
|
-
|
36
|
-
# Style/CollectionMethods 自体は無効になっているのだが、
|
37
|
-
# https://github.com/bbatsov/rubocop/issues/1084
|
38
|
-
# https://github.com/bbatsov/rubocop/issues/1334
|
39
|
-
# Performance/Detect がこの設定値を見るので PreferredMethods だけ変更しておく。
|
40
|
-
#
|
41
|
-
# デフォルト値から変えたのは
|
42
|
-
# find -> detect
|
43
|
-
# ActiveRecord の find と間違えやすいため
|
44
|
-
# reduce -> inject
|
45
|
-
# detect, reject, select と並べたときに韻を踏んでいるため。
|
46
|
-
# collect -> map を維持しているのは文字数が圧倒的に少ないため。
|
47
31
|
Style/CollectionMethods:
|
48
32
|
PreferredMethods:
|
49
33
|
detect: "detect"
|
@@ -51,152 +35,104 @@ Style/CollectionMethods:
|
|
51
35
|
inject: "inject"
|
52
36
|
reduce: "inject"
|
53
37
|
|
54
|
-
# ドキュメントの無い public class を許可する
|
55
38
|
Style/Documentation:
|
56
39
|
Enabled: false
|
57
40
|
|
58
|
-
# !! のイディオムは積極的に使う
|
59
41
|
Style/DoubleNegation:
|
60
42
|
Enabled: false
|
61
43
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
# メソッドチェーンの改行は末尾に . を入れる
|
66
|
-
# REPL に貼り付けた際の暴発を防ぐため
|
44
|
+
Lint/ConstantResolution:
|
45
|
+
Enabled: false
|
46
|
+
|
67
47
|
Layout/DotPosition:
|
68
48
|
EnforcedStyle: trailing
|
69
49
|
|
70
|
-
Layout/LineLength:
|
71
|
-
Enabled: false
|
72
50
|
|
73
51
|
Layout/EmptyLineAfterGuardClause:
|
74
52
|
Enabled: false
|
75
53
|
|
76
|
-
# 明示的に else で nil を返すのは分かりやすいので許可する
|
77
54
|
Style/EmptyElse:
|
78
55
|
EnforcedStyle: empty
|
79
56
|
|
80
|
-
# 桁揃えが綺麗にならないことが多いので migration は除外
|
81
57
|
Layout/ExtraSpacing:
|
82
58
|
Exclude:
|
83
59
|
- "db/migrate/*.rb"
|
84
60
|
|
85
|
-
# いずれかに揃えるのならば `sprintf` や `format` より String#% が好きです
|
86
61
|
Style/FormatString:
|
87
62
|
EnforcedStyle: percent
|
88
63
|
|
89
|
-
|
64
|
+
Style/MissingElse:
|
65
|
+
Enabled: false
|
66
|
+
|
67
|
+
Style/StringHashKeys:
|
68
|
+
Exclude:
|
69
|
+
- "spec/queries/*.rb"
|
70
|
+
- "*.gemspec"
|
71
|
+
|
90
72
|
Style/GuardClause:
|
91
73
|
MinBodyLength: 5
|
92
74
|
|
93
|
-
# rake タスクの順序の hash は rocket を許可する
|
94
75
|
Style/HashSyntax:
|
95
76
|
EnforcedStyle: ruby19
|
77
|
+
Exclude:
|
78
|
+
- "**/*.rake"
|
79
|
+
- "Rakefile"
|
96
80
|
|
97
|
-
|
98
|
-
# 条件式の方を意識させたい場合には後置の if/unless を使わない方が分かりやすい
|
99
81
|
Style/IfUnlessModifier:
|
100
82
|
Enabled: false
|
101
83
|
|
102
|
-
# private/protected は一段深くインデントする
|
103
84
|
Style/PreferredHashMethods:
|
104
85
|
EnforcedStyle: short
|
105
86
|
|
106
|
-
# scope 等は複数行でも lambda ではなく ->{} で揃えた方が見た目が綺麗
|
107
87
|
Style/Lambda:
|
108
88
|
Enabled: false
|
109
89
|
|
110
|
-
# 1_000_000 と区切り文字が 2 個以上必要になる場合のみ _ 区切りを必須にする
|
111
90
|
Style/NumericLiterals:
|
112
91
|
MinDigits: 7
|
113
92
|
|
114
|
-
# 正規表現にマッチさせた時の特殊変数の置き換えは Regex.last_match ではなく
|
115
|
-
# 名前付きキャプチャを使って参照したいので auto-correct しない
|
116
93
|
Style/PerlBackrefs:
|
117
94
|
AutoCorrect: false
|
118
95
|
|
119
|
-
# has_ から始まるメソッドは許可する
|
120
|
-
Naming/PredicateName:
|
121
|
-
ForbiddenPrefixes:
|
122
|
-
- "is_"
|
123
|
-
- "have_"
|
124
|
-
NamePrefix:
|
125
|
-
- "is_"
|
126
|
-
- "have_"
|
127
|
-
|
128
|
-
# 特に model 内において、ローカル変数とメソッド呼び出しの区別をつけた方が分かりやすい場合が多い
|
129
96
|
Style/RedundantSelf:
|
130
97
|
Enabled: false
|
131
98
|
|
132
99
|
Style/FrozenStringLiteralComment:
|
133
100
|
Enabled: false
|
134
101
|
|
135
|
-
# 受け取り側で multiple assignment しろというのを明示
|
136
102
|
Style/RedundantReturn:
|
137
103
|
AllowMultipleReturnValues: true
|
138
104
|
|
139
|
-
# spec 内は見た目が綺麗になるので許可
|
140
105
|
Style/Semicolon:
|
141
106
|
Exclude:
|
142
107
|
- "spec/**/*"
|
143
108
|
|
144
|
-
# fail と使い分ける必要ナシ
|
145
109
|
Style/SignalException:
|
146
110
|
EnforcedStyle: only_raise
|
147
111
|
|
148
112
|
Style/MethodDefParentheses:
|
149
113
|
Enabled: false
|
150
114
|
|
151
|
-
# `||` も align に使うことがあるので追加する
|
152
|
-
# Style/SpaceAroundOperators:
|
153
|
-
# MultiSpaceAllowedForOperators:
|
154
|
-
# - "="
|
155
|
-
# - "=>"
|
156
|
-
# - "||"
|
157
|
-
|
158
|
-
# * 式展開したい場合に書き換えるのが面倒
|
159
|
-
# * 文章ではダブルクォートよりもシングルクォートの方が頻出する
|
160
|
-
# ことから EnforcedStyle: double_quotes 推奨
|
161
115
|
Style/StringLiterals:
|
162
116
|
EnforcedStyle: double_quotes
|
163
117
|
|
164
|
-
# auto-correct 時に Style/StringLiterals とカニバって無限ループになる (v0.28.0)
|
165
118
|
Style/StringLiteralsInInterpolation:
|
166
119
|
Enabled: false
|
167
120
|
|
168
|
-
# いくらなんでも inject { |a, e| } は短すぎるので分かりやすい名前をつけたい
|
169
121
|
Style/SingleLineBlockParams:
|
170
122
|
Enabled: false
|
171
123
|
|
172
|
-
# * migrate
|
173
|
-
# * jbuilder
|
174
|
-
# * model の association
|
175
|
-
# * controller の callback
|
176
|
-
# 辺りの桁揃えで引っかかるので全体的にチェックしない
|
177
|
-
# Style/SingleSpaceBeforeFirstArg:
|
178
|
-
# Enabled: false
|
179
|
-
|
180
|
-
|
181
|
-
##################### Lint ##################################
|
182
|
-
|
183
|
-
# * 同名のメソッドがある場合にローカル変数に `_` を付ける
|
184
|
-
# * 一時変数として `_` を付ける
|
185
|
-
# というテクニックは頻出する
|
186
124
|
Lint/UnderscorePrefixedVariableName:
|
187
125
|
Enabled: false
|
188
126
|
|
189
|
-
# 子クラスで実装させるつもりのメソッドで引っかかるので
|
190
127
|
Lint/UnusedMethodArgument:
|
191
128
|
Enabled: false
|
192
129
|
|
193
|
-
##################### Metrics ##################################
|
194
130
|
|
195
131
|
Metrics/AbcSize:
|
196
132
|
Enabled: false
|
197
133
|
|
198
134
|
Metrics/CyclomaticComplexity:
|
199
|
-
|
135
|
+
Max: 10
|
200
136
|
|
201
137
|
Metrics/PerceivedComplexity:
|
202
138
|
Enabled: false
|
@@ -204,6 +140,10 @@ Metrics/PerceivedComplexity:
|
|
204
140
|
Metrics/BlockLength:
|
205
141
|
Enabled: false
|
206
142
|
|
143
|
+
Layout/LineLength:
|
144
|
+
Enabled: false
|
145
|
+
|
146
|
+
|
207
147
|
Metrics/MethodLength:
|
208
148
|
Enabled: false
|
209
149
|
|
@@ -216,14 +156,35 @@ Naming/HeredocDelimiterNaming:
|
|
216
156
|
Naming/AccessorMethodName:
|
217
157
|
Enabled: false
|
218
158
|
|
219
|
-
|
159
|
+
Metrics/ModuleLength:
|
220
160
|
Enabled: false
|
221
161
|
|
222
|
-
Lint/
|
162
|
+
Lint/UnusedBlockArgument:
|
223
163
|
Enabled: false
|
224
164
|
|
225
|
-
|
165
|
+
Lint/RescueException:
|
226
166
|
Enabled: false
|
227
167
|
|
228
|
-
|
168
|
+
Naming/RescuedExceptionsVariableName:
|
169
|
+
Enabled: false
|
170
|
+
|
171
|
+
Bundler/GemComment:
|
172
|
+
Enabled: false
|
173
|
+
|
174
|
+
Style/SafeNavigation:
|
175
|
+
Enabled: false
|
176
|
+
|
177
|
+
Lint/NumberConversion:
|
178
|
+
Enabled: false
|
179
|
+
Style/ConstantVisibility:
|
180
|
+
Enabled: false
|
181
|
+
Style/MutableConstant:
|
182
|
+
Enabled: false
|
183
|
+
Style/Copyright:
|
184
|
+
Enabled: false
|
185
|
+
Style/MultilineTernaryOperator:
|
186
|
+
Enabled: false
|
187
|
+
Layout/MultilineAssignmentLayout:
|
188
|
+
Enabled: false
|
189
|
+
Style/Send:
|
229
190
|
Enabled: false
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hotel_price (0.5.
|
5
|
-
activesupport (~> 6.0.2.
|
6
|
-
json (~> 2.3.
|
4
|
+
hotel_price (0.5.9)
|
5
|
+
activesupport (~> 6.0.2.2)
|
6
|
+
json (~> 2.3.1)
|
7
7
|
nokogiri (~> 1.10.9)
|
8
8
|
selenium-webdriver (~> 3.141)
|
9
9
|
|
@@ -18,28 +18,28 @@ GEM
|
|
18
18
|
zeitwerk (~> 2.2)
|
19
19
|
childprocess (3.0.0)
|
20
20
|
concurrent-ruby (1.1.6)
|
21
|
-
diff-lcs (1.
|
22
|
-
i18n (1.8.
|
21
|
+
diff-lcs (1.4.4)
|
22
|
+
i18n (1.8.5)
|
23
23
|
concurrent-ruby (~> 1.0)
|
24
|
-
json (2.3.
|
24
|
+
json (2.3.1)
|
25
25
|
mini_portile2 (2.4.0)
|
26
|
-
minitest (5.14.
|
27
|
-
nokogiri (1.10.
|
26
|
+
minitest (5.14.1)
|
27
|
+
nokogiri (1.10.10)
|
28
28
|
mini_portile2 (~> 2.4.0)
|
29
29
|
rake (13.0.1)
|
30
30
|
rspec (3.9.0)
|
31
31
|
rspec-core (~> 3.9.0)
|
32
32
|
rspec-expectations (~> 3.9.0)
|
33
33
|
rspec-mocks (~> 3.9.0)
|
34
|
-
rspec-core (3.9.
|
35
|
-
rspec-support (~> 3.9.
|
36
|
-
rspec-expectations (3.9.
|
34
|
+
rspec-core (3.9.2)
|
35
|
+
rspec-support (~> 3.9.3)
|
36
|
+
rspec-expectations (3.9.2)
|
37
37
|
diff-lcs (>= 1.2.0, < 2.0)
|
38
38
|
rspec-support (~> 3.9.0)
|
39
|
-
rspec-mocks (3.9.
|
39
|
+
rspec-mocks (3.9.1)
|
40
40
|
diff-lcs (>= 1.2.0, < 2.0)
|
41
41
|
rspec-support (~> 3.9.0)
|
42
|
-
rspec-support (3.9.
|
42
|
+
rspec-support (3.9.3)
|
43
43
|
rubyzip (2.3.0)
|
44
44
|
selenium-webdriver (3.142.7)
|
45
45
|
childprocess (>= 0.5, < 4.0)
|
@@ -47,7 +47,7 @@ GEM
|
|
47
47
|
thread_safe (0.3.6)
|
48
48
|
tzinfo (1.2.7)
|
49
49
|
thread_safe (~> 0.1)
|
50
|
-
zeitwerk (2.
|
50
|
+
zeitwerk (2.4.0)
|
51
51
|
|
52
52
|
PLATFORMS
|
53
53
|
ruby
|
@@ -56,7 +56,7 @@ DEPENDENCIES
|
|
56
56
|
bundler (~> 2.0)
|
57
57
|
hotel_price!
|
58
58
|
rake (>= 12.3.3)
|
59
|
-
rspec (~> 3.0)
|
59
|
+
rspec (~> 3.9.0)
|
60
60
|
|
61
61
|
BUNDLED WITH
|
62
62
|
2.1.4
|
data/hotel_price.gemspec
CHANGED
@@ -8,20 +8,21 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["Fumitake Kawasaki", "James Neve"]
|
9
9
|
spec.email = ["fumitake.kawasaki@el-soul.com", "jamesoneve@gmail.com"]
|
10
10
|
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage = "https://github.com/
|
11
|
+
spec.summary = "Scraping Library to get world hotel price"
|
12
|
+
spec.description = "Empower World Travel Information Technology "
|
13
|
+
spec.homepage = "https://github.com/elsoul/hotel_price"
|
14
14
|
spec.license = "MIT"
|
15
|
-
spec.metadata = { "source_code_uri" =>"https://github.com/
|
15
|
+
spec.metadata = { "source_code_uri" => "https://github.com/elsoul/hotel_price" }
|
16
|
+
spec.required_ruby_version = ">= 2.7.0"
|
16
17
|
# spec.metadata["allowed_push_host"] = "https://hotel.el-soul.com"
|
17
18
|
|
18
19
|
spec.metadata["homepage_uri"] = spec.homepage
|
19
|
-
spec.metadata["source_code_uri"] = "https://github.com/
|
20
|
-
spec.metadata["changelog_uri"] = "https://github.com/
|
20
|
+
spec.metadata["source_code_uri"] = "https://github.com/elsoul/hotel_price"
|
21
|
+
spec.metadata["changelog_uri"] = "https://github.com/elsoul/hotel_price"
|
21
22
|
|
22
23
|
# Specify which files should be added to the gem when it is released.
|
23
24
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
-
spec.files
|
25
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
25
26
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
27
|
end
|
27
28
|
spec.bindir = "exe"
|
@@ -30,9 +31,9 @@ Gem::Specification.new do |spec|
|
|
30
31
|
|
31
32
|
spec.add_development_dependency "bundler", "~> 2.0"
|
32
33
|
spec.add_development_dependency "rake", ">= 12.3.3"
|
33
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
34
|
-
spec.add_runtime_dependency "activesupport", "~> 6.0.2.
|
34
|
+
spec.add_development_dependency "rspec", "~> 3.9.0"
|
35
|
+
spec.add_runtime_dependency "activesupport", "~> 6.0.2.2"
|
36
|
+
spec.add_runtime_dependency "json", "~> 2.3.1"
|
35
37
|
spec.add_runtime_dependency "nokogiri", "~> 1.10.9"
|
36
38
|
spec.add_runtime_dependency "selenium-webdriver", "~> 3.141"
|
37
|
-
spec.add_runtime_dependency "json", "~> 2.3.0"
|
38
39
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module HotelPrice::Jalan
|
2
|
+
require "nokogiri"
|
3
|
+
require "open-uri"
|
4
|
+
class JalanAPI
|
5
|
+
def initialize params
|
6
|
+
@config = {
|
7
|
+
jalan_hotel_id: params[:jalan_hotel_id] ||= 0,
|
8
|
+
jalan_api_key: params[:jalan_api_key] ||= ENV["JALAN_API_KEY"]
|
9
|
+
}
|
10
|
+
end
|
11
|
+
|
12
|
+
def test
|
13
|
+
@config[:jalan_api_key]
|
14
|
+
end
|
15
|
+
|
16
|
+
def get_min_price params
|
17
|
+
url = "http://jws.jalan.net/APIAdvance/StockSearch/V1/?key=#{@config[:jalan_api_key]}&h_id=#{@config[:jalan_hotel_id]}&stay_date=#{params[:checkin_date]}&stay_count=1&adult_num=#{params[:adult_num]}&count=1"
|
18
|
+
doc = Nokogiri::XML(open(url))
|
19
|
+
if doc.css("NumberOfResults").text == "0"
|
20
|
+
{
|
21
|
+
date: DateTime.now.strftime("%Y-%m-%d"),
|
22
|
+
jalan_hotel_id: @config[:jalan_hotel_id],
|
23
|
+
checkin_date: params[:checkin_date],
|
24
|
+
plan_num: 0,
|
25
|
+
min_price: 0
|
26
|
+
}
|
27
|
+
else
|
28
|
+
{
|
29
|
+
date: DateTime.now.strftime("%Y-%m-%d"),
|
30
|
+
jalan_hotel_id: @config[:jalan_hotel_id],
|
31
|
+
checkin_date: params[:checkin_date],
|
32
|
+
hotel_name: doc.css("Plan").css("Hotel HotelName").text,
|
33
|
+
room_name: doc.css("Plan").css("RoomName").text,
|
34
|
+
plan_name: doc.css("Plan").css("PlanName").text,
|
35
|
+
plan_num: doc.css("NumberOfResults").text,
|
36
|
+
min_price: doc.css("Plan").css("Stay Rate").text
|
37
|
+
}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module HotelPrice::Jalan
|
2
|
+
class JalanScraper
|
3
|
+
@mode
|
4
|
+
|
5
|
+
def initialize(mode = :chrome)
|
6
|
+
@mode = mode
|
7
|
+
end
|
8
|
+
|
9
|
+
def get_price(jalan_hotel_id, checkin_date, num_adults)
|
10
|
+
date = DateTime.now.strftime("%Y-%m-%d")
|
11
|
+
|
12
|
+
query_string = make_query_string(checkin_date.to_s, num_adults)
|
13
|
+
url = "https://www.jalan.net/yad#{jalan_hotel_id}/plan/?screenId=UWW3101&yadNo=#{jalan_hotel_id}&#{query_string}"
|
14
|
+
driver = HotelPrice.get_selenium_driver @mode
|
15
|
+
driver.get(url)
|
16
|
+
sleep 2
|
17
|
+
@price_box = []
|
18
|
+
driver.find_elements(class_name: "p-planCassette").each do |f|
|
19
|
+
rows = f.find_elements(:xpath, "//tr")
|
20
|
+
rows.each do |e|
|
21
|
+
@price_box << {
|
22
|
+
date: date,
|
23
|
+
min_price: e.find_element(class_name: "p-searchResultItem__total").text.delete("^0-9").to_i,
|
24
|
+
hotel_name: driver.find_element(id: "yado_header_hotel_name").text,
|
25
|
+
room_name: e.find_element(class_name: "p-searchResultItem__planName").text,
|
26
|
+
plan_name: f.find_element(class_name: "p-planCassette__header").text
|
27
|
+
}
|
28
|
+
rescue StandardError
|
29
|
+
{ date: date, min_price: 0 }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
@price_box.sort_by { |_a, _b, c| c }.reverse.first || { date: date, min_price: 0 }
|
33
|
+
rescue StandardError
|
34
|
+
{ date: date, min_price: 0 }
|
35
|
+
end
|
36
|
+
|
37
|
+
def make_query_string(checkin_date, num_adults)
|
38
|
+
cd_args = make_date_args checkin_date
|
39
|
+
na_args = make_num_adults_arg num_adults
|
40
|
+
"rootCd=7701&callbackHistFlg=1&contHideFlg=1&reSearchFlg=1&roomCrack=100000&smlCd=121108&distCd=01&#{cd_args}&stayCount=1&roomCount=1&#{na_args}&minPrice=0&maxPrice=999999"
|
41
|
+
end
|
42
|
+
|
43
|
+
def make_date_args checkin_date
|
44
|
+
Date.parse checkin_date rescue return ""
|
45
|
+
Date.parse(checkin_date).strftime("stayYear=%Y&stayMonth=%m&stayDay=%d")
|
46
|
+
end
|
47
|
+
|
48
|
+
def make_num_adults_arg num_adults
|
49
|
+
return "" if num_adults.to_i < 1
|
50
|
+
"adultNum=#{num_adults}"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/hotel_price/version.rb
CHANGED
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.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fumitake Kawasaki
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-08-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -45,70 +45,70 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
48
|
+
version: 3.9.0
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: 3.9.0
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: activesupport
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 6.0.2.
|
62
|
+
version: 6.0.2.2
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 6.0.2.
|
69
|
+
version: 6.0.2.2
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
71
|
+
name: json
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: 2.3.1
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
83
|
+
version: 2.3.1
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
85
|
+
name: nokogiri
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
90
|
+
version: 1.10.9
|
91
91
|
type: :runtime
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version:
|
97
|
+
version: 1.10.9
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
|
-
name:
|
99
|
+
name: selenium-webdriver
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
102
|
- - "~>"
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version:
|
104
|
+
version: '3.141'
|
105
105
|
type: :runtime
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
109
|
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version:
|
111
|
+
version: '3.141'
|
112
112
|
description: 'Empower World Travel Information Technology '
|
113
113
|
email:
|
114
114
|
- fumitake.kawasaki@el-soul.com
|
@@ -118,7 +118,6 @@ executables:
|
|
118
118
|
extensions: []
|
119
119
|
extra_rdoc_files: []
|
120
120
|
files:
|
121
|
-
- ".DS_Store"
|
122
121
|
- ".gitignore"
|
123
122
|
- ".rspec"
|
124
123
|
- ".rubocop.yml"
|
@@ -143,6 +142,9 @@ files:
|
|
143
142
|
- lib/hotel_price/configuration.rb
|
144
143
|
- lib/hotel_price/expedia.rb
|
145
144
|
- lib/hotel_price/expedia/expedia_scraper.rb
|
145
|
+
- lib/hotel_price/expedia/jalan/jalan_api.rb
|
146
|
+
- lib/hotel_price/expedia/jalan/jalan_console.rb
|
147
|
+
- lib/hotel_price/expedia/jalan/jalan_scraper.rb
|
146
148
|
- lib/hotel_price/jalan.rb
|
147
149
|
- lib/hotel_price/jalan/jalan_api.rb
|
148
150
|
- lib/hotel_price/jalan/jalan_console.rb
|
@@ -152,13 +154,13 @@ files:
|
|
152
154
|
- lib/hotel_price/rakuten/rakuten_console.rb
|
153
155
|
- lib/hotel_price/rakuten/rakuten_scraper.rb
|
154
156
|
- lib/hotel_price/version.rb
|
155
|
-
homepage: https://github.com/
|
157
|
+
homepage: https://github.com/elsoul/hotel_price
|
156
158
|
licenses:
|
157
159
|
- MIT
|
158
160
|
metadata:
|
159
|
-
source_code_uri: https://github.com/
|
160
|
-
homepage_uri: https://github.com/
|
161
|
-
changelog_uri: https://github.com/
|
161
|
+
source_code_uri: https://github.com/elsoul/hotel_price
|
162
|
+
homepage_uri: https://github.com/elsoul/hotel_price
|
163
|
+
changelog_uri: https://github.com/elsoul/hotel_price
|
162
164
|
post_install_message:
|
163
165
|
rdoc_options: []
|
164
166
|
require_paths:
|
@@ -167,14 +169,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
167
169
|
requirements:
|
168
170
|
- - ">="
|
169
171
|
- !ruby/object:Gem::Version
|
170
|
-
version:
|
172
|
+
version: 2.7.0
|
171
173
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
174
|
requirements:
|
173
175
|
- - ">="
|
174
176
|
- !ruby/object:Gem::Version
|
175
177
|
version: '0'
|
176
178
|
requirements: []
|
177
|
-
rubygems_version: 3.
|
179
|
+
rubygems_version: 3.1.4
|
178
180
|
signing_key:
|
179
181
|
specification_version: 4
|
180
182
|
summary: Scraping Library to get world hotel price
|
data/.DS_Store
DELETED
Binary file
|