Module: HomeAway::API::Domain::SubmitReview

Included in:
Client
Defined in:
lib/homeaway/api/domain/submit_review.rb

Instance Method Summary collapse

Instance Method Details

#submit_review(headline, body, locale, arrival_date, rating, listing_id, unit_id, opts = {}) ⇒ Boolean

Note:

user must be logged in via 3 legged oauth to call this function without error

Creates a review for the given listing and unit. The review submitted must go through the standard HomeAway review process and may not appear immediately within the list of reviews for the listing. It is recommended that the link to submitting a review be placed off of the details page of the listing and unit in question.

analogous to calling a POST on API url /public/submitReview

Parameters:

  • headline (String)

    A short summary about the stay.

  • body (String)

    The body of the review.

  • locale (String)

    The locale that the review was written in.

  • arrival_date (String, DateTime)

    The date of arrival for the stay. Can either be a date-parsable string or a DateTime object

  • rating (Integer)

    An overall rating for the stay between 1 and 5.

  • listing_id (String)

    A listing id as supplied by this public API.

  • unit_id (String)

    The unit id within the listing that the review is for.

Returns:

  • (Boolean)

    true if the review was successfully posted to the moderation queue



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/homeaway/api/domain/submit_review.rb', line 37

def submit_review(headline, body, locale, arrival_date, rating, listing_id, unit_id, opts={})
  body = {
      'headline' => headline.to_s,
      'body' => body.to_s,
      'locale' => locale.to_s,
      'arrivalDate' => HomeAway::API::Util::Validators.date(arrival_date),
      'rating' => HomeAway::API::Util::Validators.integer(rating, 0, 6),
      'listingId' => listing_id.to_s,
      'unitId' => unit_id.to_s
  }.merge(HomeAway::API::Util::Validators.query_keys(opts))
  begin
    post '/public/submitReview', body
    true
  rescue => e
    raise e
  end
end