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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef8c7070028d583ac2dd113f97288c42f27b3788
4
- data.tar.gz: 1dd7debcff3725741cc20011ccbad30db22700bb
3
+ metadata.gz: b9bfb8bb6f132db74e4879b25d7654975ecd4c5d
4
+ data.tar.gz: 7c15de88e3b663d2db0e541ebd0827e56a6c6190
5
5
  SHA512:
6
- metadata.gz: 2e4a754093b5e8c2e97a908d1b2d1a50397d9ece269c5f7c196d671acb634010141d61c46964559a230919ca970b781591c3dbdeb2fa790a1a6e49af7bcc9b92
7
- data.tar.gz: cab3957f5b0c125ba7cba9a3772845d1f89fca8558250e8e75bc478b80618f414967447f4cf7f632ba8a6619a73390f97a8b619e678d8c833c18e2e4b83bbe43
6
+ metadata.gz: 9da48bd7edd2fa545bf196c31409203da82862a3a9ec5ba022053e58d3fa6b1a6a3fac270a57e326b41897ae2c3ee337dd50e3d4f9368adfc367d85156255950
7
+ data.tar.gz: 413e531b644598a7274586d93ffb9d224f5063c3f0706ef347ed96a645058fcd6dde256dcbfa67324bcb2f2917abdc6a8fab476fcfc5fa3e6805f666f04f8d29
data/README.md CHANGED
@@ -7,7 +7,7 @@ This is a wrapper for the Booking.com API. Currently only the `gethotelavailbili
7
7
  Add this line to your application's Gemfile:
8
8
 
9
9
  ```ruby
10
- gem 'booking-ruby'
10
+ gem 'booking-ruby', require: ['booking_api']
11
11
  ```
12
12
 
13
13
  And then execute:
@@ -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
@@ -4,6 +4,9 @@ require "json"
4
4
  require "booking_api/version"
5
5
  require "booking_api/client"
6
6
  require "booking_api/http_service"
7
+ require "booking_api/images"
8
+ require "booking_api/images/image"
9
+ require "booking_api/images/response_list"
7
10
 
8
11
  module BookingApi
9
12
 
@@ -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,5 @@
1
+ module BookingApi
2
+ # functionality related to handling images.
3
+ module Images
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ module BookingApi
2
+ # functionality related to handling images.
3
+ module Images
4
+ class Image
5
+ attr_reader :raw_data
6
+ def initialize(raw_data = {})
7
+ @raw_data = raw_data
8
+ end
9
+ end
10
+ end
11
+ 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
@@ -1,3 +1,3 @@
1
1
  module BookingApi
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
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.2
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-03-22 00:00:00.000000000 Z
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: