limesurvey 0.0.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -4
- data/lib/limesurvey.rb +1 -8
- data/lib/limesurvey/version.rb +1 -1
- metadata +1 -2
- data/lib/limesurvey/init.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6971122f994b7544c3373bf8dafc0fcb8f0decb
|
4
|
+
data.tar.gz: 95140c358e4363ba543c54576b3064f11cffc2d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b25686ab6c681f81fd793a2317226e61d0d140c708036e0ab8adae958875e6bededbb10403c5d138bf643c1ca4ad00d671b358669ddcdf2acb15f9e718bb0936
|
7
|
+
data.tar.gz: 2071f788f64b5528bca49d91909556ec9c519e6d7c72d78dd15447cd9fb8378df97f0622cca8e312efd65fae8bf6bba58907334128179d3280d415cbdfd6620e
|
data/README.md
CHANGED
@@ -21,16 +21,39 @@ Or install it yourself as:
|
|
21
21
|
|
22
22
|
$ gem install limesurvey
|
23
23
|
|
24
|
-
## Usage
|
25
|
-
|
26
24
|
Add to your environment development.rb and production.rb if you have separate servers. Otherwise, you can add
|
27
25
|
to your environment.rb. Make sure that you have the JSON RPC enabled on the LimeSurvey site.
|
28
26
|
|
29
27
|
LIMESURVEY_USERNAME = "username"
|
30
28
|
LIMESURVEY_PASSWORD = "password"
|
31
29
|
|
30
|
+
|
32
31
|
Change the url and protocol to match your settings.
|
33
32
|
|
34
33
|
LIMESURVEY_API_URL = "http://url/index.php?r=admin/remotecontrol"
|
35
|
-
|
36
|
-
|
34
|
+
LIMESURVEY_API = Limesurvey::API.new(LIMESURVEY_API_URL)
|
35
|
+
|
36
|
+
## Usage
|
37
|
+
|
38
|
+
session_key = LIMESURVEY_API.get_session_key(limesurvey_username,limesurvey_password)
|
39
|
+
|
40
|
+
## Example Helpers
|
41
|
+
def limesurvey_get_participant_properties(sid, tid, property)
|
42
|
+
#@lime_survey_api = LimeSurvey::API.new(LIMESURVEY_API_URL)
|
43
|
+
#@session_key = @lime_survey_api.get_session_key(LIMESURVEY_USERNAME,LIMESURVEY_PASSWORD)
|
44
|
+
|
45
|
+
participant = LIMESURVEY_API.get_participant_properties(LIMESURVEY_API_SESSION_KEY, sid, tid, [property])
|
46
|
+
#@lime_survey_api.release_session_key(@session_key)
|
47
|
+
response = JSON.parse(participant.to_json)
|
48
|
+
return response[property]
|
49
|
+
end
|
50
|
+
|
51
|
+
def get_limesurvey_title(surveys, sid)
|
52
|
+
surveys.each do |item|
|
53
|
+
survey = JSON.parse(item.to_json)
|
54
|
+
if sid == survey["sid"]
|
55
|
+
return survey["surveyls_title"]
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/lib/limesurvey.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "limesurvey/version"
|
2
2
|
require "net/http"
|
3
|
+
require 'json'
|
3
4
|
module Limesurvey
|
4
5
|
class API
|
5
6
|
def initialize(service_url)
|
@@ -23,12 +24,4 @@ module Limesurvey
|
|
23
24
|
end
|
24
25
|
|
25
26
|
class JSONRPCError < RuntimeError; end
|
26
|
-
|
27
|
-
def get_session_key
|
28
|
-
Limesurvey::API.new
|
29
|
-
end
|
30
|
-
|
31
|
-
def release_session_key(session_key)
|
32
|
-
|
33
|
-
end
|
34
27
|
end
|
data/lib/limesurvey/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: limesurvey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kobaltz
|
@@ -51,7 +51,6 @@ files:
|
|
51
51
|
- README.md
|
52
52
|
- Rakefile
|
53
53
|
- lib/limesurvey.rb
|
54
|
-
- lib/limesurvey/init.rb
|
55
54
|
- lib/limesurvey/version.rb
|
56
55
|
- limesurvey.gemspec
|
57
56
|
homepage: ''
|
data/lib/limesurvey/init.rb
DELETED
File without changes
|