bookingsync-api 0.0.26 → 0.0.27

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: 51ffff302f82b77e6dd01697caa6e5ffef3ef0da
4
- data.tar.gz: 6a66bfd98999e66de3d8092bfcbb410d5050e31f
3
+ metadata.gz: 04fcf20b67d1ca0e1804d2a756c690a08cb1c35e
4
+ data.tar.gz: e2c7c2152a9fde5cc67eedb3e5725b7ed9dc0173
5
5
  SHA512:
6
- metadata.gz: d4ff59a86c1755ca5854a8d0762d8ba934cf451dc67ab327f631dc2df24dbe812f8ddb44f6d5de1d0dc88c570c1a3cb093c492627792d53b8352d936bba9a43a
7
- data.tar.gz: 72423d9d9d50e32df0bc4fe7f72f29b7e95e1b4f6f7f4f9b3a5eef1c78fc9fae9b7f9f3108f448de04431070beb1428e62a640e8f0a24c32637bfb07a4c65ff1
6
+ metadata.gz: 0249edc20b8655667eb4d86c41474caa543dae288923f89ff177d48abd0dc912f93af068294f7168508e309dd557a89fceae92b364207255973e2ff34666674f
7
+ data.tar.gz: 64d1ff7f95c0468fca2f6e1e4989f730f58698712913ebb99cca2919e4c69ac9b94cc7cbc71ef106652b98ad8a538ede095378186ec4708120912ee5ef3c7e70
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.0.27
6
+
7
+ - Add support for fetching a single booking with options (needed to fetch canceled bookings)
8
+
5
9
  ## 0.0.26
6
10
 
7
11
  - Add support for creating instant bookings
@@ -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
@@ -1,5 +1,5 @@
1
1
  module BookingSync
2
2
  module API
3
- VERSION = "0.0.26"
3
+ VERSION = "0.0.27"
4
4
  end
5
5
  end
@@ -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
@@ -21,7 +21,8 @@ describe BookingSync::API::Client::InstantBookings do
21
21
  "firstname" => "Lazar",
22
22
  "email" => "email@example.com",
23
23
  "lastname" => "Angelov",
24
- "phone_number" => "123-123-123"
24
+ "phone_number" => "123-123-123",
25
+ "country_code" => "US"
25
26
  }
26
27
  }
27
28
  end
@@ -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.25
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
- - '1435928400'
35
+ - '1437051600'
36
36
  X-Ratelimit-Remaining:
37
37
  - '999'
38
38
  Location:
39
- - https://www.bookingsync.com/api/v3/bookings/435
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
- - '"e0525b23086189fc0bf31000ad430cbc"'
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=98402521-c15f-4128-95da-c2c47241de35; path=/; expires=Fri, 10 Jul
52
- 2015 12:39:56 -0000
53
- - ahoy_visitor=c7fa60d1-c2cb-47da-b95a-b2bc3e82a001; path=/; expires=Mon, 03
54
- Jul 2017 12:39:56 -0000
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
- - fc1d7a8b-2332-4f37-9b5b-7563d9f66b76
56
+ - 41c24ae5-3424-46be-8249-4bb6e2fbc10f
57
57
  X-Runtime:
58
- - '1.043527'
58
+ - '0.779185'
59
59
  Date:
60
- - Fri, 03 Jul 2015 12:39:57 GMT
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":null,"source":null,"bookings_fees":[207,208],"bookings_taxes":[474,475,476]},"id":435,"start_at":"2015-08-01T16:00:00Z","end_at":"2015-08-11T10:00:00Z","status":"Booked","updated_at":"2015-07-03T12:39:56Z","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-03T12:39:56Z","canceled_at":null}]}'
66
- http_version:
67
- recorded_at: Fri, 03 Jul 2015 12:39:57 GMT
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.26
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-13 00:00:00.000000000 Z
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