booking-ruby 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/booking.gemspec +3 -0
- data/lib/booking_api.rb +3 -0
- data/lib/booking_api/client.rb +9 -0
- data/lib/booking_api/images.rb +5 -0
- data/lib/booking_api/images/image.rb +11 -0
- data/lib/booking_api/images/response_list.rb +23 -0
- data/lib/booking_api/version.rb +1 -1
- metadata +47 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9bfb8bb6f132db74e4879b25d7654975ecd4c5d
|
4
|
+
data.tar.gz: 7c15de88e3b663d2db0e541ebd0827e56a6c6190
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9da48bd7edd2fa545bf196c31409203da82862a3a9ec5ba022053e58d3fa6b1a6a3fac270a57e326b41897ae2c3ee337dd50e3d4f9368adfc367d85156255950
|
7
|
+
data.tar.gz: 413e531b644598a7274586d93ffb9d224f5063c3f0706ef347ed96a645058fcd6dde256dcbfa67324bcb2f2917abdc6a8fab476fcfc5fa3e6805f666f04f8d29
|
data/README.md
CHANGED
data/booking.gemspec
CHANGED
@@ -21,6 +21,9 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.10"
|
22
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
23
|
spec.add_development_dependency "minitest"
|
24
|
+
spec.add_development_dependency "webmock"
|
25
|
+
spec.add_development_dependency "mocha"
|
26
|
+
spec.add_development_dependency "pry"
|
24
27
|
spec.add_dependency "faraday", "~> 0.9"
|
25
28
|
spec.add_dependency "faraday_middleware"
|
26
29
|
end
|
data/lib/booking_api.rb
CHANGED
data/lib/booking_api/client.rb
CHANGED
@@ -16,6 +16,15 @@ module BookingApi
|
|
16
16
|
http_service.request_post("/json/getHotelAvailabilityV2", default_parameters.merge(request_parameters))
|
17
17
|
end
|
18
18
|
|
19
|
+
def hotel_description_photos(hotel_ids: [], request_parameters: {})
|
20
|
+
raise ArgumentError if hotel_ids.empty?
|
21
|
+
default_parameters = {
|
22
|
+
hotel_ids: hotel_ids.join(",")
|
23
|
+
}
|
24
|
+
response = http_service.request_post("/json/bookings.getHotelDescriptionPhotos", default_parameters.merge(request_parameters))
|
25
|
+
Images::ResponseList.new(response)
|
26
|
+
end
|
27
|
+
|
19
28
|
private
|
20
29
|
|
21
30
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module BookingApi
|
2
|
+
# functionality related to handling images.
|
3
|
+
module Images
|
4
|
+
class ResponseList
|
5
|
+
attr_reader :response, :exception
|
6
|
+
|
7
|
+
def initialize(response, exception: nil)
|
8
|
+
@response = response
|
9
|
+
@exception = exception
|
10
|
+
end
|
11
|
+
|
12
|
+
def entries
|
13
|
+
@entries ||= parsed_entries_from_response.map {|entry| BookingApi::Images::Image.new(entry)}
|
14
|
+
end
|
15
|
+
|
16
|
+
def parsed_entries_from_response
|
17
|
+
JSON.parse(response.body)
|
18
|
+
rescue JSON::ParserError
|
19
|
+
[]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/booking_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: booking-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hendrik Kleinwaechter
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,48 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: webmock
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: mocha
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
55
97
|
- !ruby/object:Gem::Dependency
|
56
98
|
name: faraday
|
57
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,6 +141,9 @@ files:
|
|
99
141
|
- lib/booking_api.rb
|
100
142
|
- lib/booking_api/client.rb
|
101
143
|
- lib/booking_api/http_service.rb
|
144
|
+
- lib/booking_api/images.rb
|
145
|
+
- lib/booking_api/images/image.rb
|
146
|
+
- lib/booking_api/images/response_list.rb
|
102
147
|
- lib/booking_api/version.rb
|
103
148
|
homepage: https://github.com/hendricius/booking
|
104
149
|
licenses:
|