limesurvey_rails 1.6.0 → 2.0.0.beta

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d528206d39a75793bc0c4693dca10a77862ee58c
4
- data.tar.gz: 7c17812488f1c73e7c0406a1e60e127d82d05a65
3
+ metadata.gz: 51dc20014d97dda7b00575a9f788ed495e19ae9d
4
+ data.tar.gz: 7d5cb5afb2ac7ebfa5a63c49e3b398f3857f2800
5
5
  SHA512:
6
- metadata.gz: 3c305914e21e416f21b3cf9c5810a00cb5a3189985922dfb440122a20095cfecc82e496bf71007e261b66f152c9d2281321c0bc7e692dac7313bf0b8c214cff9
7
- data.tar.gz: bce318fc0eb6210ab2ab44711c8a6e8edcf5556079a1253e18425ca28dd20559e91b5ef683d51e80d77a64282f5b1048b47b3bc5c101f35615a36572487755eb
6
+ metadata.gz: 9e083aebd9b247cfc7587980fa91347f0c212b0c8cb0fbe989f6edbd9089813c2991029b9207314da87f495d9e05fe62f1ad2235e94fa58295dfd9d59da1eab3
7
+ data.tar.gz: 9649919723f39e22afb96f322774aca290e15f439b02247c06a5659477ef5e43a8d703fcf9c53be5c590a4cdb33b86cd81b80a460c30d1b0593311ac29e54834
@@ -4,97 +4,7 @@ module LimesurveyRails
4
4
 
5
5
  LIST_SURVEYS_ATTRIBUTES = %w{ sid surveyls_title startdate expires active }
6
6
 
7
- GET_SUMMARY_RESPONSES_ATTRIBUTES = %w{ completed_responses incomplete_responses full_responses }
8
- GET_SUMMARY_TOKENS_ATTRIBUTES = %w{ token_count token_invalid token_sent token_opted_out token_completed }
9
- GET_SUMMARY_ATTRIBUTES = GET_SUMMARY_RESPONSES_ATTRIBUTES + GET_SUMMARY_TOKENS_ATTRIBUTES
10
- GET_SURVEY_PROPERTY_ATTRIBUTES = %w{
11
- attributedescriptions
12
- savetimings
13
- allowprev
14
- tokenanswerspersistence
15
- showgroupinfo
16
- showwelcome
17
- owner_id
18
- template
19
- printanswers
20
- assessments
21
- shownoanswer
22
- showprogress
23
- admin
24
- language
25
- ipaddr
26
- usecaptcha
27
- showqnumcode
28
- allowjumps
29
- active
30
- additional_languages
31
- refurl
32
- usetokens
33
- bouncetime
34
- navigationdelay
35
- expires
36
- datestamp
37
- datecreated
38
- bounce_email
39
- bounceprocessing
40
- nokeyboard
41
- startdate
42
- usecookie
43
- publicstatistics
44
- bounceaccounttype
45
- alloweditaftercompletion
46
- adminemail
47
- allowregister
48
- publicgraphs
49
- emailresponseto
50
- bounceaccounthost
51
- googleanalyticsstyle
52
- anonymized
53
- allowsave
54
- listpublic
55
- emailnotificationto
56
- bounceaccountpass
57
- googleanalyticsapikey
58
- faxto
59
- autonumber_start
60
- htmlemail
61
- tokenlength
62
- bounceaccountencryption
63
- format
64
- autoredirect
65
- sendconfirmation
66
- showxquestions
67
- bounceaccountuser
68
- }
69
-
70
- GET_LANGUAGE_PROPERTIES_ATTRIBUTES = %w{
71
- surveyls_survey_id
72
- surveyls_url
73
- surveyls_email_register_subj
74
- email_admin_notification_subj
75
- surveyls_language
76
- surveyls_urldescription
77
- surveyls_email_register
78
- email_admin_notification
79
- surveyls_title
80
- surveyls_email_invite_subj
81
- surveyls_email_confirm_subj
82
- email_admin_responses_subj
83
- surveyls_description
84
- surveyls_email_invite
85
- surveyls_email_confirm
86
- email_admin_responses
87
- surveyls_welcometext
88
- surveyls_email_remind_subj
89
- surveyls_dateformat
90
- surveyls_numberformat
91
- surveyls_endtext
92
- surveyls_email_remind
93
- surveyls_attributecaptions
94
- }
95
-
96
-
97
- ALL_ATTRIBUTES = (GET_SUMMARY_ATTRIBUTES | GET_SURVEY_PROPERTY_ATTRIBUTES | GET_LANGUAGE_PROPERTIES_ATTRIBUTES ).sort.unshift('id')
7
+ ALL_ATTRIBUTES = LIST_SURVEYS_ATTRIBUTES.sort.unshift('id')
98
8
 
