expedia_api 0.1.0 → 0.1.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b775cb669fbc7e21933c827b2f576308510b20fe
|
4
|
+
data.tar.gz: 031b9e06e2b77ae18e583a50d7c0ad1371fbb99b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a905024f1fe7eb4acc520ac59283037017122e7f1b5e4b957ade361207af61c6df969ddc416481d1db861dd1143a76ddc81cb69119542a1dfbda08c5e0261903
|
7
|
+
data.tar.gz: ade3c780ba67e6465e94c39686fc4d0b4c82776baad4fd44afb973c5b01fb94d3e2b6f41b3673ea40cf5221b679b79c087c5a7a1391a2c45c9a4fe06a76e2aab
|
data/lib/expedia_api.rb
CHANGED
@@ -0,0 +1,71 @@
|
|
1
|
+
module ExpediaApi
|
2
|
+
module Entities
|
3
|
+
class SearchEntity
|
4
|
+
attr_reader :raw_data
|
5
|
+
|
6
|
+
def initialize(raw_data)
|
7
|
+
@raw_data = raw_data
|
8
|
+
end
|
9
|
+
|
10
|
+
def available?
|
11
|
+
!!raw_data[:Price].fetch(:TotalRate, nil)
|
12
|
+
end
|
13
|
+
|
14
|
+
def sold_out?
|
15
|
+
!available?
|
16
|
+
end
|
17
|
+
|
18
|
+
def total_price_including_taxes
|
19
|
+
if available?
|
20
|
+
raw_data[:Price][:TotalRate][:Value].to_f
|
21
|
+
else
|
22
|
+
nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def currency
|
27
|
+
if available?
|
28
|
+
raw_data[:Price][:TotalRate][:Currency]
|
29
|
+
else
|
30
|
+
nil
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def id
|
35
|
+
raw_data[:HotelID].to_i
|
36
|
+
end
|
37
|
+
|
38
|
+
def expedia_id
|
39
|
+
id
|
40
|
+
end
|
41
|
+
|
42
|
+
def has_promotion?
|
43
|
+
!!raw_data[:Promotion].fetch(:Amount, nil)
|
44
|
+
end
|
45
|
+
|
46
|
+
def promotion_text
|
47
|
+
if has_promotion?
|
48
|
+
raw_data[:Promotion][:Description]
|
49
|
+
else
|
50
|
+
nil
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def promotion_value
|
55
|
+
if has_promotion?
|
56
|
+
raw_data[:Promotion][:Amount][:Value].to_f
|
57
|
+
else
|
58
|
+
nil
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def promotion_currency
|
63
|
+
if has_promotion?
|
64
|
+
raw_data[:Promotion][:Amount][:Currency]
|
65
|
+
else
|
66
|
+
nil
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/expedia_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: expedia_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hendrik Kleinwaechter
|
@@ -141,6 +141,8 @@ files:
|
|
141
141
|
- expedia_api.gemspec
|
142
142
|
- lib/expedia_api.rb
|
143
143
|
- lib/expedia_api/client.rb
|
144
|
+
- lib/expedia_api/entities.rb
|
145
|
+
- lib/expedia_api/entities/search_entity.rb
|
144
146
|
- lib/expedia_api/hotel_response_list.rb
|
145
147
|
- lib/expedia_api/http_service.rb
|
146
148
|
- lib/expedia_api/version.rb
|