surveymonkey_api 0.2.4 → 0.2.5
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/Gemfile.lock +1 -1
- data/lib/surveymonkey_api/response.rb +12 -6
- data/lib/surveymonkey_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 560e038b9acf4a6103f89c15c116372a9b679e02
|
4
|
+
data.tar.gz: c4fa4270f3e843468f5ba1646da1ba6437efb923
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88a8c4a2b387a8ebfda18005db42ff33ea1d44b23c4a66e78592dd3f5b4848bcd77e350ede95bb585e57aa8c820f7fea99684e3cfc5eae978aec75aa964f8989
|
7
|
+
data.tar.gz: 5f3a57ded48a4d8210be3b374b8c4f21c27c1b4343600b23463e2f0e774e19d1432614c960f18f4a9c32a1a4cf5182c9ba3c1a86a3ed8ddca52e8832f104f1e1
|
data/Gemfile.lock
CHANGED
@@ -2,16 +2,22 @@ module Surveymonkey
|
|
2
2
|
# Response
|
3
3
|
class Response
|
4
4
|
extend Forwardable
|
5
|
-
attr_reader :survey_id, :id, :
|
5
|
+
attr_reader :survey_id, :id, :survey_response
|
6
6
|
|
7
|
-
def initialize(survey_id, id)
|
7
|
+
def initialize(survey_id, id, survey_structure = nil, survey_response = nil)
|
8
8
|
@survey_id = survey_id
|
9
9
|
@id = id
|
10
|
-
@
|
10
|
+
@survey_response = survey_response
|
11
|
+
@survey_structure = survey_structure
|
12
|
+
@survey = Surveymonkey::Survey.new(survey_id)
|
13
|
+
end
|
14
|
+
|
15
|
+
def survey_structure
|
16
|
+
@survey_structure ||= details
|
11
17
|
end
|
12
18
|
|
13
19
|
def raw_details(options = {})
|
14
|
-
@raw_details ||= client.survey_response(survey_id, id, options)
|
20
|
+
@raw_details ||= survey_response || client.survey_response(survey_id, id, options)
|
15
21
|
end
|
16
22
|
|
17
23
|
def info
|
@@ -21,13 +27,13 @@ module Surveymonkey
|
|
21
27
|
def pages(options = {})
|
22
28
|
@pages ||= raw_details(options)['pages'].each_with_object([]) do |page, arr|
|
23
29
|
unless page['questions'].empty?
|
24
|
-
page_structure =
|
30
|
+
page_structure = survey_structure['pages'].detect { |p| p['id'] == page['id'] }
|
25
31
|
arr << Surveymonkey::Response::Page.new(page, page_structure)
|
26
32
|
end
|
27
33
|
end
|
28
34
|
end
|
29
35
|
|
30
|
-
def_delegators :@
|
36
|
+
def_delegators :@survey, :details
|
31
37
|
|
32
38
|
private
|
33
39
|
|