Module: BookingSync::API::Client::Reviews

Included in:
BookingSync::API::Client
Defined in:
lib/bookingsync/api/client/reviews.rb

Instance Method Summary collapse

Instance Method Details

#create_review(booking, options = {}) ⇒ BookingSync::API::Resource

Create a new review

Parameters:

  • booking (BookingSync::API::Resource|Integer)

    Booking or ID of the booking for which a review will be created.

  • options (Hash) (defaults to: {})

    Review’s attributes.

Returns:



38
39
40
# 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 = {}) ⇒ BookingSync::API::Resource

Dismiss a review

Parameters:

  • booking (BookingSync::API::Resource|Integer)

    Review or ID of the review which you want to dismiss.

  • options (Hash) (defaults to: {})

    Review’s dismissal attributes.

Returns:



48
49
50
# 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 = {}) ⇒ BookingSync::API::Resource

Get a single review

Parameters:

  • review (BookingSync::API::Resource|Integer)

    Review or ID of the review.

  • options (Hash) (defaults to: {})

    A customizable set of query options.

Options Hash (options):

  • fields: (Array)

    List of fields to be fetched.

Returns:



28
29
30
# File 'lib/bookingsync/api/client/reviews.rb', line 28

def review(review, options = {})
  get("reviews/#{review}", options).pop
end

#reviews(options = {}, &block) ⇒ Array<BookingSync::API::Resource>

List reviews

Returns reviews for the account user is authenticated with.

Examples:

Get the list of reviews for the current account

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

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

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

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • fields: (Array)

    List of fields to be fetched.

Returns:

See Also:



17
18
19
# File 'lib/bookingsync/api/client/reviews.rb', line 17

def reviews(options = {}, &block)
  paginate :reviews, options, &block
end