From b40a9f3990876ce503ac1af8c8740b66abd8664b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Fern=C3=A1ndez?= Date: Wed, 9 Oct 2019 11:12:46 +0200 Subject: [PATCH 1/3] add support for rental_contacts endpoint --- CHANGELOG.md | 3 + lib/bookingsync/api/client.rb | 2 + lib/bookingsync/api/client/rental_contacts.rb | 65 +++++++ lib/bookingsync/api/version.rb | 2 +- .../api/client/rental_contacts_spec.rb | 78 ++++++++ .../creates_a_new_rental_contacts.yml | 71 ++++++++ .../deletes_given_rental_contacts.yml | 63 +++++++ .../updates_given_rental_contacts_by_ID.yml | 69 +++++++ .../links/returns_associated_contacts.yml | 80 +++++++++ .../links/returns_associated_rental.yml | 168 ++++++++++++++++++ .../returns_rental_contacts.yml | 80 +++++++++ 11 files changed, 680 insertions(+), 1 deletion(-) create mode 100644 lib/bookingsync/api/client/rental_contacts.rb create mode 100644 spec/bookingsync/api/client/rental_contacts_spec.rb create mode 100644 spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_create_rental_contact/creates_a_new_rental_contacts.yml create mode 100644 spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_delete_rental_contact/deletes_given_rental_contacts.yml create mode 100644 spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_edit_rental_contact/updates_given_rental_contacts_by_ID.yml create mode 100644 spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_rental_contacts/links/returns_associated_contacts.yml create mode 100644 spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_rental_contacts/links/returns_associated_rental.yml create mode 100644 spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_rental_contacts/returns_rental_contacts.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index e0829df..f8c21e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ # master +## 0.1.14 - 2019-10-09 +- Add supports for `rental_contacts` endpoint. + ## 0.1.13 - 2019-10-08 - Add supports for `contacts` endpoint. diff --git a/lib/bookingsync/api/client.rb b/lib/bookingsync/api/client.rb index 4d85f01..c940e51 100644 --- a/lib/bookingsync/api/client.rb +++ b/lib/bookingsync/api/client.rb @@ -37,6 +37,7 @@ require "bookingsync/api/client/rental_agreements" require "bookingsync/api/client/rental_cancelation_policies" require "bookingsync/api/client/rental_cancelation_policy_items" +require "bookingsync/api/client/rental_contacts" require "bookingsync/api/client/rentals_contents_overrides" require "bookingsync/api/client/reviews" require "bookingsync/api/client/seasons" @@ -92,6 +93,7 @@ class Client include BookingSync::API::Client::Rates include BookingSync::API::Client::RatesRules include BookingSync::API::Client::RatesTables + include BookingSync::API::Client::RentalContacts include BookingSync::API::Client::Rentals include BookingSync::API::Client::RentalsFees include BookingSync::API::Client::RentalsAmenities diff --git a/lib/bookingsync/api/client/rental_contacts.rb b/lib/bookingsync/api/client/rental_contacts.rb new file mode 100644 index 0000000..134ccf4 --- /dev/null +++ b/lib/bookingsync/api/client/rental_contacts.rb @@ -0,0 +1,65 @@ +module BookingSync::API + class Client + module RentalContacts + # List rental_contacts + # + # Returns all contacts related to rentals for the current account. + # @param options [Hash] A customizable set of options. + # @option options [Array] fields: List of fields to be fetched. + # @return [Array] Array of rental_contacts. + # + # @example Get the list of contacts for the current account + # rental_contacts = @api.rental_contacts + # rental_contacts.first.contact.title # => "Internet" + # @see http://developers.bookingsync.com/reference/endpoints/rental_contacts/#list-rentals-contacts + def rental_contacts(options = {}, &block) + paginate :rental_contacts, options, &block + end + + # Get a single rental_contact + # + # @param rental_contact [BookingSync::API::Resource|Integer] + # rental_contact or ID of the rental_contact. + # @return [BookingSync::API::Resource] + def rental_contact(rental_contact) + get("rental_contacts/#{rental_contact}").pop + end + + # Create a rental's contact + # + # @param rental [BookingSync::API::Resource|Integer] Rental object or ID + # for which the rental contact will be created. + # @param options [Hash] Rental Amenity' s attributes. + # @return [BookingSync::API::Resource] Newly created rental's contact. + # @example Create a rental's contact. + # @api.create_rental_contact(10, { contact_id: 50 }) # Add the Internet contact to the rental with ID 10 + # @see http://developers.bookingsync.com/reference/endpoints/rental_contacts/#create-a-new-rentals-contact + def create_rental_contact(rental, options = {}) + post("rentals/#{rental}/rental_contacts", rental_contacts: [options]).pop + end + + # Edit a rental_contact + # + # @param rental_contact [BookingSync::API::Resource|Integer] RentalsAmenity or ID of + # the rental_contact to be updated. + # @param options [Hash] rental_contact attributes to be updated. + # @return [BookingSync::API::Resource] Updated rental_contact on success, + # exception is raised otherwise. + # @example + # rental_contact = @api.rental_contacts.first + # @api.edit_rental_contact(rental_contact, { details_en: "Details" }) + def edit_rental_contact(rental_contact, options = {}) + put("rental_contacts/#{rental_contact}", rental_contacts: [options]).pop + end + + # Delete a rental_contact + # + # @param rental_contact [BookingSync::API::Resource|Integer] RentalsAmenity or ID + # of the rental_contact to be deleted. + # @return [NilClass] Returns nil on success. + def delete_rental_contact(rental_contact) + delete "rental_contacts/#{rental_contact}" + end + end + end +end diff --git a/lib/bookingsync/api/version.rb b/lib/bookingsync/api/version.rb index b5c0602..5e88b2b 100644 --- a/lib/bookingsync/api/version.rb +++ b/lib/bookingsync/api/version.rb @@ -1,5 +1,5 @@ module BookingSync module API - VERSION = "0.1.13" + VERSION = "0.1.14" end end diff --git a/spec/bookingsync/api/client/rental_contacts_spec.rb b/spec/bookingsync/api/client/rental_contacts_spec.rb new file mode 100644 index 0000000..d0739d9 --- /dev/null +++ b/spec/bookingsync/api/client/rental_contacts_spec.rb @@ -0,0 +1,78 @@ +require "spec_helper" + +describe BookingSync::API::Client::RentalContacts do + let(:client) { BookingSync::API::Client.new(test_access_token) } + + before { |ex| @casette_base_path = casette_path(casette_dir, ex.metadata) } + + describe ".rental_contacts", :vcr do + it "returns rental contacts" do + expect(client.rental_contacts).not_to be_empty + assert_requested :get, bs_url("rental_contacts") + end + + describe "links" do + it "returns associated rental" do + rental_contacts = client.rental_contacts.first + expect(rental_contacts.rental).not_to be_empty + end + + it "returns associated contacts" do + rental_contacts = client.rental_contacts.first + expect(rental_contacts.dig(:links, :contact)).to eq 1 + expect(rental_contacts.dig(:links, :rental)).to eq 1 + end + end + end + + describe ".create_rental_contact", :vcr do + let(:attributes) { { contact_id: 1, kind: "owner", roles: ["invoices"] } } + let(:rental) { BookingSync::API::Resource.new(client, id: 1) } + + it "creates a new rental_contacts" do + client.create_rental_contact(rental, attributes) + assert_requested :post, bs_url("rentals/#{rental}/rental_contacts"), + body: { rental_contacts: [attributes] }.to_json + end + + it "returns newly created rental_contacts" do + VCR.use_cassette("BookingSync_API_Client_RentalContacts/_create_rental_contact/creates_a_new_rental_contacts") do + rental_contacts = client.create_rental_contact(rental, attributes) + expect(rental_contacts.dig(:links, :contact)).to eq(1) + expect(rental_contacts.dig(:links, :rental)).to eq(1) + end + end + end + + describe ".edit_rental_contact", :vcr do + let(:attributes) { { kind: "manager" } } + let(:created_rental_contacts_id) { + find_resource("#{@casette_base_path}_create_rental_contact/creates_a_new_rental_contacts.yml", "rental_contacts")[:id] + } + + it "updates given rental_contacts by ID" do + client.edit_rental_contact(created_rental_contacts_id, attributes) + assert_requested :put, bs_url("rental_contacts/#{created_rental_contacts_id}"), + body: { rental_contacts: [attributes] }.to_json + end + + it "returns updated rental_contacts" do + VCR.use_cassette("BookingSync_API_Client_RentalContacts/_edit_rental_contact/updates_given_rental_contacts_by_ID") do + rental_contacts = client.edit_rental_contact(created_rental_contacts_id, attributes) + expect(rental_contacts).to be_kind_of(BookingSync::API::Resource) + expect(rental_contacts.fetch(:kind)).to eq("manager") + end + end + end + + describe ".delete_rental_contact", :vcr do + let(:created_rental_contacts_id) { + find_resource("#{@casette_base_path}_create_rental_contact/creates_a_new_rental_contacts.yml", "rental_contacts")[:id] + } + + it "deletes given rental_contacts" do + client.delete_rental_contact(created_rental_contacts_id) + assert_requested :delete, bs_url("rental_contacts/#{created_rental_contacts_id}") + end + end +end diff --git a/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_create_rental_contact/creates_a_new_rental_contacts.yml b/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_create_rental_contact/creates_a_new_rental_contacts.yml new file mode 100644 index 0000000..4fe5540 --- /dev/null +++ b/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_create_rental_contact/creates_a_new_rental_contacts.yml @@ -0,0 +1,71 @@ +--- +http_interactions: +- request: + method: post + uri: https://www.bookingsync.com/api/v3/rentals/1/rental_contacts + body: + encoding: UTF-8 + string: '{"rental_contacts":[{"contact_id":1,"kind":"owner","roles":["invoices"]}]}' + headers: + User-Agent: + - BookingSync API gem v0.1.13 + Accept: + - application/vnd.api+json + Content-Type: + - application/vnd.api+json + Authorization: + - Bearer <> + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Connection: + - keep-alive + Keep-Alive: + - '30' + response: + status: + code: 201 + message: Created + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Content-Type: + - application/vnd.api+json; charset=utf-8 + Etag: + - W/"cf44606bb98753397b9d1fddd806eee3" + Location: + - https://www.bookingsync.com/api/v3/rental_contacts/5 + Set-Cookie: + - ahoy_visit=7c4d208f-8772-42a7-8e27-d77ef19bef9b; path=/; expires=Wed, 16 Oct + 2019 08:57:49 -0000 + - ahoy_visitor=a8c486c8-82cf-4570-8f8c-92eac543f850; path=/; expires=Sat, 09 + Oct 2021 08:57:49 -0000 + Vary: + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - '1000' + X-Ratelimit-Remaining: + - '959' + X-Ratelimit-Reset: + - '1570611600' + X-Request-Id: + - 6fb54d02-c166-48cd-8eed-503342e6acb6 + X-Runtime: + - '0.109476' + X-Updated-Since-Request-Synced-At: + - 2019-10-09 08:57:49 UTC + X-Xss-Protection: + - 1; mode=block + Date: + - Wed, 09 Oct 2019 08:57:49 GMT + Content-Length: + - '395' + body: + encoding: UTF-8 + string: '{"links":{"rental_contacts.rental":"https://www.bookingsync.com/api/v3/rentals/{rental_contacts.rental}","rental_contacts.contact":"https://www.bookingsync.com/api/v3/contacts/{rental_contacts.contact}"},"rental_contacts":[{"links":{"contact":1,"rental":1},"id":5,"kind":"owner","roles":["invoices"],"created_at":"2019-10-09T08:57:49Z","updated_at":"2019-10-09T08:57:49Z","canceled_at":null}],"meta":{}}' + http_version: + recorded_at: Wed, 09 Oct 2019 08:57:49 GMT +recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_delete_rental_contact/deletes_given_rental_contacts.yml b/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_delete_rental_contact/deletes_given_rental_contacts.yml new file mode 100644 index 0000000..a4c9703 --- /dev/null +++ b/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_delete_rental_contact/deletes_given_rental_contacts.yml @@ -0,0 +1,63 @@ +--- +http_interactions: +- request: + method: delete + uri: https://www.bookingsync.com/api/v3/rental_contacts/5 + body: + encoding: UTF-8 + string: "{}" + headers: + User-Agent: + - BookingSync API gem v0.1.13 + Accept: + - application/vnd.api+json + Content-Type: + - application/vnd.api+json + Authorization: + - Bearer <> + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Connection: + - keep-alive + Keep-Alive: + - '30' + response: + status: + code: 204 + message: No Content + headers: + Cache-Control: + - no-cache + Set-Cookie: + - ahoy_visit=f22c7278-53dd-4027-b9d7-eae8d9818b4d; path=/; expires=Wed, 16 Oct + 2019 09:00:31 -0000 + - ahoy_visitor=c3334e93-4e7c-475b-8400-d9d241514d99; path=/; expires=Sat, 09 + Oct 2021 09:00:31 -0000 + Vary: + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - '1000' + X-Ratelimit-Remaining: + - '994' + X-Ratelimit-Reset: + - '1570615200' + X-Request-Id: + - c2b65da6-8882-483a-8e4f-1dbc32b91e8e + X-Runtime: + - '0.093718' + X-Updated-Since-Request-Synced-At: + - 2019-10-09 09:00:31 UTC + X-Xss-Protection: + - 1; mode=block + Date: + - Wed, 09 Oct 2019 09:00:31 GMT + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Wed, 09 Oct 2019 09:00:31 GMT +recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_edit_rental_contact/updates_given_rental_contacts_by_ID.yml b/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_edit_rental_contact/updates_given_rental_contacts_by_ID.yml new file mode 100644 index 0000000..ecc981e --- /dev/null +++ b/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_edit_rental_contact/updates_given_rental_contacts_by_ID.yml @@ -0,0 +1,69 @@ +--- +http_interactions: +- request: + method: put + uri: https://www.bookingsync.com/api/v3/rental_contacts/5 + body: + encoding: UTF-8 + string: '{"rental_contacts":[{"kind":"manager"}]}' + headers: + User-Agent: + - BookingSync API gem v0.1.13 + Accept: + - application/vnd.api+json + Content-Type: + - application/vnd.api+json + Authorization: + - Bearer <> + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Connection: + - keep-alive + Keep-Alive: + - '30' + response: + status: + code: 200 + message: OK + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Content-Type: + - application/vnd.api+json; charset=utf-8 + Etag: + - W/"5deed18550ce6bf175abdc45a8fda760" + Set-Cookie: + - ahoy_visit=f1068a64-a73b-4e7b-81d4-76764fa797ec; path=/; expires=Wed, 16 Oct + 2019 09:00:31 -0000 + - ahoy_visitor=e329fdc9-5e5e-4bf5-a1b6-2fc82c4fe415; path=/; expires=Sat, 09 + Oct 2021 09:00:31 -0000 + Vary: + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - '1000' + X-Ratelimit-Remaining: + - '995' + X-Ratelimit-Reset: + - '1570615200' + X-Request-Id: + - 9682e1b4-e503-4a52-a950-498a3937559b + X-Runtime: + - '0.096848' + X-Updated-Since-Request-Synced-At: + - 2019-10-09 09:00:31 UTC + X-Xss-Protection: + - 1; mode=block + Date: + - Wed, 09 Oct 2019 09:00:31 GMT + Content-Length: + - '397' + body: + encoding: UTF-8 + string: '{"links":{"rental_contacts.rental":"https://www.bookingsync.com/api/v3/rentals/{rental_contacts.rental}","rental_contacts.contact":"https://www.bookingsync.com/api/v3/contacts/{rental_contacts.contact}"},"rental_contacts":[{"links":{"contact":1,"rental":1},"id":5,"kind":"manager","roles":["invoices"],"created_at":"2019-10-09T08:57:49Z","updated_at":"2019-10-09T09:00:31Z","canceled_at":null}],"meta":{}}' + http_version: + recorded_at: Wed, 09 Oct 2019 09:00:31 GMT +recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_rental_contacts/links/returns_associated_contacts.yml b/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_rental_contacts/links/returns_associated_contacts.yml new file mode 100644 index 0000000..85149e7 --- /dev/null +++ b/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_rental_contacts/links/returns_associated_contacts.yml @@ -0,0 +1,80 @@ +--- +http_interactions: +- request: + method: get + uri: https://www.bookingsync.com/api/v3/rental_contacts + body: + encoding: UTF-8 + string: "{}" + headers: + User-Agent: + - BookingSync API gem v0.1.13 + Accept: + - application/vnd.api+json + Content-Type: + - application/vnd.api+json + Authorization: + - Bearer <> + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Connection: + - keep-alive + Keep-Alive: + - '30' + response: + status: + code: 200 + message: OK + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Content-Type: + - application/vnd.api+json; charset=utf-8 + Etag: + - W/"f5e610ce3e35bedebe163e87165f380c" + Link: + - ; rel="first", ; + rel="last" + Set-Cookie: + - ahoy_visit=3b268702-e81e-46b1-9823-0f4f1c0d742a; path=/; expires=Wed, 16 Oct + 2019 09:00:12 -0000 + - ahoy_visitor=20e62ed0-9cca-4cef-9496-8a5b55de78d0; path=/; expires=Sat, 09 + Oct 2021 09:00:12 -0000 + Vary: + - Origin + X-Content-Type-Options: + - nosniff + X-Current-Page: + - '1' + X-Frame-Options: + - SAMEORIGIN + X-Per-Page: + - '100' + X-Ratelimit-Limit: + - '1000' + X-Ratelimit-Remaining: + - '996' + X-Ratelimit-Reset: + - '1570615200' + X-Request-Id: + - 8efa03d1-5c10-4613-b372-c498de92e8f9 + X-Runtime: + - '0.119198' + X-Total-Count: + - '1' + X-Total-Pages: + - '1' + X-Updated-Since-Request-Synced-At: + - 2019-10-09 09:00:12 UTC + X-Xss-Protection: + - 1; mode=block + Date: + - Wed, 09 Oct 2019 09:00:12 GMT + Content-Length: + - '589' + body: + encoding: UTF-8 + string: '{"links":{"rental_contacts.rental":"https://www.bookingsync.com/api/v3/rentals/{rental_contacts.rental}","rental_contacts.contact":"https://www.bookingsync.com/api/v3/contacts/{rental_contacts.contact}"},"rental_contacts":[{"links":{"contact":1,"rental":1},"id":5,"kind":"owner","roles":["invoices"],"created_at":"2019-10-09T08:57:49Z","updated_at":"2019-10-09T08:57:49Z","canceled_at":null}],"meta":{"Link":{"first":"https://www.bookingsync.com/api/v3/rental_contacts?page=1","last":"https://www.bookingsync.com/api/v3/rental_contacts?page=1"},"X-Total-Pages":"1","X-Total-Count":"1","X-Per-Page":"100"}}' + http_version: + recorded_at: Wed, 09 Oct 2019 09:00:12 GMT +recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_rental_contacts/links/returns_associated_rental.yml b/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_rental_contacts/links/returns_associated_rental.yml new file mode 100644 index 0000000..2fb4985 --- /dev/null +++ b/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_rental_contacts/links/returns_associated_rental.yml @@ -0,0 +1,168 @@ +--- +http_interactions: +- request: + method: get + uri: https://www.bookingsync.com/api/v3/rental_contacts + body: + encoding: UTF-8 + string: "{}" + headers: + User-Agent: + - BookingSync API gem v0.1.13 + Accept: + - application/vnd.api+json + Content-Type: + - application/vnd.api+json + Authorization: + - Bearer <> + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Connection: + - keep-alive + Keep-Alive: + - '30' + response: + status: + code: 200 + message: OK + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Content-Type: + - application/vnd.api+json; charset=utf-8 + Etag: + - W/"f5e610ce3e35bedebe163e87165f380c" + Link: + - ; rel="first", ; + rel="last" + Set-Cookie: + - ahoy_visit=91eca194-f614-49e8-bef5-8b92a23f394f; path=/; expires=Wed, 16 Oct + 2019 09:00:12 -0000 + - ahoy_visitor=ed823a0f-fcc9-40a0-9c31-e610c6d37c86; path=/; expires=Sat, 09 + Oct 2021 09:00:12 -0000 + Vary: + - Origin + X-Content-Type-Options: + - nosniff + X-Current-Page: + - '1' + X-Frame-Options: + - SAMEORIGIN + X-Per-Page: + - '100' + X-Ratelimit-Limit: + - '1000' + X-Ratelimit-Remaining: + - '998' + X-Ratelimit-Reset: + - '1570615200' + X-Request-Id: + - 12e96534-f92c-4d60-8677-f619e9123b79 + X-Runtime: + - '0.081977' + X-Total-Count: + - '1' + X-Total-Pages: + - '1' + X-Updated-Since-Request-Synced-At: + - 2019-10-09 09:00:12 UTC + X-Xss-Protection: + - 1; mode=block + Date: + - Wed, 09 Oct 2019 09:00:12 GMT + Content-Length: + - '589' + body: + encoding: UTF-8 + string: '{"links":{"rental_contacts.rental":"https://www.bookingsync.com/api/v3/rentals/{rental_contacts.rental}","rental_contacts.contact":"https://www.bookingsync.com/api/v3/contacts/{rental_contacts.contact}"},"rental_contacts":[{"links":{"contact":1,"rental":1},"id":5,"kind":"owner","roles":["invoices"],"created_at":"2019-10-09T08:57:49Z","updated_at":"2019-10-09T08:57:49Z","canceled_at":null}],"meta":{"Link":{"first":"https://www.bookingsync.com/api/v3/rental_contacts?page=1","last":"https://www.bookingsync.com/api/v3/rental_contacts?page=1"},"X-Total-Pages":"1","X-Total-Count":"1","X-Per-Page":"100"}}' + http_version: + recorded_at: Wed, 09 Oct 2019 09:00:12 GMT +- request: + method: get + uri: https://www.bookingsync.com/api/v3/rentals/1 + body: + encoding: UTF-8 + string: "{}" + headers: + User-Agent: + - BookingSync API gem v0.1.13 + Accept: + - application/vnd.api+json + Content-Type: + - application/vnd.api+json + Authorization: + - Bearer <> + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Connection: + - keep-alive + Keep-Alive: + - '30' + response: + status: + code: 200 + message: OK + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Content-Type: + - application/vnd.api+json; charset=utf-8 + Etag: + - W/"d387e2d19052b224a70189bd61603afc" + Link: + - ; rel="first", ; + rel="last" + Set-Cookie: + - ahoy_visit=f865097f-67a5-404d-8ac6-e4da9a813447; path=/; expires=Wed, 16 Oct + 2019 09:00:12 -0000 + - ahoy_visitor=cc9a9e7f-f707-4459-9824-2d773bc4623d; path=/; expires=Sat, 09 + Oct 2021 09:00:12 -0000 + Vary: + - Origin + X-Content-Type-Options: + - nosniff + X-Current-Page: + - '1' + X-Frame-Options: + - SAMEORIGIN + X-Per-Page: + - '50' + X-Ratelimit-Limit: + - '1000' + X-Ratelimit-Remaining: + - '997' + X-Ratelimit-Reset: + - '1570615200' + X-Request-Id: + - 59930f66-c833-4e06-b860-5d8211afe948 + X-Runtime: + - '0.155897' + X-Total-Count: + - '1' + X-Total-Pages: + - '1' + X-Updated-Since-Request-Synced-At: + - 2019-10-09 09:00:12 UTC + X-Xss-Protection: + - 1; mode=block + Date: + - Wed, 09 Oct 2019 09:00:12 GMT + Transfer-Encoding: + - chunked + body: + encoding: UTF-8 + string: '{"links":{"rentals.account":"https://www.bookingsync.com/api/v3/accounts/{rentals.account}","rentals.availability":"https://www.bookingsync.com/api/v3/availabilities/{rentals.availability}","rentals.change_over":"https://www.bookingsync.com/api/v3/change_overs/{rentals.change_over}","rentals.destination":"https://www.bookingsync.com/api/v3/destinations/{rentals.destination}","rentals.rates_table":"https://www.bookingsync.com/api/v3/rates_tables/{rentals.rates_table}","rentals.rental_agreement":"https://www.bookingsync.com/api/v3/rental_agreements/{rentals.rental_agreement}","rentals.rental_cancelation_policy":"https://www.bookingsync.com/api/v3/rental_cancelation_policies/{rentals.rental_cancelation_policy}","rentals.nightly_rate_map":"https://www.bookingsync.com/api/v3/nightly_rate_maps/{rentals.nightly_rate_map}","rentals.photos":"https://www.bookingsync.com/api/v3/photos/{rentals.photos}","rentals.reviews":"https://www.bookingsync.com/api/v3/reviews/{rentals.reviews}","rentals.special_offers":"https://www.bookingsync.com/api/v3/special_offers/{rentals.special_offers}","rentals.rates":"https://www.bookingsync.com/api/v3/rates/{rentals.rates}","rentals.rentals_amenities":"https://www.bookingsync.com/api/v3/rentals_amenities/{rentals.rentals_amenities}","rentals.rentals_fees":"https://www.bookingsync.com/api/v3/rentals_fees/{rentals.rentals_fees}","rentals.bathrooms":"https://www.bookingsync.com/api/v3/bathrooms/{rentals.bathrooms}","rentals.bedrooms":"https://www.bookingsync.com/api/v3/bedrooms/{rentals.bedrooms}","rentals.living_rooms":"https://www.bookingsync.com/api/v3/living_rooms/{rentals.living_rooms}","rentals.rentals_tags":"https://www.bookingsync.com/api/v3/rentals_tags/{rentals.rentals_tags}","rentals.rental_contacts":"https://www.bookingsync.com/api/v3/rental_contacts/{rentals.rental_contacts}","rentals.videos":"https://www.bookingsync.com/api/v3/videos/{rentals.videos}"},"rentals":[{"links":{"account":1,"availability":1,"bathrooms":[1],"bedrooms":[],"change_over":1,"destination":126,"living_rooms":[],"nightly_rate_map":1,"photos":[1],"rates":[1,2,3],"rates_table":1,"rental_agreement":1,"rental_cancelation_policy":2,"rental_contacts":[5],"rentals_amenities":[1,2],"rentals_fees":[],"rentals_tags":[],"reviews":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39],"special_offers":[1],"videos":[]},"id":1,"name":"Farmhouse + Judo","headline":{"en":"Farmhouse Judo Cycling Track"},"summary":{"en":"Itaque + suscipit deserunt consequatur alias fugit at inventore saepe."},"description":{"en":"Eos + est amet pariatur provident asperiores sunt et. Repellendus quam et tempore + ut commodi earum voluptas culpa. Illo et itaque unde fugit.Dicta ut et ut + aut fugit. Dicta accusantium repellat odit nobis voluptate neque consequuntur + aut. Et voluptatem minima voluptatem autem est consectetur pariatur ea. Porro + facere qui eum praesentium rerum mollitia neque eos.At eligendi aliquam libero + qui. Nemo libero neque veritatis cupiditate tempore. Earum id laborum temporibus + sint pariatur alias sapiente ipsam."},"rental_type":"villa","downpayment":30,"bedrooms_count":0,"sleeps":7,"sleeps_max":null,"bathrooms_count":1,"surface":120,"surface_unit":"metric","bookable_online":false,"bookable_on_request":true,"instantly_bookable":false,"min_price":"96.0","max_price":"800.0","currency":"EUR","price_public_notes":{"en":"Public + notes in english"},"lat":45.02,"lng":6.6,"city":"Nevache","state":null,"country_code":"FR","contact_name":"John + Doe","reviews_count":39,"reviews_average_rating":"4.6","published_at":"2019-02-19T12:47:45Z","created_at":"2019-02-19T12:46:51Z","updated_at":"2019-02-19T12:47:48Z","address1":null,"address2":null,"zip":null,"checkin_time":16,"checkin_end_time":null,"checkout_time":10,"initial_price":null,"final_price":null,"position":1,"base_rate":"800.0","base_rate_kind":"weekly","absolute_min_price":"0.0","notes":null,"stories_count":null,"floor":"","damage_deposit":"35.5","owner_fullname":null,"owner_email":null,"owner_notes":null,"checkin_details":{},"checkout_details":{},"balance_due":30,"website_url":{},"charge_damage_deposit_on_arrival":true,"full_bathrooms_count":0,"standalone_toilets_count":0,"vr_bathrooms_count":1,"nightly_rates_managed_externally":false,"rounding_kind":"no-rounding","original_currency":"EUR","exchange_rate":"1.0","permit_number":null,"absolute_min_stay":7,"space":{},"guests_access":{},"guests_interaction":{},"guests_interaction_kind":null,"public_notes":{},"neighborhood_overview":{},"neighborhood_transit":{},"residency_category":null,"content_requirements_met":false,"certifications":{},"canceled_at":null}],"meta":{"Link":{"first":"https://www.bookingsync.com/api/v3/rentals/1?page=1","last":"https://www.bookingsync.com/api/v3/rentals/1?page=1"},"X-Total-Pages":"1","X-Total-Count":"1","X-Per-Page":"50"}}' + http_version: + recorded_at: Wed, 09 Oct 2019 09:00:12 GMT +recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_rental_contacts/returns_rental_contacts.yml b/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_rental_contacts/returns_rental_contacts.yml new file mode 100644 index 0000000..447af3d --- /dev/null +++ b/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_rental_contacts/returns_rental_contacts.yml @@ -0,0 +1,80 @@ +--- +http_interactions: +- request: + method: get + uri: https://www.bookingsync.com/api/v3/rental_contacts + body: + encoding: UTF-8 + string: "{}" + headers: + User-Agent: + - BookingSync API gem v0.1.13 + Accept: + - application/vnd.api+json + Content-Type: + - application/vnd.api+json + Authorization: + - Bearer <> + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Connection: + - keep-alive + Keep-Alive: + - '30' + response: + status: + code: 200 + message: OK + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Content-Type: + - application/vnd.api+json; charset=utf-8 + Etag: + - W/"f5e610ce3e35bedebe163e87165f380c" + Link: + - ; rel="first", ; + rel="last" + Set-Cookie: + - ahoy_visit=a406701c-d4f1-43fc-83f0-fe68921bb999; path=/; expires=Wed, 16 Oct + 2019 09:00:09 -0000 + - ahoy_visitor=1cff624c-8c20-455e-bc92-d88df003481e; path=/; expires=Sat, 09 + Oct 2021 09:00:09 -0000 + Vary: + - Origin + X-Content-Type-Options: + - nosniff + X-Current-Page: + - '1' + X-Frame-Options: + - SAMEORIGIN + X-Per-Page: + - '100' + X-Ratelimit-Limit: + - '1000' + X-Ratelimit-Remaining: + - '999' + X-Ratelimit-Reset: + - '1570615200' + X-Request-Id: + - 44299211-5b64-4d33-83d5-a6068d4963f0 + X-Runtime: + - '0.081956' + X-Total-Count: + - '1' + X-Total-Pages: + - '1' + X-Updated-Since-Request-Synced-At: + - 2019-10-09 09:00:09 UTC + X-Xss-Protection: + - 1; mode=block + Date: + - Wed, 09 Oct 2019 09:00:09 GMT + Content-Length: + - '589' + body: + encoding: UTF-8 + string: '{"links":{"rental_contacts.rental":"https://www.bookingsync.com/api/v3/rentals/{rental_contacts.rental}","rental_contacts.contact":"https://www.bookingsync.com/api/v3/contacts/{rental_contacts.contact}"},"rental_contacts":[{"links":{"contact":1,"rental":1},"id":5,"kind":"owner","roles":["invoices"],"created_at":"2019-10-09T08:57:49Z","updated_at":"2019-10-09T08:57:49Z","canceled_at":null}],"meta":{"Link":{"first":"https://www.bookingsync.com/api/v3/rental_contacts?page=1","last":"https://www.bookingsync.com/api/v3/rental_contacts?page=1"},"X-Total-Pages":"1","X-Total-Count":"1","X-Per-Page":"100"}}' + http_version: + recorded_at: Wed, 09 Oct 2019 09:00:09 GMT +recorded_with: VCR 5.0.0 From 9c38b0290bf55e0749a1c1e87f7e908d5f831e75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Fern=C3=A1ndez?= Date: Wed, 9 Oct 2019 11:18:11 +0200 Subject: [PATCH 2/3] Fix typo --- lib/bookingsync/api/client/rental_contacts.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bookingsync/api/client/rental_contacts.rb b/lib/bookingsync/api/client/rental_contacts.rb index 134ccf4..ceb52dd 100644 --- a/lib/bookingsync/api/client/rental_contacts.rb +++ b/lib/bookingsync/api/client/rental_contacts.rb @@ -3,7 +3,7 @@ class Client module RentalContacts # List rental_contacts # - # Returns all contacts related to rentals for the current account. + # Returns all rantal_contacts related to rentals for the current account. # @param options [Hash] A customizable set of options. # @option options [Array] fields: List of fields to be fetched. # @return [Array] Array of rental_contacts. From 6ad23a2ae419f83302b1824d73ea60f876e01571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Fern=C3=A1ndez?= Date: Wed, 9 Oct 2019 11:50:21 +0200 Subject: [PATCH 3/3] Implement feedback --- lib/bookingsync/api/client/rental_contacts.rb | 2 +- .../api/client/rental_contacts_spec.rb | 18 ++--- ...s.yml => creates_a_new_rental_contact.yml} | 0 ...s.yml => deletes_given_rental_contact.yml} | 2 +- .../updates_given_rental_contact_by_ID.yml | 69 ++++++++++++++++++ .../updates_given_rental_contacts_by_ID.yml | 71 ++++++++++--------- 6 files changed, 116 insertions(+), 46 deletions(-) rename spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_create_rental_contact/{creates_a_new_rental_contacts.yml => creates_a_new_rental_contact.yml} (100%) rename spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_delete_rental_contact/{deletes_given_rental_contacts.yml => deletes_given_rental_contact.yml} (98%) create mode 100644 spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_edit_rental_contact/updates_given_rental_contact_by_ID.yml diff --git a/lib/bookingsync/api/client/rental_contacts.rb b/lib/bookingsync/api/client/rental_contacts.rb index ceb52dd..e13b111 100644 --- a/lib/bookingsync/api/client/rental_contacts.rb +++ b/lib/bookingsync/api/client/rental_contacts.rb @@ -8,7 +8,7 @@ module RentalContacts # @option options [Array] fields: List of fields to be fetched. # @return [Array] Array of rental_contacts. # - # @example Get the list of contacts for the current account + # @example Get the list of rental_contacts for the current account # rental_contacts = @api.rental_contacts # rental_contacts.first.contact.title # => "Internet" # @see http://developers.bookingsync.com/reference/endpoints/rental_contacts/#list-rentals-contacts diff --git a/spec/bookingsync/api/client/rental_contacts_spec.rb b/spec/bookingsync/api/client/rental_contacts_spec.rb index d0739d9..bd4470d 100644 --- a/spec/bookingsync/api/client/rental_contacts_spec.rb +++ b/spec/bookingsync/api/client/rental_contacts_spec.rb @@ -29,14 +29,14 @@ let(:attributes) { { contact_id: 1, kind: "owner", roles: ["invoices"] } } let(:rental) { BookingSync::API::Resource.new(client, id: 1) } - it "creates a new rental_contacts" do + it "creates a new rental_contact" do client.create_rental_contact(rental, attributes) assert_requested :post, bs_url("rentals/#{rental}/rental_contacts"), body: { rental_contacts: [attributes] }.to_json end - it "returns newly created rental_contacts" do - VCR.use_cassette("BookingSync_API_Client_RentalContacts/_create_rental_contact/creates_a_new_rental_contacts") do + it "returns newly created rental_contact" do + VCR.use_cassette("BookingSync_API_Client_RentalContacts/_create_rental_contact/creates_a_new_rental_contact") do rental_contacts = client.create_rental_contact(rental, attributes) expect(rental_contacts.dig(:links, :contact)).to eq(1) expect(rental_contacts.dig(:links, :rental)).to eq(1) @@ -47,17 +47,17 @@ describe ".edit_rental_contact", :vcr do let(:attributes) { { kind: "manager" } } let(:created_rental_contacts_id) { - find_resource("#{@casette_base_path}_create_rental_contact/creates_a_new_rental_contacts.yml", "rental_contacts")[:id] + find_resource("#{@casette_base_path}_create_rental_contact/creates_a_new_rental_contact.yml", "rental_contacts")[:id] } - it "updates given rental_contacts by ID" do + it "updates given rental_contact by ID" do client.edit_rental_contact(created_rental_contacts_id, attributes) assert_requested :put, bs_url("rental_contacts/#{created_rental_contacts_id}"), body: { rental_contacts: [attributes] }.to_json end - it "returns updated rental_contacts" do - VCR.use_cassette("BookingSync_API_Client_RentalContacts/_edit_rental_contact/updates_given_rental_contacts_by_ID") do + it "returns updated rental_contact" do + VCR.use_cassette("BookingSync_API_Client_RentalContacts/_edit_rental_contact/updates_given_rental_contact_by_ID") do rental_contacts = client.edit_rental_contact(created_rental_contacts_id, attributes) expect(rental_contacts).to be_kind_of(BookingSync::API::Resource) expect(rental_contacts.fetch(:kind)).to eq("manager") @@ -67,10 +67,10 @@ describe ".delete_rental_contact", :vcr do let(:created_rental_contacts_id) { - find_resource("#{@casette_base_path}_create_rental_contact/creates_a_new_rental_contacts.yml", "rental_contacts")[:id] + find_resource("#{@casette_base_path}_create_rental_contact/creates_a_new_rental_contact.yml", "rental_contacts")[:id] } - it "deletes given rental_contacts" do + it "deletes given rental_contact" do client.delete_rental_contact(created_rental_contacts_id) assert_requested :delete, bs_url("rental_contacts/#{created_rental_contacts_id}") end diff --git a/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_create_rental_contact/creates_a_new_rental_contacts.yml b/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_create_rental_contact/creates_a_new_rental_contact.yml similarity index 100% rename from spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_create_rental_contact/creates_a_new_rental_contacts.yml rename to spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_create_rental_contact/creates_a_new_rental_contact.yml diff --git a/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_delete_rental_contact/deletes_given_rental_contacts.yml b/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_delete_rental_contact/deletes_given_rental_contact.yml similarity index 98% rename from spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_delete_rental_contact/deletes_given_rental_contacts.yml rename to spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_delete_rental_contact/deletes_given_rental_contact.yml index a4c9703..729e509 100644 --- a/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_delete_rental_contact/deletes_given_rental_contacts.yml +++ b/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_delete_rental_contact/deletes_given_rental_contact.yml @@ -58,6 +58,6 @@ http_interactions: body: encoding: UTF-8 string: '' - http_version: + http_version: recorded_at: Wed, 09 Oct 2019 09:00:31 GMT recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_edit_rental_contact/updates_given_rental_contact_by_ID.yml b/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_edit_rental_contact/updates_given_rental_contact_by_ID.yml new file mode 100644 index 0000000..e2ef469 --- /dev/null +++ b/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_edit_rental_contact/updates_given_rental_contact_by_ID.yml @@ -0,0 +1,69 @@ +--- +http_interactions: +- request: + method: put + uri: https://www.bookingsync.com/api/v3/rental_contacts/5 + body: + encoding: UTF-8 + string: '{"rental_contacts":[{"kind":"manager"}]}' + headers: + User-Agent: + - BookingSync API gem v0.1.13 + Accept: + - application/vnd.api+json + Content-Type: + - application/vnd.api+json + Authorization: + - Bearer <> + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Connection: + - keep-alive + Keep-Alive: + - '30' + response: + status: + code: 200 + message: OK + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Content-Type: + - application/vnd.api+json; charset=utf-8 + Etag: + - W/"5deed18550ce6bf175abdc45a8fda760" + Set-Cookie: + - ahoy_visit=f1068a64-a73b-4e7b-81d4-76764fa797ec; path=/; expires=Wed, 16 Oct + 2019 09:00:31 -0000 + - ahoy_visitor=e329fdc9-5e5e-4bf5-a1b6-2fc82c4fe415; path=/; expires=Sat, 09 + Oct 2021 09:00:31 -0000 + Vary: + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - '1000' + X-Ratelimit-Remaining: + - '995' + X-Ratelimit-Reset: + - '1570615200' + X-Request-Id: + - 9682e1b4-e503-4a52-a950-498a3937559b + X-Runtime: + - '0.096848' + X-Updated-Since-Request-Synced-At: + - 2019-10-09 09:00:31 UTC + X-Xss-Protection: + - 1; mode=block + Date: + - Wed, 09 Oct 2019 09:00:31 GMT + Content-Length: + - '397' + body: + encoding: UTF-8 + string: '{"links":{"rental_contacts.rental":"https://www.bookingsync.com/api/v3/rentals/{rental_contacts.rental}","rental_contacts.contact":"https://www.bookingsync.com/api/v3/contacts/{rental_contacts.contact}"},"rental_contacts":[{"links":{"contact":1,"rental":1},"id":5,"kind":"manager","roles":["invoices"],"created_at":"2019-10-09T08:57:49Z","updated_at":"2019-10-09T09:00:31Z","canceled_at":null}],"meta":{}}' + http_version: + recorded_at: Wed, 09 Oct 2019 09:00:31 GMT +recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_edit_rental_contact/updates_given_rental_contacts_by_ID.yml b/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_edit_rental_contact/updates_given_rental_contacts_by_ID.yml index ecc981e..cbc0a9f 100644 --- a/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_edit_rental_contact/updates_given_rental_contacts_by_ID.yml +++ b/spec/fixtures/cassettes/BookingSync_API_Client_RentalContacts/_edit_rental_contact/updates_given_rental_contacts_by_ID.yml @@ -8,7 +8,7 @@ http_interactions: string: '{"rental_contacts":[{"kind":"manager"}]}' headers: User-Agent: - - BookingSync API gem v0.1.13 + - BookingSync API gem v0.1.14 Accept: - application/vnd.api+json Content-Type: @@ -23,47 +23,48 @@ http_interactions: - '30' response: status: - code: 200 - message: OK + code: 401 + message: Unauthorized headers: - Cache-Control: - - max-age=0, private, must-revalidate + Server: + - nginx/1.16.1 + Date: + - Wed, 09 Oct 2019 09:25:03 GMT Content-Type: - - application/vnd.api+json; charset=utf-8 - Etag: - - W/"5deed18550ce6bf175abdc45a8fda760" - Set-Cookie: - - ahoy_visit=f1068a64-a73b-4e7b-81d4-76764fa797ec; path=/; expires=Wed, 16 Oct - 2019 09:00:31 -0000 - - ahoy_visitor=e329fdc9-5e5e-4bf5-a1b6-2fc82c4fe415; path=/; expires=Sat, 09 - Oct 2021 09:00:31 -0000 - Vary: - - Origin - X-Content-Type-Options: - - nosniff + - application/json; charset=utf-8 + Transfer-Encoding: + - chunked X-Frame-Options: - SAMEORIGIN - X-Ratelimit-Limit: - - '1000' - X-Ratelimit-Remaining: - - '995' - X-Ratelimit-Reset: - - '1570615200' - X-Request-Id: - - 9682e1b4-e503-4a52-a950-498a3937559b - X-Runtime: - - '0.096848' - X-Updated-Since-Request-Synced-At: - - 2019-10-09 09:00:31 UTC X-Xss-Protection: - 1; mode=block - Date: - - Wed, 09 Oct 2019 09:00:31 GMT - Content-Length: - - '397' + X-Content-Type-Options: + - nosniff + X-Updated-Since-Request-Synced-At: + - 2019-10-09 09:25:03 UTC + Cache-Control: + - no-store + Pragma: + - no-cache + Www-Authenticate: + - Bearer realm="Doorkeeper", error="invalid_token", error_description="The access + token is invalid" + Set-Cookie: + - ahoy_visit=fb2e0175-f454-4150-8b32-d518b1f596a4; path=/; expires=Wed, 16 Oct + 2019 09:25:03 -0000; secure + - ahoy_visitor=b77418b8-2072-4c6f-878f-2ec3bf46e817; path=/; expires=Sat, 09 + Oct 2021 09:25:03 -0000; secure + X-Request-Id: + - 88be885b-e5cb-4dd1-8c9a-6ab5691cbc18 + X-Runtime: + - '0.006597' + Vary: + - Origin + Strict-Transport-Security: + - max-age=15552000; includeSubDomains body: encoding: UTF-8 - string: '{"links":{"rental_contacts.rental":"https://www.bookingsync.com/api/v3/rentals/{rental_contacts.rental}","rental_contacts.contact":"https://www.bookingsync.com/api/v3/contacts/{rental_contacts.contact}"},"rental_contacts":[{"links":{"contact":1,"rental":1},"id":5,"kind":"manager","roles":["invoices"],"created_at":"2019-10-09T08:57:49Z","updated_at":"2019-10-09T09:00:31Z","canceled_at":null}],"meta":{}}' + string: '{"errors":[{"code":"unauthorized"}]}' http_version: - recorded_at: Wed, 09 Oct 2019 09:00:31 GMT + recorded_at: Wed, 09 Oct 2019 09:25:03 GMT recorded_with: VCR 5.0.0