Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

Commit

Permalink
adds support for surveyengine.partialResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
pallymore committed Dec 4, 2017
1 parent ccaada4 commit c815bce
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions lib/qualtrics_api/event_subscription_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ def create_completed_response_subscription(url, survey_id, opts = { encrypt: fal
create(url, "surveyengine.completedResponse.#{survey_id}", opts)
end

def create_partial_response_subscription(url, survey_id, opts = { encrypt: false })
create(url, "surveyengine.partialResponse.#{survey_id}", opts)
end

def delete(id)
QualtricsAPI.connection(self)
.delete(endpoint(id))
Expand Down
14 changes: 14 additions & 0 deletions spec/lib/event_subscription_collection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,20 @@
end
end
end

describe "#create_completed_response_subscription" do
it "creates a subscription to the partialResponse event of the survey id specified" do
VCR.use_cassette("event_subscription_create_partial_response_sub") do
survey_id = 'SV_ANOTHER_SURVEY'
url = 'https://request.url.fake'
result = subject.create_partial_response_subscription(url, survey_id)
expect(result).to be_a QualtricsAPI::EventSubscription
expect(result.id).to_not be_nil
expect(result.publication_url).to eq url
expect(result.topics).to eq "surveyengine.partialResponse.#{survey_id}"
end
end
end
end

describe "#delete" do
Expand Down

0 comments on commit c815bce

Please sign in to comment.