bookingsync-api 0.0.26 → 0.0.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/bookingsync/api/client/bookings.rb +6 -2
- data/lib/bookingsync/api/version.rb +1 -1
- data/spec/bookingsync/api/client/bookings_spec.rb +5 -0
- data/spec/bookingsync/api/client/instant_bookings_spec.rb +2 -1
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_booking/returns_a_single_canceled_booking.yml +82 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_InstantBookings/_create_instant_booking/creates_a_booking.yml +15 -15
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04fcf20b67d1ca0e1804d2a756c690a08cb1c35e
|
4
|
+
data.tar.gz: e2c7c2152a9fde5cc67eedb3e5725b7ed9dc0173
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0249edc20b8655667eb4d86c41474caa543dae288923f89ff177d48abd0dc912f93af068294f7168508e309dd557a89fceae92b364207255973e2ff34666674f
|
7
|
+
data.tar.gz: 64d1ff7f95c0468fca2f6e1e4989f730f58698712913ebb99cca2919e4c69ac9b94cc7cbc71ef106652b98ad8a538ede095378186ec4708120912ee5ef3c7e70
|
data/CHANGELOG.md
CHANGED
@@ -34,9 +34,13 @@ module BookingSync::API
|
|
34
34
|
#
|
35
35
|
# @param booking [BookingSync::API::Resource|Integer] Booking or ID
|
36
36
|
# of the booking.
|
37
|
+
# @param options [Hash] A customizable set of query options.
|
38
|
+
# @option options [Array] fields: List of fields to be fetched.
|
39
|
+
# @option options [Boolean] include_canceled: If true canceled bookings
|
40
|
+
# are shown, otherwise they are hidden.
|
37
41
|
# @return [BookingSync::API::Resource]
|
38
|
-
def booking(booking)
|
39
|
-
get("bookings/#{booking}").pop
|
42
|
+
def booking(booking, options = {})
|
43
|
+
get("bookings/#{booking}", options).pop
|
40
44
|
end
|
41
45
|
|
42
46
|
# Create a booking
|
@@ -42,6 +42,11 @@ describe BookingSync::API::Client::Bookings do
|
|
42
42
|
booking = client.booking(20)
|
43
43
|
expect(booking.status).to eq "Booked"
|
44
44
|
end
|
45
|
+
|
46
|
+
it "returns a single canceled booking" do
|
47
|
+
booking = client.booking(114760, { include_canceled: true })
|
48
|
+
expect(booking.status).to eq "Canceled"
|
49
|
+
end
|
45
50
|
end
|
46
51
|
|
47
52
|
describe ".create_booking", :vcr do
|
@@ -0,0 +1,82 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://www.bookingsync.com/api/v3/bookings/114760?include_canceled=true
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- BookingSync API gem v0.0.26
|
12
|
+
Accept:
|
13
|
+
- application/vnd.api+json
|
14
|
+
Content-Type:
|
15
|
+
- application/vnd.api+json
|
16
|
+
Authorization:
|
17
|
+
- Bearer <<ACCESS_TOKEN>>
|
18
|
+
Accept-Encoding:
|
19
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Server:
|
26
|
+
- nginx
|
27
|
+
Date:
|
28
|
+
- Sun, 26 Jul 2015 14:41:39 GMT
|
29
|
+
Content-Type:
|
30
|
+
- application/vnd.api+json; charset=utf-8
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Connection:
|
34
|
+
- keep-alive
|
35
|
+
Status:
|
36
|
+
- 200 OK
|
37
|
+
Strict-Transport-Security:
|
38
|
+
- max-age=31536000
|
39
|
+
X-Frame-Options:
|
40
|
+
- SAMEORIGIN
|
41
|
+
X-Xss-Protection:
|
42
|
+
- 1; mode=block
|
43
|
+
X-Content-Type-Options:
|
44
|
+
- nosniff
|
45
|
+
X-Ratelimit-Limit:
|
46
|
+
- '5000'
|
47
|
+
X-Ratelimit-Reset:
|
48
|
+
- '1437922800'
|
49
|
+
X-Ratelimit-Remaining:
|
50
|
+
- '4991'
|
51
|
+
Link:
|
52
|
+
- <https://www.bookingsync.com/api/v3/bookings/114760?include_canceled=true&page=1>;
|
53
|
+
rel="first", <https://www.bookingsync.com/api/v3/bookings/114760?include_canceled=true&page=1>;
|
54
|
+
rel="last"
|
55
|
+
X-Total-Pages:
|
56
|
+
- '1'
|
57
|
+
X-Total-Count:
|
58
|
+
- '1'
|
59
|
+
Etag:
|
60
|
+
- '"6580e5cc4becab5179a97144480cd2a8"'
|
61
|
+
Cache-Control:
|
62
|
+
- max-age=0, private, must-revalidate
|
63
|
+
P3p:
|
64
|
+
- CP="OTI DSP COR CUR ADMo DEVo TAI PSAi PSDi IVAi IVDi CONi HISi TELi OTPi
|
65
|
+
OUR SAMi OTRo UNRo PUBi IND UNI STA"
|
66
|
+
Set-Cookie:
|
67
|
+
- ahoy_track=true; path=/; secure
|
68
|
+
- ahoy_visit=4d25535b-4282-48d5-8d0e-e4e0c89ae456; path=/; expires=Sun, 02 Aug
|
69
|
+
2015 14:41:39 -0000; secure
|
70
|
+
- ahoy_visitor=61b23df6-ce60-4fd6-9483-93d2b1b7de52; path=/; expires=Wed, 26
|
71
|
+
Jul 2017 14:41:39 -0000; secure
|
72
|
+
X-Request-Id:
|
73
|
+
- ad1ae3ef-a18e-4c15-a7d0-9f2b322b1e5f
|
74
|
+
X-Runtime:
|
75
|
+
- '0.107455'
|
76
|
+
body:
|
77
|
+
encoding: UTF-8
|
78
|
+
string: '{"links":{"bookings.account":"https://www.bookingsync.com/api/v3/accounts/{bookings.account}","bookings.rental":"https://www.bookingsync.com/api/v3/rentals/{bookings.rental}","bookings.client":"https://www.bookingsync.com/api/v3/clients/{bookings.client}","bookings.rental_agreement":"https://www.bookingsync.com/api/v3/rental_agreements/{bookings.rental_agreement}","bookings.source":"https://www.bookingsync.com/api/v3/sources/{bookings.source}","bookings.bookings_fees":"https://www.bookingsync.com/api/v3/bookings_fees/{bookings.bookings_fees}","bookings.bookings_taxes":"https://www.bookingsync.com/api/v3/bookings_taxes/{bookings.bookings_taxes}"},"bookings":[{"links":{"account":4516,"rental":7314,"client":61311,"rental_agreement":null,"source":null,"bookings_fees":[],"bookings_taxes":[]},"id":114760,"start_at":"2015-07-19T16:00:00Z","end_at":"2015-07-31T10:00:00Z","status":"Canceled","updated_at":"2015-06-12T12:58:00Z","booked":false,"unavailable":false,"tentative_expires_at":null,"initial_price":"5000.0","initial_rental_price":"5000.0","discount":null,"final_rental_price":"5000.0","final_price":"5000.0","downpayment":null,"paid_amount":"0.0","currency":"EUR","notes":"Birthday
|
79
|
+
celebration","adults":1,"children":null,"bookings_payments_count":0,"review_requests_count":0,"locked":null,"created_at":"2015-03-08T00:31:56Z","canceled_at":"2015-03-12T00:31:56Z","expected_checkin_time":null,"expected_checkout_time":null,"owned_by_app":false}],"meta":{}}'
|
80
|
+
http_version:
|
81
|
+
recorded_at: Sun, 26 Jul 2015 14:41:40 GMT
|
82
|
+
recorded_with: VCR 2.9.3
|
@@ -6,10 +6,10 @@ http_interactions:
|
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
8
|
string: '{"bookings":[{"rental_id":"1","start_at":"2015-08-01 16:00:00","end_at":"2015-08-11
|
9
|
-
10:00:00","adults":"3","children":"2","final_price":"806.82","currency":"EUR","bookings_fees_attributes":{"0":{"rentals_fee_id":"1","times_booked":"1"},"1":{"rentals_fee_id":"3","times_booked":"1"}},"contact_information_attributes":{"firstname":"Lazar","email":"email@example.com","lastname":"Angelov","phone_number":"123-123-123"}}]}'
|
9
|
+
10:00:00","adults":"3","children":"2","final_price":"806.82","currency":"EUR","bookings_fees_attributes":{"0":{"rentals_fee_id":"1","times_booked":"1"},"1":{"rentals_fee_id":"3","times_booked":"1"}},"contact_information_attributes":{"firstname":"Lazar","email":"email@example.com","lastname":"Angelov","phone_number":"123-123-123","country_code":"US"}}]}'
|
10
10
|
headers:
|
11
11
|
User-Agent:
|
12
|
-
- BookingSync API gem v0.0.
|
12
|
+
- BookingSync API gem v0.0.26
|
13
13
|
Accept:
|
14
14
|
- application/vnd.api+json
|
15
15
|
Content-Type:
|
@@ -32,15 +32,15 @@ http_interactions:
|
|
32
32
|
X-Ratelimit-Limit:
|
33
33
|
- '1000'
|
34
34
|
X-Ratelimit-Reset:
|
35
|
-
- '
|
35
|
+
- '1437051600'
|
36
36
|
X-Ratelimit-Remaining:
|
37
37
|
- '999'
|
38
38
|
Location:
|
39
|
-
- https://www.bookingsync.com/api/v3/bookings/
|
39
|
+
- https://www.bookingsync.com/api/v3/bookings/443
|
40
40
|
Content-Type:
|
41
41
|
- application/vnd.api+json; charset=utf-8
|
42
42
|
Etag:
|
43
|
-
- '"
|
43
|
+
- '"9b3c2cac44aca7897875673b4351573c"'
|
44
44
|
Cache-Control:
|
45
45
|
- max-age=0, private, must-revalidate
|
46
46
|
P3p:
|
@@ -48,21 +48,21 @@ http_interactions:
|
|
48
48
|
OUR SAMi OTRo UNRo PUBi IND UNI STA"
|
49
49
|
Set-Cookie:
|
50
50
|
- ahoy_track=true; path=/
|
51
|
-
- ahoy_visit=
|
52
|
-
2015 12:
|
53
|
-
- ahoy_visitor=
|
54
|
-
Jul 2017 12:
|
51
|
+
- ahoy_visit=cc9e3a70-7937-46c9-8a14-3b4d31fb1f66; path=/; expires=Thu, 23 Jul
|
52
|
+
2015 12:22:28 -0000
|
53
|
+
- ahoy_visitor=b8f91275-2917-4228-bc43-f0eee8d812bf; path=/; expires=Sun, 16
|
54
|
+
Jul 2017 12:22:28 -0000
|
55
55
|
X-Request-Id:
|
56
|
-
-
|
56
|
+
- 41c24ae5-3424-46be-8249-4bb6e2fbc10f
|
57
57
|
X-Runtime:
|
58
|
-
- '
|
58
|
+
- '0.779185'
|
59
59
|
Date:
|
60
|
-
-
|
60
|
+
- Thu, 16 Jul 2015 12:22:28 GMT
|
61
61
|
Connection:
|
62
62
|
- close
|
63
63
|
body:
|
64
64
|
encoding: UTF-8
|
65
|
-
string: '{"links":{"bookings.account":"https://www.bookingsync.com/api/v3/accounts/{bookings.account}","bookings.rental":"https://www.bookingsync.com/api/v3/rentals/{bookings.rental}","bookings.client":"https://www.bookingsync.com/api/v3/clients/{bookings.client}","bookings.rental_agreement":"https://www.bookingsync.com/api/v3/rental_agreements/{bookings.rental_agreement}","bookings.source":"https://www.bookingsync.com/api/v3/sources/{bookings.source}","bookings.bookings_fees":"https://www.bookingsync.com/api/v3/bookings_fees/{bookings.bookings_fees}","bookings.bookings_taxes":"https://www.bookingsync.com/api/v3/bookings_taxes/{bookings.bookings_taxes}"},"bookings":[{"links":{"account":1,"rental":1,"client":85,"rental_agreement":
|
66
|
-
http_version:
|
67
|
-
recorded_at:
|
65
|
+
string: '{"links":{"bookings.account":"https://www.bookingsync.com/api/v3/accounts/{bookings.account}","bookings.rental":"https://www.bookingsync.com/api/v3/rentals/{bookings.rental}","bookings.client":"https://www.bookingsync.com/api/v3/clients/{bookings.client}","bookings.rental_agreement":"https://www.bookingsync.com/api/v3/rental_agreements/{bookings.rental_agreement}","bookings.source":"https://www.bookingsync.com/api/v3/sources/{bookings.source}","bookings.bookings_fees":"https://www.bookingsync.com/api/v3/bookings_fees/{bookings.bookings_fees}","bookings.bookings_taxes":"https://www.bookingsync.com/api/v3/bookings_taxes/{bookings.bookings_taxes}"},"bookings":[{"links":{"account":1,"rental":1,"client":85,"rental_agreement":3,"source":null,"bookings_fees":[221,222],"bookings_taxes":[498,499,500]},"id":443,"start_at":"2015-08-01T16:00:00Z","end_at":"2015-08-11T10:00:00Z","status":"Booked","updated_at":"2015-07-16T12:22:28Z","booked":true,"unavailable":false,"tentative_expires_at":null,"initial_price":"217.17","initial_rental_price":"217.17","discount":null,"final_rental_price":"217.17","final_price":"806.82","downpayment":null,"paid_amount":"0.0","currency":"EUR","notes":null,"adults":3,"children":2,"bookings_payments_count":0,"review_requests_count":0,"locked":null,"created_at":"2015-07-16T12:22:28Z","canceled_at":null,"expected_checkin_time":null,"expected_checkout_time":null,"owned_by_app":false}]}'
|
66
|
+
http_version:
|
67
|
+
recorded_at: Thu, 16 Jul 2015 12:22:28 GMT
|
68
68
|
recorded_with: VCR 2.9.3
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bookingsync-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sébastien Grosjean
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -162,6 +162,7 @@ files:
|
|
162
162
|
- spec/fixtures/cassettes/BookingSync_API_Client_Availabilities/_availability/returns_a_single_availability.yml
|
163
163
|
- spec/fixtures/cassettes/BookingSync_API_Client_BillingAddresses/_billing_addresses/returns_billing_addresses.yml
|
164
164
|
- spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_booking/returns_a_single_booking.yml
|
165
|
+
- spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_booking/returns_a_single_canceled_booking.yml
|
165
166
|
- spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_bookings/pagination/with_a_block/yields_block_with_batch_of_bookings.yml
|
166
167
|
- spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_bookings/pagination/with_auto_paginate_true/returns_all_bookings_joined_from_many_requests.yml
|
167
168
|
- spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_bookings/pagination/with_per_page_setting/returns_limited_number_of_bookings.yml
|
@@ -308,6 +309,7 @@ test_files:
|
|
308
309
|
- spec/fixtures/cassettes/BookingSync_API_Client_Availabilities/_availability/returns_a_single_availability.yml
|
309
310
|
- spec/fixtures/cassettes/BookingSync_API_Client_BillingAddresses/_billing_addresses/returns_billing_addresses.yml
|
310
311
|
- spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_booking/returns_a_single_booking.yml
|
312
|
+
- spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_booking/returns_a_single_canceled_booking.yml
|
311
313
|
- spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_bookings/pagination/with_a_block/yields_block_with_batch_of_bookings.yml
|
312
314
|
- spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_bookings/pagination/with_auto_paginate_true/returns_all_bookings_joined_from_many_requests.yml
|
313
315
|
- spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_bookings/pagination/with_per_page_setting/returns_limited_number_of_bookings.yml
|