ohmage 0.0.12 → 0.0.13
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/entity/survey.rb +1 -2
- data/lib/ohmage/survey.rb +22 -3
- data/lib/ohmage/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ca406f07787c197940ee99b378dc999ae07f1f51
|
|
4
|
+
data.tar.gz: 3dbe178efc253263ae054f014d58d058f96c35a0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 855116d760066bc928504da5b1c92a1eed6bdfa232580d684ab6d470127cf698acfa0b33c19818d17c311838e38b2d1a9a0e063d7fd315747e01b9b8d2232d5c
|
|
7
|
+
data.tar.gz: 89f79871d435c0fcfa25a05c7f77945c363f33948da5d06a52488d51674aa2d3ef9deb49470118ab7b58f6eebf12fe4d4c749b45b99533ca40844948d4342812
|
data/lib/ohmage/entity/survey.rb
CHANGED
|
@@ -3,7 +3,7 @@ module Ohmage
|
|
|
3
3
|
# @return [String]
|
|
4
4
|
attr_reader :client, :privacy_state, :repeatable_set_id, :repeatable_set_iteration, :survey_description, :survey_id, :survey_title, :user, :timezone
|
|
5
5
|
# @return [String] location stuffz
|
|
6
|
-
attr_reader :location_accuracy, :location_provider, :location_status, :location_timestamp
|
|
6
|
+
attr_reader :location_accuracy, :location_provider, :location_status, :location_timestamp
|
|
7
7
|
# @return [Long]
|
|
8
8
|
attr_reader :latitude, :longitude
|
|
9
9
|
# @return [Hash]
|
|
@@ -11,7 +11,6 @@ module Ohmage
|
|
|
11
11
|
# @return [Something Else]
|
|
12
12
|
attr_reader :time, :utc_timestamp
|
|
13
13
|
|
|
14
|
-
|
|
15
14
|
def initialize(attrs = {})
|
|
16
15
|
@urn = attrs.keys[0].to_s
|
|
17
16
|
attrs.values[0].each do |k, v|
|
data/lib/ohmage/survey.rb
CHANGED
|
@@ -6,7 +6,7 @@ module Ohmage
|
|
|
6
6
|
# @see https://github.com/ohmage/server/wiki/Survey-Manipulation#surveyResponseRead
|
|
7
7
|
# @returns [Array Ohmage::Survey objects] pertaining to request params.
|
|
8
8
|
#
|
|
9
|
-
def survey_response_read(params = {})
|
|
9
|
+
def survey_response_read(params = {}) # rubocop:disable all
|
|
10
10
|
params[:column_list] = params[:column_list] || 'urn:ohmage:special:all'
|
|
11
11
|
params[:output_format] = params[:output_format] || 'json-rows'
|
|
12
12
|
params[:user_list] = params[:user_list] || 'urn:ohmage:special:all'
|
|
@@ -27,7 +27,7 @@ module Ohmage
|
|
|
27
27
|
#
|
|
28
28
|
# ohmage survey_response/update call
|
|
29
29
|
# @see https://github.com/ohmage/server/wiki/Survey-Manipulation#surveyResponseUpdatePrivacyState
|
|
30
|
-
# @returns
|
|
30
|
+
# @returns nil
|
|
31
31
|
#
|
|
32
32
|
def survey_response_update(params = {})
|
|
33
33
|
request = Ohmage::Request.new(self, :post, 'survey_response/update', params)
|
|
@@ -37,12 +37,31 @@ module Ohmage
|
|
|
37
37
|
#
|
|
38
38
|
# ohmage survey_response/delete call
|
|
39
39
|
# @see https://github.com/ohmage/server/wiki/Survey-Manipulation#surveyResponseDelete
|
|
40
|
-
# @returns
|
|
40
|
+
# @returns nil
|
|
41
41
|
#
|
|
42
42
|
def survey_response_delete(params = {})
|
|
43
43
|
request = Ohmage::Request.new(self, :post, 'survey_response/delete', params)
|
|
44
44
|
request.perform
|
|
45
45
|
end
|
|
46
|
+
|
|
47
|
+
#
|
|
48
|
+
# ohmage survey/upload call
|
|
49
|
+
# @see https://github.com/ohmage/server/wiki/Survey-Manipulation#surveyUpload
|
|
50
|
+
# @returns nil
|
|
51
|
+
#
|
|
52
|
+
def survey_upload(params = {})
|
|
53
|
+
# loop around params, finding attached images/files, set them as form data.
|
|
54
|
+
params.each do |param|
|
|
55
|
+
if /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/.match(param.first)
|
|
56
|
+
@mime_type = /[^;]*/.match(`file -b --mime "#{param[1]}"`)[0]
|
|
57
|
+
params[param[0]] = HTTP::FormData::File.new(param[1], mime_type: @mime_type)
|
|
58
|
+
end
|
|
59
|
+
next
|
|
60
|
+
end
|
|
61
|
+
p params
|
|
62
|
+
request = Ohmage::Request.new(self, :post, 'survey/upload', params)
|
|
63
|
+
request.perform
|
|
64
|
+
end
|
|
46
65
|
end
|
|
47
66
|
end
|
|
48
67
|
end
|
data/lib/ohmage/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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.13
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Steve Nolen
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-06-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|