limesurvey-rails 0.0.1 → 0.0.2
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.
- data/lib/limesurvey-rails/limesurvey_rails.rb +4 -0
- data/lib/limesurvey-rails/survey.rb +5 -16
- data/lib/limesurvey-rails/version.rb +1 -1
- data/limesurvey-rails.gemspec +1 -1
- data/spec/limesurvey_rails_spec.rb +3 -0
- data/spec/support/test_limesurvey_constants.rb +1 -0
- data/spec/survey_spec.rb +14 -4
- metadata +2 -2
@@ -9,6 +9,10 @@ module LimesurveyRails
|
|
9
9
|
configuration.api_base_url && configuration.api_base_url + "/admin/remotecontrol"
|
10
10
|
end
|
11
11
|
|
12
|
+
def self.new_survey_url
|
13
|
+
configuration.api_base_url + '/admin/survey/sa/newsurvey'
|
14
|
+
end
|
15
|
+
|
12
16
|
def self.connect
|
13
17
|
if connected?
|
14
18
|
false
|
@@ -9,9 +9,6 @@ module LimesurveyRails
|
|
9
9
|
|
10
10
|
alias_attribute :id, :sid
|
11
11
|
|
12
|
-
validates_presence_of :surveyls_title, :surveyls_language
|
13
|
-
validate :surveyls_title_must_be_unique
|
14
|
-
|
15
12
|
def self.all
|
16
13
|
LimesurveyRails.list_surveys.map do |s|
|
17
14
|
attributes = LimesurveyRails.get_survey_properties(s['sid'],ATTRIBUTES)
|
@@ -20,16 +17,13 @@ module LimesurveyRails
|
|
20
17
|
end
|
21
18
|
|
22
19
|
def self.find(sid)
|
23
|
-
LimesurveyRails.get_survey_properties(sid,ATTRIBUTES)
|
20
|
+
attributes = LimesurveyRails.get_survey_properties(sid,ATTRIBUTES)
|
21
|
+
new(attributes)
|
24
22
|
end
|
25
23
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
# def url
|
31
|
-
# LIMESURVEY_API_BASE_URL + "/admin/survey/sa/view/surveyid/#{surveyls_survey_id}"
|
32
|
-
# end
|
24
|
+
def url
|
25
|
+
LimesurveyRails.configuration.api_base_url + "/admin/survey/sa/view/surveyid/#{sid}"
|
26
|
+
end
|
33
27
|
|
34
28
|
# def lang
|
35
29
|
# surveyls_language
|
@@ -42,11 +36,6 @@ module LimesurveyRails
|
|
42
36
|
|
43
37
|
# private
|
44
38
|
|
45
|
-
# def surveyls_title_must_be_unique
|
46
|
-
# if LIMESURVEY_API.list_surveys(LS_SESSION_KEY).map{|s| s['surveyls_title']}.include?(surveyls_title)
|
47
|
-
# errors.add(:surveyls_title, "already present on Limesurvey")
|
48
|
-
# end
|
49
|
-
# end
|
50
39
|
end
|
51
40
|
|
52
41
|
end
|
data/limesurvey-rails.gemspec
CHANGED
@@ -75,6 +75,9 @@ describe LimesurveyRails do
|
|
75
75
|
describe ".wrong_name_method" do
|
76
76
|
specify { expect { LimesurveyRails.wrong_name_method }.to raise_error }
|
77
77
|
end
|
78
|
+
describe ".new_survey_url" do
|
79
|
+
specify { expect(LimesurveyRails.new_survey_url).to eq(LIMESURVEY_API_BASE_URL + '/admin/survey/sa/newsurvey') }
|
80
|
+
end
|
78
81
|
end
|
79
82
|
end
|
80
83
|
|
data/spec/survey_spec.rb
CHANGED
@@ -19,10 +19,20 @@ describe LimesurveyRails::Survey, :wip => true do
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
describe ".find(
|
23
|
-
it "return a
|
24
|
-
LimesurveyRails::Survey.find(
|
22
|
+
describe ".find(LIMESURVEY_TEST_SURVEY_ID)" do
|
23
|
+
it "return a Survey object" do
|
24
|
+
LimesurveyRails::Survey.find(LIMESURVEY_TEST_SURVEY_ID).should be_an_instance_of(LimesurveyRails::Survey)
|
25
25
|
end
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
|
+
describe "#url" do
|
29
|
+
it "return the limesurvey survey url" do
|
30
|
+
s = LimesurveyRails::Survey.find(LIMESURVEY_TEST_SURVEY_ID)
|
31
|
+
expect(s.url).to eq(LIMESURVEY_API_BASE_URL + "/admin/survey/sa/view/surveyid/#{LIMESURVEY_TEST_SURVEY_ID}")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "#destroy" do
|
36
|
+
|
37
|
+
end
|
28
38
|
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: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -183,7 +183,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
183
183
|
version: '0'
|
184
184
|
segments:
|
185
185
|
- 0
|
186
|
-
hash: -
|
186
|
+
hash: -2575607421667467541
|
187
187
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
188
188
|
none: false
|
189
189
|
requirements:
|