Module: BookingSync::API::Client::HostReviews

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

Instance Method Summary collapse

Instance Method Details

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

Create a new non-submitted host review

Parameters:

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

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

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

    Host Review’s attributes.

Returns:



38
39
40
# File 'lib/bookingsync/api/client/host_reviews.rb', line 38

def create_draft_host_review(booking, options = {})
  post("bookings/#{booking}/host_reviews/draft", host_reviews: [options]).pop
end

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

Create a new submitted host review

Parameters:

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

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

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

    Host Review’s attributes.

Returns:



48
49
50
# File 'lib/bookingsync/api/client/host_reviews.rb', line 48

def (booking, options = {})
  post("bookings/#{booking}/host_reviews", host_reviews: [options]).pop
end

#dismiss_host_review(host_review, options = {}) ⇒ BookingSync::API::Resource

Dismiss a host review

Examples:

host_review = @api.host_reviews.first
@api.dismiss_host_review(host_review, { dismissed_at: "20201-03-22T12:00:00Z" })

Parameters:

  • host

    review [BookingSync::API::Resource|String] Host Review or ID of the host review to be dismissed.

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

    Host review dismissal attributes.

Returns:



90
91
92
# File 'lib/bookingsync/api/client/host_reviews.rb', line 90

def dismiss_host_review(host_review, options = {})
  put("host_reviews/#{host_review}/dismiss", host_reviews: [options]).pop
end

#edit_draft_host_review(host_review, options = {}) ⇒ BookingSync::API::Resource

Edit a draft host review

Examples:

host_review = @api.host_reviews.first
@api.edit_host_review(host_review, { comment: "Thanks for being such a great guest!", submitted_at: "20201-03-22T12:00:00Z" })

Parameters:

  • host

    review [BookingSync::API::Resource|String] Host Review or ID of the host review to be updated.

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

    Host review attributes to be updated.

Returns:



62
63
64
# File 'lib/bookingsync/api/client/host_reviews.rb', line 62

def edit_draft_host_review(host_review, options = {})
  put("host_reviews/draft/#{host_review}", host_reviews: [options]).pop
end

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

Get a single host review

Parameters:

  • host

    review [BookingSync::API::Resource|String] HostReview or ID of the host 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/host_reviews.rb', line 28

def host_review(host_review, options = {})
  get("host_reviews/#{host_review}", options).pop
end

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

List host reviews

Returns host reviews for the account user is authenticated with.

Examples:

Get the list of host reviews for the current account

host_reviews = @api.host_reviews
host_reviews.first.is_guest_recommended # => true

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

@api.host_reviews(fields: [:submitted_at, :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/host_reviews.rb', line 17

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

#submit_draft_host_review(host_review, options = {}) ⇒ BookingSync::API::Resource

Submit a draft host review

Examples:

host_review = @api.host_reviews.first
@api.edit_host_review(host_review, { comment: "Thanks for being such a great guest!", submitted_at: "20201-03-22T12:00:00Z" })

Parameters:

  • host

    review [BookingSync::API::Resource|String] Host Review or ID of the host review to be updated.

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

    Host review attributes to be updated.

Returns:



76
77
78
# File 'lib/bookingsync/api/client/host_reviews.rb', line 76

def submit_draft_host_review(host_review, options = {})
  put("host_reviews/draft/#{host_review}/submit", host_reviews: [options]).pop
end