Skip to content

Survey Service

Jörgen Dahlke edited this page May 9, 2018 · 1 revision
Shark.with_service_token(token.jwt) do
  # Find a survey
  survey = Shark::SurveyService::Survey.find("d45ff6b0-55d5-0135-451e-784f436a1198")

  # Add a participant
  survey.add_participant({ participant_type: "test", external_id: "foobar@example.com", additional_data: { song: "Boom Boom Boom!" }})

  # Find a participant
  participant = Shark::SurveyService::Participant.find("d45ff6b0-55d5-0135-451e-784f436a1198")
  participant.participated?   # => true or false

  # Set participant#state to "participated" and saves it
  participant.participate
end
Clone this wiki locally