ohmage 0.0.11 → 0.0.12
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/ohmage.rb +1 -0
- data/lib/ohmage/api.rb +2 -0
- data/lib/ohmage/entity/survey.rb +22 -0
- data/lib/ohmage/survey.rb +48 -0
- data/lib/ohmage/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c80568e11cf17291690bbb7490013e0d53e367a0
|
4
|
+
data.tar.gz: d2392cf5c7a592adac6c2ff9733f019616222f26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dce10c7dc367820a2452624d126b25f3a0b16b3160248093c5c432499764ec62c1ffc727588e2ebd4ead23e2555417979ef4616a0931a387ad7ab26e7697a6c2
|
7
|
+
data.tar.gz: 2fa36965395ef97cea82dd2650c16f14f306d1ba90150861a891afc77ce049e8c6eb2a3d9597e47664385e1fce2424c9a49395240d66590add2246284f2ca290
|
data/lib/ohmage.rb
CHANGED
data/lib/ohmage/api.rb
CHANGED
@@ -3,6 +3,7 @@ require 'ohmage/campaign'
|
|
3
3
|
require 'ohmage/clazz'
|
4
4
|
require 'ohmage/document'
|
5
5
|
require 'ohmage/media'
|
6
|
+
require 'ohmage/survey'
|
6
7
|
|
7
8
|
module Ohmage
|
8
9
|
module API
|
@@ -11,5 +12,6 @@ module Ohmage
|
|
11
12
|
include Ohmage::API::Campaign
|
12
13
|
include Ohmage::API::Document
|
13
14
|
include Ohmage::API::Media
|
15
|
+
include Ohmage::API::Survey
|
14
16
|
end
|
15
17
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Ohmage
|
2
|
+
class SurveyResponse
|
3
|
+
# @return [String]
|
4
|
+
attr_reader :client, :privacy_state, :repeatable_set_id, :repeatable_set_iteration, :survey_description, :survey_id, :survey_title, :user, :timezone
|
5
|
+
# @return [String] location stuffz
|
6
|
+
attr_reader :location_accuracy, :location_provider, :location_status, :location_timestamp
|
7
|
+
# @return [Long]
|
8
|
+
attr_reader :latitude, :longitude
|
9
|
+
# @return [Hash]
|
10
|
+
attr_reader :launch_context_long, :launch_context_short, :responses
|
11
|
+
# @return [Something Else]
|
12
|
+
attr_reader :time, :utc_timestamp
|
13
|
+
|
14
|
+
|
15
|
+
def initialize(attrs = {})
|
16
|
+
@urn = attrs.keys[0].to_s
|
17
|
+
attrs.values[0].each do |k, v|
|
18
|
+
instance_variable_set("@#{k}", v)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Ohmage
|
2
|
+
module API
|
3
|
+
module Survey
|
4
|
+
#
|
5
|
+
# ohmage survey_response/read call
|
6
|
+
# @see https://github.com/ohmage/server/wiki/Survey-Manipulation#surveyResponseRead
|
7
|
+
# @returns [Array Ohmage::Survey objects] pertaining to request params.
|
8
|
+
#
|
9
|
+
def survey_response_read(params = {})
|
10
|
+
params[:column_list] = params[:column_list] || 'urn:ohmage:special:all'
|
11
|
+
params[:output_format] = params[:output_format] || 'json-rows'
|
12
|
+
params[:user_list] = params[:user_list] || 'urn:ohmage:special:all'
|
13
|
+
params[:prompt_id_list] = 'urn:ohmage:special:all' unless params[:prompt_id_list] || params[:survey_id_list]
|
14
|
+
request = Ohmage::Request.new(self, :post, 'survey_response/read', params)
|
15
|
+
t = []
|
16
|
+
# We can't possibly make Ohmage::SurveyReponse objects unless we use json-rows. json-columns and csv output is so odd for this.
|
17
|
+
if params[:output_format] == 'json-rows'
|
18
|
+
request.perform[:data].each do |v|
|
19
|
+
t << Ohmage::SurveyResponse.new(v[:survey_key] => v)
|
20
|
+
end
|
21
|
+
t
|
22
|
+
else
|
23
|
+
request.perform
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
#
|
28
|
+
# ohmage survey_response/update call
|
29
|
+
# @see https://github.com/ohmage/server/wiki/Survey-Manipulation#surveyResponseUpdatePrivacyState
|
30
|
+
# @returns success/fail as string.
|
31
|
+
#
|
32
|
+
def survey_response_update(params = {})
|
33
|
+
request = Ohmage::Request.new(self, :post, 'survey_response/update', params)
|
34
|
+
request.perform
|
35
|
+
end
|
36
|
+
|
37
|
+
#
|
38
|
+
# ohmage survey_response/delete call
|
39
|
+
# @see https://github.com/ohmage/server/wiki/Survey-Manipulation#surveyResponseDelete
|
40
|
+
# @returns success/fail as string.
|
41
|
+
#
|
42
|
+
def survey_response_delete(params = {})
|
43
|
+
request = Ohmage::Request.new(self, :post, 'survey_response/delete', params)
|
44
|
+
request.perform
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/ohmage/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ohmage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Nolen
|
@@ -87,10 +87,12 @@ files:
|
|
87
87
|
- lib/ohmage/entity/campaign.rb
|
88
88
|
- lib/ohmage/entity/clazz.rb
|
89
89
|
- lib/ohmage/entity/document.rb
|
90
|
+
- lib/ohmage/entity/survey.rb
|
90
91
|
- lib/ohmage/entity/user.rb
|
91
92
|
- lib/ohmage/error.rb
|
92
93
|
- lib/ohmage/media.rb
|
93
94
|
- lib/ohmage/request.rb
|
95
|
+
- lib/ohmage/survey.rb
|
94
96
|
- lib/ohmage/user.rb
|
95
97
|
- lib/ohmage/version.rb
|
96
98
|
- ohmage.gemspec
|