surveymonkey_api 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bcf3859b47a173822cc172cb1413e15198ef6800
4
- data.tar.gz: 6e10f8e675d4bc10d3c0fd678187be538b5e16d4
3
+ metadata.gz: 560e038b9acf4a6103f89c15c116372a9b679e02
4
+ data.tar.gz: c4fa4270f3e843468f5ba1646da1ba6437efb923
5
5
  SHA512:
6
- metadata.gz: 21c737a80312925e9e2b25973b6e9eae44edf00762d116e5d5e4a261b72f6d46c6288554a3c6e551728d09326810c4fcbe606a9922b257b93602c9699d670516
7
- data.tar.gz: ebeb106e48c372d9695602aec6ac81e83422960445f789fb208d3032687d6c34b77847ecd06613fd333d682b70d5aabdc7962b6b52c8a10be0f0323f73809626
6
+ metadata.gz: 88a8c4a2b387a8ebfda18005db42ff33ea1d44b23c4a66e78592dd3f5b4848bcd77e350ede95bb585e57aa8c820f7fea99684e3cfc5eae978aec75aa964f8989
7
+ data.tar.gz: 5f3a57ded48a4d8210be3b374b8c4f21c27c1b4343600b23463e2f0e774e19d1432614c960f18f4a9c32a1a4cf5182c9ba3c1a86a3ed8ddca52e8832f104f1e1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- surveymonkey_api (0.2.4)
4
+ surveymonkey_api (0.2.5)
5
5
  httparty (~> 0.13)
6
6
 
7
7
  GEM
@@ -2,16 +2,22 @@ module Surveymonkey
2
2
  # Response
3
3
  class Response
4
4
  extend Forwardable
5
- attr_reader :survey_id, :id, :survey_structure
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
- @survey_structure = Surveymonkey::Survey.new(survey_id)
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 = details['pages'].detect { |p| p['id'] == page['id'] }
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 :@survey_structure, :details
36
+ def_delegators :@survey, :details
31
37
 
32
38
  private
33
39
 
@@ -1,3 +1,3 @@
1
1
  module SurveymonkeyApi
2
- VERSION = '0.2.4'
2
+ VERSION = '0.2.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: surveymonkey_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos