module BookingSync::API::Client::Reviews

Public Instance Methods

create_review(booking, options = {}) click to toggle source

Create a new review

@param booking [BookingSync::API::Resource|Integer] Booking or ID of

the booking for which a review will be created.

@param options [Hash] Review’s attributes. @return [BookingSync::API::Resource] Newly created review.

# File lib/bookingsync/api/client/reviews.rb, line 38
def create_review(booking, options = {})
  post("bookings/#{booking}/reviews", reviews: [options]).pop
end
dismiss_review(review, options = {}) click to toggle source

Dismiss a review

@param booking [BookingSync::API::Resource|Integer] Review or ID of

the review which you want to dismiss.

@param options [Hash] Review’s dismissal attributes. @return [BookingSync::API::Resource] Dismissed review.

# File lib/bookingsync/api/client/reviews.rb, line 48
def dismiss_review(review, options = {})
  put("reviews/#{review}/dismiss", reviews: [options]).pop
end
review(review, options = {}) click to toggle source

Get a single review

@param review [BookingSync::API::Resource|Integer] Review or ID

of the review.

@param options [Hash] A customizable set of query options. @option options [Array] fields: List of fields to be fetched. @return [BookingSync::API::Resource]

# File lib/bookingsync/api/client/reviews.rb, line 28
def review(review, options = {})
  get("reviews/#{review}", options).pop
end
reviews(options = {}, &block) click to toggle source

List reviews

Returns reviews for the account user is authenticated with. @param options [Hash] A customizable set of options. @option options [Array] fields: List of fields to be fetched. @return [Array<BookingSync::API::Resource>] Array of reviews.

@example Get the list of reviews for the current account

reviews = @api.reviews
reviews.first.name # => "John Smith"

@example Get the list of reviews only with name and comment for smaller response

@api.reviews(fields: [:name, :comment])

@see developers.bookingsync.com/reference/endpoints/reviews/#list-reviews

# File lib/bookingsync/api/client/reviews.rb, line 17
def reviews(options = {}, &block)
  paginate :reviews, options, &block
end