survey-gizmo-ruby 5.0.2 → 5.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/README.md +2 -0
- data/lib/survey_gizmo/api/page.rb +9 -6
- data/lib/survey_gizmo/api/question.rb +8 -4
- data/lib/survey_gizmo/configuration.rb +1 -1
- data/lib/survey_gizmo/logger.rb +9 -0
- data/lib/survey_gizmo/version.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e8d3c3ad7b01fbcd010738d2a5cf49376162df8
|
4
|
+
data.tar.gz: b7718a4435ea2b88abe17d460698b1104b2d6b02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f9484c0436ffe3d78b5a0b68e0fe208ed3144480f7e0e7aefc3a4bb346e9f783b553d99dd542c5c9d6040ff263c9469472598137c40670f6c10925bf99aed05
|
7
|
+
data.tar.gz: 165082ee6af357726b193f86c6ef5c803a66fb7b77c21c43292254bcbc096403050c6b6ca7ec48611639664c7ee9fcbda570a2a3514f8ca634547c7520d64a35
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Survey Gizmo (ruby)
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/jarthod/survey-gizmo-ruby.svg?branch=master)](https://travis-ci.org/jarthod/survey-gizmo-ruby)
|
4
|
+
|
3
5
|
Integrate with the [Survey Gizmo API](http://apisurveygizmo.helpgizmo.com/help) using an ActiveModel style interface.
|
4
6
|
|
5
7
|
Currently supports SurveyGizmo API **v4** (default) and **v3**.
|
@@ -20,14 +20,17 @@ module SurveyGizmo; module API
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def questions
|
23
|
-
|
24
|
-
@questions.
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
@questions.each { |q| q.attributes = children_params }
|
24
|
+
return @questions if @questions.all? { |q| q.sub_question_skus.all? { |sku| @questions.find { |q| q.id == sku } } }
|
25
|
+
|
26
|
+
# See note on broken subquestions in resource.rb.
|
27
|
+
with_subquestions = @questions
|
28
|
+
@questions.each do |q|
|
29
|
+
with_subquestions.reject! { |q| q.sub_question_skus.include?(q.id) }
|
30
|
+
with_subquestions += q.sub_questions
|
28
31
|
end
|
29
32
|
|
30
|
-
@questions.each { |q| q.attributes = children_params }
|
33
|
+
@questions = with_subquestions.each { |q| q.attributes = children_params }
|
31
34
|
end
|
32
35
|
end
|
33
36
|
end; end
|
@@ -43,12 +43,16 @@ module SurveyGizmo; module API
|
|
43
43
|
@parent_question ||= Question.first(survey_id: survey_id, id: parent_question_id)
|
44
44
|
end
|
45
45
|
|
46
|
+
def sub_question_skus
|
47
|
+
# As of 2015-12-23, the sub_question_skus attribute can either contain an array of integers if no shortname (alias)
|
48
|
+
# was set for any question, or an array of [String, Integer] with the String corresponding to the subquestion
|
49
|
+
# shortname and the integer corresponding to the subquestion id if at least one shortname was set.
|
50
|
+
@sub_question_skus.map { |sku| sku.is_a?(Array) ? sku[1] : sku }
|
51
|
+
end
|
52
|
+
|
46
53
|
def sub_questions
|
47
54
|
@sub_questions ||= sub_question_skus.map do |sku|
|
48
|
-
|
49
|
-
# was set for any question, or an array of [String, Integer] with the String corresponding to the subquestion
|
50
|
-
# shortname and the integer corresponding to the subquestion id if at least one shortname was set.
|
51
|
-
sku = sku[1] if sku.is_a?(Array)
|
55
|
+
SurveyGizmo.configuration.logger.warn("Have to do individual load of sub question #{sku}...")
|
52
56
|
subquestion = Question.first(survey_id: survey_id, id: sku)
|
53
57
|
subquestion.parent_question_id = id
|
54
58
|
subquestion
|
@@ -72,7 +72,7 @@ module SurveyGizmo
|
|
72
72
|
@api_url = DEFAULT_REST_API_URL
|
73
73
|
@api_version = DEFAULT_API_VERSION
|
74
74
|
@results_per_page = DEFAULT_RESULTS_PER_PAGE
|
75
|
-
@logger = ::Logger.new(STDOUT)
|
75
|
+
@logger = SurveyGizmo::Logger.new(STDOUT)
|
76
76
|
@api_debug = ENV['GIZMO_DEBUG'].to_s =~ /^(true|t|yes|y|1)$/i
|
77
77
|
end
|
78
78
|
end
|
data/lib/survey_gizmo/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: survey-gizmo-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kabari Hendrick
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2016-01-24 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -191,6 +191,7 @@ files:
|
|
191
191
|
- ".document"
|
192
192
|
- ".gitignore"
|
193
193
|
- ".rspec"
|
194
|
+
- ".travis.yml"
|
194
195
|
- Gemfile
|
195
196
|
- LICENSE.txt
|
196
197
|
- README.md
|
@@ -210,6 +211,7 @@ files:
|
|
210
211
|
- lib/survey_gizmo/connection.rb
|
211
212
|
- lib/survey_gizmo/faraday_middleware/parse_survey_gizmo.rb
|
212
213
|
- lib/survey_gizmo/faraday_middleware/pester_survey_gizmo.rb
|
214
|
+
- lib/survey_gizmo/logger.rb
|
213
215
|
- lib/survey_gizmo/multilingual_title.rb
|
214
216
|
- lib/survey_gizmo/resource.rb
|
215
217
|
- lib/survey_gizmo/version.rb
|
@@ -259,4 +261,3 @@ test_files:
|
|
259
261
|
- spec/test_json/page.json
|
260
262
|
- spec/test_json/question.json
|
261
263
|
- spec/test_json/survey.json
|
262
|
-
has_rdoc:
|