survey_monkey_api 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +33 -1
- data/lib/surveymonkey/client.rb +2 -0
- data/lib/surveymonkey/client/responses.rb +26 -0
- data/lib/surveymonkey/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 968a764915e88f0d8b6af4ff61d312a7e2d4f945
|
4
|
+
data.tar.gz: 8202b1013fe4f67bceb31ead9b09776143f64506
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b54dbe5d47b77449b28f45b1381c7847dad09586d6979bbaa410bd92c23f5a030b9be487069a563531027ec89459e464c724faea6cb0f31f55cd85433e65bc14
|
7
|
+
data.tar.gz: 92b0f82b5066ce33f9cb653a7a81e1375cd09bcadf2baa8cb9ddef3fdd449bab07d5409c6d7769b10d70f747cbf1fe749fd8e3935d5819816b8b9886a995dc18
|
data/README.md
CHANGED
@@ -20,10 +20,18 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
+
### Preparation
|
24
|
+
|
25
|
+
Add this line to your application's ENV storage:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
SURVEY_MONKEY_TOKEN=your-token
|
29
|
+
```
|
30
|
+
|
23
31
|
### Create SurveyMonkeyApi object
|
24
32
|
|
25
33
|
```ruby
|
26
|
-
require '
|
34
|
+
require 'surveymonkey'
|
27
35
|
client = SurveyMonkeyApi::Client.new
|
28
36
|
```
|
29
37
|
|
@@ -82,6 +90,30 @@ Request for getting list of surveys is #surveys.
|
|
82
90
|
}
|
83
91
|
```
|
84
92
|
|
93
|
+
### SurveyResponses
|
94
|
+
|
95
|
+
Request for getting list of survey responses is #responses.
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
client.responses(survey_id)
|
99
|
+
```
|
100
|
+
|
101
|
+
### SurveyResponse
|
102
|
+
|
103
|
+
Request for getting survey response's information is #response.
|
104
|
+
|
105
|
+
```ruby
|
106
|
+
client.response(survey_id, response_id)
|
107
|
+
```
|
108
|
+
|
109
|
+
### SurveyResponse in details
|
110
|
+
|
111
|
+
Request for getting survey response's information in details is #response_with_details.
|
112
|
+
|
113
|
+
```ruby
|
114
|
+
client.response_with_details(survey_id, response_id)
|
115
|
+
```
|
116
|
+
|
85
117
|
## Contributing
|
86
118
|
|
87
119
|
Bug reports and pull requests are welcome on GitHub at https://github.com/kortirso/surveymonkey.
|
data/lib/surveymonkey/client.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'httparty'
|
2
2
|
require_relative 'client/users'
|
3
3
|
require_relative 'client/surveys'
|
4
|
+
require_relative 'client/responses'
|
4
5
|
|
5
6
|
module SurveyMonkeyApi
|
6
7
|
# Client class for api requests
|
@@ -8,6 +9,7 @@ module SurveyMonkeyApi
|
|
8
9
|
include HTTParty
|
9
10
|
include SurveyMonkeyApi::Client::Users
|
10
11
|
include SurveyMonkeyApi::Client::Surveys
|
12
|
+
include SurveyMonkeyApi::Client::SurveyResponses
|
11
13
|
|
12
14
|
base_uri 'https://api.surveymonkey.net'
|
13
15
|
format :json
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module SurveyMonkeyApi
|
2
|
+
class Client
|
3
|
+
# API endpoints for surveys resources
|
4
|
+
module SurveyResponses
|
5
|
+
# Returns list of survey responses for survey
|
6
|
+
# Each survey looks like
|
7
|
+
# {"href"=>"https://api.surveymonkey.net/v3/surveys/00000001/responses/1234", "id"=>"1234"}
|
8
|
+
def responses(survey_id, options = {})
|
9
|
+
response = self.class.get("/v3/surveys/#{survey_id}/responses", query: options)
|
10
|
+
response.parsed_response
|
11
|
+
end
|
12
|
+
|
13
|
+
# Returns response's information for survey
|
14
|
+
def response(survey_id, response_id, options = {})
|
15
|
+
response = self.class.get("/v3/surveys/#{survey_id}/responses/#{response_id}", query: options)
|
16
|
+
response.parsed_response
|
17
|
+
end
|
18
|
+
|
19
|
+
# Returns response's information for survey with details
|
20
|
+
def response_with_details(survey_id, response_id, options = {})
|
21
|
+
response = self.class.get("/v3/surveys/#{survey_id}/responses/#{response_id}/details", query: options)
|
22
|
+
response.parsed_response
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/surveymonkey/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: survey_monkey_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Bogdanov
|
@@ -100,6 +100,7 @@ files:
|
|
100
100
|
- bin/setup
|
101
101
|
- lib/surveymonkey.rb
|
102
102
|
- lib/surveymonkey/client.rb
|
103
|
+
- lib/surveymonkey/client/responses.rb
|
103
104
|
- lib/surveymonkey/client/surveys.rb
|
104
105
|
- lib/surveymonkey/client/users.rb
|
105
106
|
- lib/surveymonkey/version.rb
|