99
9
  attr_accessor *ALL_ATTRIBUTES
100
10
 
@@ -104,16 +14,15 @@ module LimesurveyRails
104
14
  validates_presence_of :surveyls_title
105
15
  validates_presence_of :language
106
16
 
107
- def self.all(lang = nil)
108
- all_ids.map{|id| build(id,lang) }
109
- end
110
-
111
- def self.all_ids
112
- LimesurveyRails.list_surveys(LimesurveyRails.configuration.username).map{|s| s['sid'].to_i }
17
+ def self.all
18
+ LimesurveyRails.list_surveys.map do |s|
19
+ id = s.delete('sid').to_i
20
+ new({id: id}.merge(s))
21
+ end
113
22
  end
114
23
 
115
- def self.find(survey_id,lang = nil)
116
- build(survey_id,lang)
24
+ def self.find(survey_id)
25
+ self.all.find{|s| s.id == survey_id.to_i} or raise(RemoteControlError,"Invalid survey ID")
117
26
  end
118
27
 
119
28
  def self.add(title,lang)
@@ -216,24 +125,11 @@ module LimesurveyRails
216
125
  end
217
126
 
218
127
  def reload
219
- Survey.build(id)
128
+ self.class.find(id)
220
129
  end
221
130
 
222
131
  private
223
132
 
224
- def self.build(survey_id, lang = nil)
225
- all_attributes = {id: survey_id.to_i}
226
- all_attributes.merge!(LimesurveyRails.get_survey_properties(survey_id,GET_SURVEY_PROPERTY_ATTRIBUTES))
227
-
228
- # if all_attributes['active'] == 'Y'
229
- all_attributes.merge!(LimesurveyRails.get_summary(survey_id,'all'))
230
- # else
231
- # GET_SUMMARY_TOKENS_ATTRIBUTES.each{|a| all_attributes[a] = LimesurveyRails.get_summary(survey_id,a) rescue nil }
232
- # end
233
- all_attributes.merge!(LimesurveyRails.get_language_properties(survey_id,GET_LANGUAGE_PROPERTIES_ATTRIBUTES,lang || all_attributes['language']))
234
- new(all_attributes)
235
- end
236
-
237
133
  end
238
134
 
239
135
  end
@@ -26,7 +26,7 @@ module LimesurveyRails
26
26
  end
27
27
 
28
28
  def surveys
29
- survey__ids.map{|id| Survey.find(id) }
29
+ Survey.all.find_all{|s| survey__ids.include?(s.id)}
30
30
  end
31
31
 
32
32
  def survey__ids
@@ -34,11 +34,11 @@ module LimesurveyRails
34
34
  end
35
35
 
36
36
  def available_surveys
37
- available_survey__ids.map{|id| Survey.find(id) }
37
+ Survey.all.find_all{|s| !survey__ids.include?(s.id)}
38
38
  end
39
39
 
40
40
  def available_survey__ids
41
- Survey.all_ids - survey__ids
41
+ Survey.all.map(&:id) - survey__ids
42
42
  end
43
43
  end
44
44
 
@@ -1,3 +1,3 @@
1
1
  module LimesurveyRails
2
- VERSION = "1.6.0"
2
+ VERSION = "2.0.0.beta"
3
3
  end
@@ -203,8 +203,6 @@ module LimesurveyRails
203
203
  describe "survey" do
204
204
  before(:each) { test_survey.invite_participants! }
205
205
  subject { test_survey.reload }
206
- its(:token_count) { is_expected.to eq '3' }
207
- its(:token_sent) { is_expected.to eq '2' }
208
206
  end
209
207
  end
210
208
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: limesurvey_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 2.0.0.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - masciugo
@@ -220,9 +220,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
220
220
  version: '0'
221
221
  required_rubygems_version: !ruby/object:Gem::Requirement
222
222
  requirements:
223
- - - ">="
223
+ - - ">"
224
224
  - !ruby/object:Gem::Version
225
- version: '0'
225
+ version: 1.3.1
226
226
  requirements: []
227
227
  rubyforge_project:
228
228
  rubygems_version: 2.4.5