zumata_v3 0.0.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 +7 -0
- data/.gitignore +16 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +20 -0
- data/Rakefile +10 -0
- data/examples/example.rb +127 -0
- data/lib/zumata_v3/client.rb +107 -0
- data/lib/zumata_v3/config.rb +20 -0
- data/lib/zumata_v3/errors.rb +50 -0
- data/lib/zumata_v3/responses.rb +13 -0
- data/lib/zumata_v3/version.rb +3 -0
- data/lib/zumata_v3.rb +8 -0
- data/spec/cassettes/2015-07-24/book_done.yml +32 -0
- data/spec/cassettes/2015-07-24/cancel_cancelled.yml +28 -0
- data/spec/cassettes/2015-07-24/cancel_done.yml +28 -0
- data/spec/cassettes/2015-07-24/cancel_fail.yml +28 -0
- data/spec/cassettes/2015-07-24/get_book_done.yml +30 -0
- data/spec/cassettes/2015-07-24/get_book_fail.yml +28 -0
- data/spec/cassettes/2015-07-24/get_prebook_done.yml +28 -0
- data/spec/cassettes/2015-07-24/get_prebook_fail.yml +28 -0
- data/spec/cassettes/2015-07-24/prebook_done.yml +28 -0
- data/spec/cassettes/2015-07-24/prebook_fail.yml +29 -0
- data/spec/cassettes/2015-07-24/search_by_destination_id_done.yml +82 -0
- data/spec/cassettes/2015-07-24/search_by_destination_id_fail.yml +29 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/zumata_spec.rb +228 -0
- data/zumata_v3.gemspec +30 -0
- metadata +190 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 57ac69048696ee15e681d791d65ecc3a8c71578f
|
4
|
+
data.tar.gz: f8d06cf7abb1cef0ad3d01d668316d07ae08ae0b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5b4fc73126b7ee31f3579026413728bad33edd12b890c51110bca51d353f937a7da8879932ef7a1861801fec43cbaa429b8a94b59dc573590eb5475d101f81f2
|
7
|
+
data.tar.gz: 6ee6ec75e6ec9c312ec49a0d776272cb6900be51594a305762e900302e36e59c32cf37111aebc544c2fa7d6f88a407fce48b704d8b546348e7990801165bedc2
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Zumata
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# Zumata
|
2
|
+
|
3
|
+
For interaction with the Zumata API 3.0
|
4
|
+
[insert docs link]
|
5
|
+
|
6
|
+
## Configuration
|
7
|
+
```
|
8
|
+
Zumata.configure do |config|
|
9
|
+
config.api_url = "http://INSERT_API_URL"
|
10
|
+
config.api_key = "YOUR_SECRET_API_KEY"
|
11
|
+
end
|
12
|
+
```
|
13
|
+
|
14
|
+
## Contributing
|
15
|
+
|
16
|
+
1. Fork it ( https://github.com/Zumata/v3-ruby-client/fork )
|
17
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
18
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
19
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
20
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'rspec/core/rake_task'
|
2
|
+
require 'bundler/gem_tasks'
|
3
|
+
|
4
|
+
# Default directory to look in is `/specs`
|
5
|
+
# Run with `rake spec`
|
6
|
+
RSpec::Core::RakeTask.new(:spec) do |task|
|
7
|
+
task.rspec_opts = ['--color', '--format', 'nested']
|
8
|
+
end
|
9
|
+
|
10
|
+
task :default => :spec
|
data/examples/example.rb
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
require 'zumata_v3'
|
2
|
+
|
3
|
+
API_KEY = "YOUR API KEY"
|
4
|
+
API_URL = "https://test.api-v3.zumata.com"
|
5
|
+
|
6
|
+
#####################
|
7
|
+
# Initialize Client
|
8
|
+
#####################
|
9
|
+
|
10
|
+
ZumataV3.configure do |config|
|
11
|
+
config.api_url = API_URL
|
12
|
+
config.api_key = API_KEY
|
13
|
+
end
|
14
|
+
|
15
|
+
@client = ZumataV3::HotelClient.new
|
16
|
+
|
17
|
+
|
18
|
+
#####################
|
19
|
+
# Search package by destination id
|
20
|
+
#####################
|
21
|
+
|
22
|
+
status = "in-progress"
|
23
|
+
|
24
|
+
search = {
|
25
|
+
:destination_id => "f75a8cff-c26e-4603-7b45-1b0f8a5aa100",
|
26
|
+
:check_in_date => "2015-09-09",
|
27
|
+
:check_out_date => "2015-09-10",
|
28
|
+
:room_count => 1,
|
29
|
+
:adult_count => 2
|
30
|
+
}
|
31
|
+
|
32
|
+
config = {
|
33
|
+
:pricing => {
|
34
|
+
:fixed_tolerance => 1
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
guest = {
|
39
|
+
:salutation => "Mr.",
|
40
|
+
:first_name => "Charlie",
|
41
|
+
:last_name => "Smith",
|
42
|
+
:email => "charlie.smith@zumata.com",
|
43
|
+
:city => "Montreal",
|
44
|
+
:state => "Quebec",
|
45
|
+
:street => "123 Outtamy way",
|
46
|
+
:postal_code => "H3H0H0",
|
47
|
+
:country => "Canada",
|
48
|
+
:room_remarks => "3 carpets please",
|
49
|
+
:nationality => "Canadian",
|
50
|
+
:contact_no => "+1 514 555-1234",
|
51
|
+
}
|
52
|
+
|
53
|
+
# Keep searching until the api returned a non-empty results
|
54
|
+
while status == "in-progress"
|
55
|
+
result = @client.search_by_destination_id search[:destination_id], {
|
56
|
+
check_in_date: search[:check_in_date],
|
57
|
+
check_out_date: search[:check_out_date]}
|
58
|
+
|
59
|
+
output = JSON.parse(result.body)
|
60
|
+
status = "complete" if output["results"].first != nil || output["status"] == "complete"
|
61
|
+
sleep 10 unless status != "in-progress"
|
62
|
+
end
|
63
|
+
|
64
|
+
if output["results"].first == nil
|
65
|
+
puts "no results"
|
66
|
+
exit
|
67
|
+
end
|
68
|
+
|
69
|
+
package = output["results"].first[1][0]
|
70
|
+
|
71
|
+
|
72
|
+
#####################
|
73
|
+
# Pre-book a package
|
74
|
+
#####################
|
75
|
+
|
76
|
+
result = @client.pre_book search, package, config
|
77
|
+
output = JSON.parse(result.body)
|
78
|
+
|
79
|
+
|
80
|
+
#####################
|
81
|
+
# Get pre-book details by pre-book id
|
82
|
+
#####################
|
83
|
+
|
84
|
+
pre_book_id = output["pre_book_id"]
|
85
|
+
result = @client.pre_book_details pre_book_id
|
86
|
+
output = JSON.parse(result.body)
|
87
|
+
|
88
|
+
|
89
|
+
#####################
|
90
|
+
# Book a package (with credit) by using pre-book id
|
91
|
+
#####################
|
92
|
+
|
93
|
+
result = @client.book_by_credit guest, pre_book_id, {affiliate_key: "testing"}
|
94
|
+
output = JSON.parse(result.body)
|
95
|
+
reference = output["reference"]
|
96
|
+
|
97
|
+
result = @client.booking_status reference
|
98
|
+
output = JSON.parse(result.body)
|
99
|
+
|
100
|
+
puts reference
|
101
|
+
|
102
|
+
|
103
|
+
#####################
|
104
|
+
# Get booking information by reference
|
105
|
+
#####################
|
106
|
+
|
107
|
+
status = "IP"
|
108
|
+
while status == "IP"
|
109
|
+
result = @client.booking_status reference
|
110
|
+
output = JSON.parse(result.body)
|
111
|
+
status = output["status"]
|
112
|
+
puts output["status"]
|
113
|
+
sleep 10 if status == "IP"
|
114
|
+
end
|
115
|
+
|
116
|
+
if output["status"] != "CF"
|
117
|
+
puts "booking not confirmed, exiting..."
|
118
|
+
exit
|
119
|
+
end
|
120
|
+
|
121
|
+
#####################
|
122
|
+
# Cancel booking by reference
|
123
|
+
#####################
|
124
|
+
|
125
|
+
result = @client.cancel reference
|
126
|
+
output = JSON.parse(result.body)
|
127
|
+
puts output
|
@@ -0,0 +1,107 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'time'
|
3
|
+
require 'awesome_print'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
module ZumataV3
|
7
|
+
class HotelClient
|
8
|
+
include HTTParty
|
9
|
+
|
10
|
+
def initialize opts={}
|
11
|
+
raise ZumataV3::ClientConfigError.new("No API URL configured or API key provided") if ZumataV3.configuration.nil?
|
12
|
+
raise ZumataV3::ClientConfigError.new("No API URL configured") if ["",nil].include?(ZumataV3.configuration.api_url)
|
13
|
+
raise ZumataV3::ClientConfigError.new("No API key provided") if ["",nil].include?(ZumataV3.configuration.api_key)
|
14
|
+
@api_url = ZumataV3.configuration.api_url
|
15
|
+
@api_key = ZumataV3.configuration.api_key
|
16
|
+
end
|
17
|
+
|
18
|
+
# GET /search
|
19
|
+
def search_by_destination_id destination_id, opts={}
|
20
|
+
|
21
|
+
q = { destination_id: destination_id,
|
22
|
+
room_count: opts[:room_count] || 1,
|
23
|
+
adult_count: opts[:adult_count] || 2,
|
24
|
+
currency: opts[:currency] || "USD" }
|
25
|
+
|
26
|
+
q[:child_count] = opts[:child_count] if opts[:child_count]
|
27
|
+
q[:source_market] = opts[:source_market] if opts[:source_market]
|
28
|
+
|
29
|
+
q[:check_in_date] = opts[:check_in_date]
|
30
|
+
q[:check_out_date] = opts[:check_out_date]
|
31
|
+
|
32
|
+
headers = init_headers opts
|
33
|
+
res = self.class.get("#{@api_url}/search", query: q, headers: headers).response
|
34
|
+
ZumataV3::ErrorClassifier.handle(res.code.to_i, res.body) unless [200,201].include?(res.code.to_i)
|
35
|
+
ZumataV3::GenericResponse.new(context: q, code: res.code.to_i, body: res.body)
|
36
|
+
end
|
37
|
+
|
38
|
+
# POST /pre_book
|
39
|
+
def pre_book search, package, config, opts={}
|
40
|
+
|
41
|
+
req = { search: search,
|
42
|
+
package: package,
|
43
|
+
config: config }
|
44
|
+
|
45
|
+
headers = init_headers opts
|
46
|
+
res = self.class.post("#{@api_url}/pre_book", body: req.to_json, headers: headers).response
|
47
|
+
ZumataV3::ErrorClassifier.handle(res.code.to_i, res.body) unless [200,201].include?(res.code.to_i)
|
48
|
+
ZumataV3::GenericResponse.new(context: req, code: res.code.to_i, body: res.body)
|
49
|
+
end
|
50
|
+
|
51
|
+
# GET /pre_book
|
52
|
+
def pre_book_details pre_book_id, opts={}
|
53
|
+
headers = init_headers opts
|
54
|
+
res = self.class.get("#{@api_url}/pre_book/#{pre_book_id}", headers: headers).response
|
55
|
+
ZumataV3::ErrorClassifier.handle(res.code.to_i, res.body) unless [200,201].include?(res.code.to_i)
|
56
|
+
ZumataV3::GenericResponse.new(context: {pre_book_id: pre_book_id}, code: res.code.to_i, body: res.body)
|
57
|
+
end
|
58
|
+
|
59
|
+
# POST /book
|
60
|
+
def book_by_credit guest, pre_book_id, opts={}
|
61
|
+
|
62
|
+
req = { guest: guest,
|
63
|
+
payment: {
|
64
|
+
:type => "credit"
|
65
|
+
},
|
66
|
+
pre_book_id: pre_book_id }
|
67
|
+
|
68
|
+
req[:affiliate_key] = opts[:affiliate_key] if opts[:affiliate_key]
|
69
|
+
|
70
|
+
headers = init_headers opts
|
71
|
+
res = self.class.post("#{@api_url}/book", body: req.to_json, headers: headers).response
|
72
|
+
ZumataV3::ErrorClassifier.handle(res.code.to_i, res.body) unless [200,201].include?(res.code.to_i)
|
73
|
+
ZumataV3::GenericResponse.new(context: req, code: res.code.to_i, body: res.body)
|
74
|
+
end
|
75
|
+
|
76
|
+
# GET /book/status
|
77
|
+
def booking_status reference, opts={}
|
78
|
+
headers = init_headers opts
|
79
|
+
res = self.class.get("#{@api_url}/book/status/#{reference}", headers: headers).response
|
80
|
+
ZumataV3::ErrorClassifier.handle(res.code.to_i, res.body) unless [200,201].include?(res.code.to_i)
|
81
|
+
ZumataV3::GenericResponse.new(context: {reference: reference}, code: res.code.to_i, body: res.body)
|
82
|
+
end
|
83
|
+
|
84
|
+
# POST /cancel
|
85
|
+
def cancel reference, opts={}
|
86
|
+
|
87
|
+
req = {
|
88
|
+
reference: reference
|
89
|
+
}
|
90
|
+
|
91
|
+
headers = init_headers opts
|
92
|
+
res = self.class.post("#{@api_url}/cancel", body: req.to_json, headers: headers).response
|
93
|
+
ZumataV3::ErrorClassifier.handle(res.code.to_i, res.body) unless [200,201].include?(res.code.to_i)
|
94
|
+
ZumataV3::GenericResponse.new(context: {reference: reference}, code: res.code.to_i, body: res.body)
|
95
|
+
end
|
96
|
+
|
97
|
+
private
|
98
|
+
|
99
|
+
def init_headers opts={}
|
100
|
+
headers = {"X-Api-Key" => @api_key}
|
101
|
+
if opts[:headers] != nil && opts[:headers].class == Hash
|
102
|
+
headers = headers.merge(opts[:headers])
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module ZumataV3
|
2
|
+
class << self
|
3
|
+
attr_accessor :configuration
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.configure
|
7
|
+
self.configuration ||= Configuration.new
|
8
|
+
yield(configuration)
|
9
|
+
end
|
10
|
+
|
11
|
+
class Configuration
|
12
|
+
attr_accessor :api_url, :api_key
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
@api_url = ''
|
16
|
+
@api_key = nil
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'awesome_print'
|
3
|
+
|
4
|
+
module ZumataV3
|
5
|
+
|
6
|
+
class ZumataError < StandardError; end
|
7
|
+
class ClientConfigError < ZumataError; end
|
8
|
+
|
9
|
+
class GeneralError < ZumataError; end
|
10
|
+
class BadRequestError < ZumataError; end
|
11
|
+
class InvalidApiKeyError < ZumataError; end
|
12
|
+
class ForbiddenError < ZumataError; end
|
13
|
+
class UnprocessableEntityError < ZumataError; end
|
14
|
+
class NotFoundError < ZumataError; end
|
15
|
+
class ServerError < ZumataError; end
|
16
|
+
class SupplierError < ZumataError; end
|
17
|
+
|
18
|
+
module ErrorClassifier
|
19
|
+
def self.handle status_code, body
|
20
|
+
json = nil
|
21
|
+
begin
|
22
|
+
json = JSON.parse(body)
|
23
|
+
rescue JSON::ParserError
|
24
|
+
raise GeneralError, body
|
25
|
+
end
|
26
|
+
classify_by_id(json)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.classify_by_id err
|
30
|
+
case err["id"]
|
31
|
+
when "bad_request"
|
32
|
+
raise BadRequestError, err["message"]
|
33
|
+
when "invalid_api_key"
|
34
|
+
raise InvalidApiKeyError, err["message"]
|
35
|
+
when "forbidden"
|
36
|
+
raise ForbiddenError, err["message"]
|
37
|
+
when "unprocessable_entity"
|
38
|
+
raise UnprocessableEntityError, err["message"]
|
39
|
+
when "not_found"
|
40
|
+
raise NotFoundError, err["message"]
|
41
|
+
when "server_error"
|
42
|
+
raise ServerError, err["message"]
|
43
|
+
when "supplier_error"
|
44
|
+
raise SupplierError, err["message"]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
data/lib/zumata_v3.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://localhost:3001/book
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"guest":{"salutation":"Mr.","first_name":"Charlie","last_name":"Smith","email":"charlie.smith@zumata.com","city":"Montreal","state":"Quebec","street":"123
|
9
|
+
Outtamy way","postal_code":"H3H0H0","country":"Canada","room_remarks":"3 carpets
|
10
|
+
please","nationality":"Canadian","contact_no":"+1 514 555-1234"},"payment":{"type":"credit"},"pre_book_id":"2b076a9d-9051-4ab5-57f7-59aaf9d8ce2d","affiliate_key":""}'
|
11
|
+
headers:
|
12
|
+
X-Api-Key:
|
13
|
+
- XXXX1234
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 202
|
17
|
+
message: Accepted
|
18
|
+
headers:
|
19
|
+
Content-Type:
|
20
|
+
- application/json
|
21
|
+
Location:
|
22
|
+
- /book/status/9811f808-5284-45bc-4428-9e93b238855f
|
23
|
+
Date:
|
24
|
+
- Fri, 24 Jul 2015 06:59:21 GMT
|
25
|
+
Content-Length:
|
26
|
+
- '52'
|
27
|
+
body:
|
28
|
+
encoding: UTF-8
|
29
|
+
string: '{"reference":"9811f808-5284-45bc-4428-9e93b238855f"}'
|
30
|
+
http_version:
|
31
|
+
recorded_at: Fri, 24 Jul 2015 06:59:21 GMT
|
32
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://localhost:3001/cancel
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"reference":"cc7aa5e9-4cf4-436d-619d-29b7fd992c27"}'
|
9
|
+
headers:
|
10
|
+
X-Api-Key:
|
11
|
+
- XXXX1234
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 422
|
15
|
+
message: status code 422
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json
|
19
|
+
Date:
|
20
|
+
- Fri, 24 Jul 2015 06:59:21 GMT
|
21
|
+
Content-Length:
|
22
|
+
- '104'
|
23
|
+
body:
|
24
|
+
encoding: UTF-8
|
25
|
+
string: '{"id":"unprocessable_entity","message":"Invalid pre-condition to cancel","url":"http://docs.zumata.com"}'
|
26
|
+
http_version:
|
27
|
+
recorded_at: Fri, 24 Jul 2015 06:59:21 GMT
|
28
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://localhost:3001/cancel
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"reference":"cc7aa5e9-4cf4-436d-619d-29b7fd992c27"}'
|
9
|
+
headers:
|
10
|
+
X-Api-Key:
|
11
|
+
- XXXX1234
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json
|
19
|
+
Date:
|
20
|
+
- Fri, 24 Jul 2015 07:00:59 GMT
|
21
|
+
Content-Length:
|
22
|
+
- '11'
|
23
|
+
body:
|
24
|
+
encoding: UTF-8
|
25
|
+
string: '{"ok":true}'
|
26
|
+
http_version:
|
27
|
+
recorded_at: Fri, 24 Jul 2015 07:00:59 GMT
|
28
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://localhost:3001/cancel
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"reference":"invalid"}'
|
9
|
+
headers:
|
10
|
+
X-Api-Key:
|
11
|
+
- XXXX1234
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 404
|
15
|
+
message: Not Found
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json
|
19
|
+
Date:
|
20
|
+
- Fri, 24 Jul 2015 06:59:21 GMT
|
21
|
+
Content-Length:
|
22
|
+
- '71'
|
23
|
+
body:
|
24
|
+
encoding: UTF-8
|
25
|
+
string: '{"id":"not_found","message":"Not Found","url":"http://docs.zumata.com"}'
|
26
|
+
http_version:
|
27
|
+
recorded_at: Fri, 24 Jul 2015 06:59:21 GMT
|
28
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:3001/book/status/cc7aa5e9-4cf4-436d-619d-29b7fd992c27
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
X-Api-Key:
|
11
|
+
- XXXX1234
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json
|
19
|
+
Date:
|
20
|
+
- Fri, 24 Jul 2015 06:59:21 GMT
|
21
|
+
Content-Length:
|
22
|
+
- '897'
|
23
|
+
body:
|
24
|
+
encoding: UTF-8
|
25
|
+
string: '{"client_reference":"cc7aa5e9-4cf4-436d-619d-29b7fd992c27","status":"CX","requested_at":"2015-07-24T14:41:24.778304+08:00","package":{"hotel_id":"","room_details":{"description":"","food":0,"room_type":"","room_view":"","beds":null},"check_in_date":"2015-07-25T00:00:00Z","check_out_date":"2015-07-26T00:00:00Z","adult_count":2,"room_count":1},"guest":{"salutation":"Mr.","first_name":"Charlie","last_name":"Smith","email":"charlie.smith@zumata.com","city":"Montreal","state":"Quebec","street":"123
|
26
|
+
Outtamy way","postal_code":"H3H0H0","country":"Canada","nationality":"Canadian","contact_no":"+1
|
27
|
+
514 555-1234","remarks":"3 carpets please"},"pricing":{"zumata":{"currency":"USD","value":72},"client":{"currency":"","value":0}},"cancellation_details":{"status":"C","cancelled_at":"2015-07-24T14:55:28.450709+08:00","api_penalty":{"currency":"","value":0},"client_penalty":{"currency":"","value":0}}}'
|
28
|
+
http_version:
|
29
|
+
recorded_at: Fri, 24 Jul 2015 06:59:21 GMT
|
30
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:3001/book/status/invalid
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
X-Api-Key:
|
11
|
+
- XXXX1234
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 404
|
15
|
+
message: Not Found
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json
|
19
|
+
Date:
|
20
|
+
- Fri, 24 Jul 2015 06:59:21 GMT
|
21
|
+
Content-Length:
|
22
|
+
- '71'
|
23
|
+
body:
|
24
|
+
encoding: UTF-8
|
25
|
+
string: '{"id":"not_found","message":"Not Found","url":"http://docs.zumata.com"}'
|
26
|
+
http_version:
|
27
|
+
recorded_at: Fri, 24 Jul 2015 06:59:21 GMT
|
28
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:3001/pre_book/2b076a9d-9051-4ab5-57f7-59aaf9d8ce2d
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
X-Api-Key:
|
11
|
+
- XXXX1234
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json
|
19
|
+
Date:
|
20
|
+
- Fri, 24 Jul 2015 06:59:21 GMT
|
21
|
+
Content-Length:
|
22
|
+
- '802'
|
23
|
+
body:
|
24
|
+
encoding: UTF-8
|
25
|
+
string: '{"pre_book_id":"2b076a9d-9051-4ab5-57f7-59aaf9d8ce2d","cancellation_policy":{"remarks":"","cancellation_policies":[{"original_rate":0,"penalty_percentage":100,"date_from":"2015-07-23T00:00:00Z","date_to":"2304-07-24T14:40:16Z"}]},"request":{"search":{"destination_id":"f75a8cff-c26e-4603-7b45-1b0f8a5aa100","check_in_date":"2015-07-25","check_out_date":"2015-07-26","room_count":1,"adult_count":2},"package":{"hotel_id":"00d7ed72-2325-4225-5e95-02d340e48fe5","room_details":{"description":"Superior","food":1,"room_type":"Superior","room_view":"","beds":{"single":2}},"booking_key":"39c90b48","room_rate":144.92,"room_rate_currency":"USD","chargeable_rate":159.92,"chargeable_rate_currency":"USD"},"config":{"pricing":{"fixed_tolerance":1},"matching":{"flexible_room_view":true,"flexible_beds":true}}}}'
|
26
|
+
http_version:
|
27
|
+
recorded_at: Fri, 24 Jul 2015 06:59:21 GMT
|
28
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:3001/pre_book/invalid
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
X-Api-Key:
|
11
|
+
- XXXX1234
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 404
|
15
|
+
message: Not Found
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json
|
19
|
+
Date:
|
20
|
+
- Fri, 24 Jul 2015 06:59:21 GMT
|
21
|
+
Content-Length:
|
22
|
+
- '71'
|
23
|
+
body:
|
24
|
+
encoding: UTF-8
|
25
|
+
string: '{"id":"not_found","message":"Not Found","url":"http://docs.zumata.com"}'
|
26
|
+
http_version:
|
27
|
+
recorded_at: Fri, 24 Jul 2015 06:59:21 GMT
|
28
|
+
recorded_with: VCR 2.9.3
|