questionpro_rails 0.0.3 → 0.0.4
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/lib/questionpro_rails/choice.rb +15 -0
- data/lib/questionpro_rails/question.rb +28 -0
- data/lib/questionpro_rails/section.rb +44 -0
- data/lib/questionpro_rails/survey.rb +16 -1
- data/lib/questionpro_rails/version.rb +1 -1
- data/lib/questionpro_rails.rb +0 -10
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a63a3d7bfda4183121f767e024576305417286f0
|
4
|
+
data.tar.gz: 61b597f8b59322c37e25fd11191b35ac33faa20a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eedb498321bcfffbcd26015016afc98880f4d39c6b293a322d236debfe90123371a33c5eed26c679ce6d66a4eed51d8bb87987865188ab1bb2d67010e2c2a4ac
|
7
|
+
data.tar.gz: 4cfbda04096486083a30b639643e3bd46f2181877793545cd0c3613ce6e3b09608b3ff617e6476535fd752e20bd80424f0bc030ee7b771618b71ddbff26d55f3
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module QuestionproRails
|
2
|
+
class Choice
|
3
|
+
|
4
|
+
attr_reader :score, :is_default, :exclude_randomize, :id, :text
|
5
|
+
|
6
|
+
def initialize (attributes)
|
7
|
+
@id = attributes['id']
|
8
|
+
@score = attributes['score']
|
9
|
+
@is_default = attributes['isDefault']
|
10
|
+
@exclude_randomize = attributes['excludeRandomize']
|
11
|
+
@text = attributes['text']
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "questionpro_rails/choice"
|
2
|
+
|
3
|
+
module QuestionproRails
|
4
|
+
class Question
|
5
|
+
|
6
|
+
attr_reader :order_number, :qp_answers, :id, :text
|
7
|
+
|
8
|
+
def initialize (attributes)
|
9
|
+
@id = attributes['id']
|
10
|
+
@order_number = attributes['orderNumber']
|
11
|
+
@text = attributes['text']
|
12
|
+
@qp_answers = attributes['answers']
|
13
|
+
end
|
14
|
+
|
15
|
+
def choices
|
16
|
+
extracted_choices = []
|
17
|
+
|
18
|
+
if self.qp_answers.any?
|
19
|
+
self.qp_answers.each do |choice|
|
20
|
+
extracted_choices.push(Choice.new(choice))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
return extracted_choices
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require "questionpro_rails/question"
|
2
|
+
|
3
|
+
module QuestionproRails
|
4
|
+
class Section
|
5
|
+
|
6
|
+
attr_reader :num_tasks, :exact_min_answers, :orientation, :code, :video_type, :max_answers, :qp_questions,
|
7
|
+
:dynamic_explode_text, :section_id, :video, :type, :min_answers, :required, :has_page_break,
|
8
|
+
:random, :random_section, :subtype, :mobile_friendly
|
9
|
+
|
10
|
+
def initialize(attributes)
|
11
|
+
@num_tasks = attributes['numTasks']
|
12
|
+
@exact_min_answers = attributes['exactMinAnswers']
|
13
|
+
@orientation = attributes['orientation']
|
14
|
+
@code = attributes['code']
|
15
|
+
@video_type = attributes['videoType']
|
16
|
+
@max_answers = attributes['maxAnswers']
|
17
|
+
@dynamic_explode_text = attributes['dynamicExplodeText']
|
18
|
+
@section_id = attributes['sectionID']
|
19
|
+
@video = attributes['video']
|
20
|
+
@type = attributes['type']
|
21
|
+
@min_answers = attributes['minAnswers']
|
22
|
+
@required = attributes['required']
|
23
|
+
@has_page_break = attributes['hasPageBreak']
|
24
|
+
@random = attributes['random']
|
25
|
+
@random_section = attributes['randomSection']
|
26
|
+
@subtype = attributes['subtype']
|
27
|
+
@mobile_friendly = attributes['mobileFriendly']
|
28
|
+
@qp_questions = attributes['questions']
|
29
|
+
end
|
30
|
+
|
31
|
+
def questions
|
32
|
+
extracted_questions = []
|
33
|
+
|
34
|
+
if self.qp_questions.any?
|
35
|
+
self.qp_questions.each do |question|
|
36
|
+
extracted_questions.push(Question.new(question))
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
return extracted_questions
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
@@ -1,8 +1,10 @@
|
|
1
|
+
require "questionpro_rails/section"
|
2
|
+
|
1
3
|
module QuestionproRails
|
2
4
|
class Survey
|
3
5
|
|
4
6
|
attr_reader :id, :name, :subtitle, :url, :thank_you_message,
|
5
|
-
:has_scoring_logic, :numeric_title, :status
|
7
|
+
:has_scoring_logic, :numeric_title, :status, :qp_sections
|
6
8
|
|
7
9
|
def initialize (attributes)
|
8
10
|
@id = (attributes['id'] || attributes['surveyID'])
|
@@ -13,6 +15,19 @@ module QuestionproRails
|
|
13
15
|
@has_scoring_logic = attributes['hasScoringLogic']
|
14
16
|
@numeric_title = attributes['numericTitle']
|
15
17
|
@status = attributes['status']
|
18
|
+
@qp_sections = attributes['sections']
|
19
|
+
end
|
20
|
+
|
21
|
+
def sections
|
22
|
+
extracted_sections = []
|
23
|
+
|
24
|
+
if self.qp_sections.any?
|
25
|
+
self.qp_sections.each do |section|
|
26
|
+
extracted_sections.push(Section.new(section))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
return extracted_sections
|
16
31
|
end
|
17
32
|
|
18
33
|
end
|
data/lib/questionpro_rails.rb
CHANGED
@@ -25,14 +25,4 @@ module QuestionproRails
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
# def self.surveys(options = {})
|
29
|
-
# url = "#{ QuestionproRails.base_path('questionpro.survey.getAllSurveys') }"
|
30
|
-
# response = get(url)
|
31
|
-
# if response.success?
|
32
|
-
# new(response)
|
33
|
-
# else
|
34
|
-
# raise response.response
|
35
|
-
# end
|
36
|
-
# end
|
37
|
-
|
38
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: questionpro_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Assem Deghady
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -75,7 +75,10 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- lib/questionpro_rails.rb
|
77
77
|
- lib/questionpro_rails/api_request.rb
|
78
|
+
- lib/questionpro_rails/choice.rb
|
78
79
|
- lib/questionpro_rails/configuration.rb
|
80
|
+
- lib/questionpro_rails/question.rb
|
81
|
+
- lib/questionpro_rails/section.rb
|
79
82
|
- lib/questionpro_rails/survey.rb
|
80
83
|
- lib/questionpro_rails/survey_response_count.rb
|
81
84
|
- lib/questionpro_rails/version.rb
|