Skip to content

Commit

Permalink
add support for Rental URLs restoration (#145)
Browse files Browse the repository at this point in the history
* add support for Rental URLs restoration

* minor adjustments
  • Loading branch information
Azdaroth authored Jun 14, 2024
1 parent e3ee00d commit cef604e
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/bookingsync/api/client/rental_urls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ def cancel_rental_url(rental_url)
delete "rental_urls/#{rental_url}"
end

# Restore a RentalUrl
#
# @param rental_url [BookingSync::API::Resource|Integer] RentalUrl or ID
# of the rental_url to be canceled.
# @return [BookingSync::API::Resource] Restored rental_url on success,
# exception is raised otherwise.
def restore_rental_url(rental_url)
put("rental_urls/#{rental_url}/restore").pop
end

private

def base_64_encode(file_path)
Expand Down
9 changes: 9 additions & 0 deletions spec/bookingsync/api/client/rental_urls_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,13 @@
assert_requested :delete, bs_url("rental_urls/#{created_rental_url_id}")
end
end

describe "#restore_rental_url", :vcr do
let(:rental_url_id) { "e3511ab6-0976-44a7-befe-3e1e08d6f924" }

it "restores given rental_url" do
client.restore_rental_url(rental_url_id)
assert_requested :put, bs_url("rental_urls/#{rental_url_id}/restore")
end
end
end

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cef604e

Please # to comment.