two_net 0.1.0 → 0.1.1
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/two_net/version.rb +1 -1
- data/lib/two_net.rb +39 -39
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b5e75a2ff5c3d8e4f06c32008fe7bf09593e5f29
|
|
4
|
+
data.tar.gz: 2ceaf113a70de8e3a743173b035af2159c274800
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 62bf7d9714e856b3ecdd5289dda2160d0e491b05f048a54d6ebb8dcdc5eac8f3ffa74d34f9e430f68df3db91f1bd46881e9e1b5928f687e0568a4cca9d67dc58
|
|
7
|
+
data.tar.gz: 1108421bc4af47f699b3f0674ee1637a21f4187c8a0da7e9570632b5a792649f84a2c4b3f1c555a48724b71b0d5063e2427fe13420ae809bae16efd59c891bcd
|
data/lib/two_net/version.rb
CHANGED
data/lib/two_net.rb
CHANGED
|
@@ -22,37 +22,37 @@ class Client
|
|
|
22
22
|
@error = nil
|
|
23
23
|
end
|
|
24
24
|
def self.register_user(guid)
|
|
25
|
-
response = Client.post('/partner/register', :body=>{:guid=>guid }.to_xml(:root=>:registerRequest))
|
|
25
|
+
response = TwoNet::Client.post('/partner/register', :body=>{:guid=>guid }.to_xml(:root=>:registerRequest))
|
|
26
26
|
return false if @error = response["errorStatus"].blank? == false
|
|
27
27
|
return response["trackGuidsResponse"]["status"]["code"] == "1"
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def self.delete_user(guid)
|
|
31
|
-
response = Client.delete("/partner/user/delete/#{guid}")
|
|
31
|
+
response = TwoNet::Client.delete("/partner/user/delete/#{guid}")
|
|
32
32
|
return false if @error = response["errorStatus"].blank? == false
|
|
33
33
|
return check_status_response response
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def self.user_exists?(guid)
|
|
37
|
-
response = Client.get("/partner/user/exists/#{guid}")
|
|
37
|
+
response = TwoNet::Client.get("/partner/user/exists/#{guid}")
|
|
38
38
|
return check_status_response response
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
#return array
|
|
42
42
|
def self.get_guids()
|
|
43
|
-
audit_response = Client.get('/partner/audit/guids')
|
|
43
|
+
audit_response = TwoNet::Client.get('/partner/audit/guids')
|
|
44
44
|
return nil if audit_response["auditResponse"]["status"]["code"] != "1"
|
|
45
45
|
return audit_response["auditResponse"]["guids"]["guid"]
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
def self.user_track_details(guid)
|
|
49
|
-
response = Client.get("/partner/user/tracks/details/#{guid}")
|
|
49
|
+
response = TwoNet::Client.get("/partner/user/tracks/details/#{guid}")
|
|
50
50
|
return check_user_track_details_response response
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
## TODO clean up the hash that arrives back
|
|
54
54
|
def self.list_all_sensors(guid)
|
|
55
|
-
response = TwoNet.get("/partner/user/tracks/registerable/#{guid}")
|
|
55
|
+
response = TwoNet::Client.get("/partner/user/tracks/registerable/#{guid}")
|
|
56
56
|
response["trackRegistrationTemplateResponse"]
|
|
57
57
|
end
|
|
58
58
|
|
|
@@ -71,7 +71,7 @@ class Client
|
|
|
71
71
|
:type =>"2net",
|
|
72
72
|
:properties => properties,
|
|
73
73
|
"registerType" => "properties" }
|
|
74
|
-
response = Client.post('/partner/user/track/register',:body=>Client.trackRegistrationRequest_xml(body))
|
|
74
|
+
response = TwoNet::Client.post('/partner/user/track/register',:body=>TwoNet::Client.trackRegistrationRequest_xml(body))
|
|
75
75
|
return false if @error = response["errorStatus"].blank? == false
|
|
76
76
|
return nil if response["trackRegistrationResponse"]["status"]["code"].to_s != "1"
|
|
77
77
|
return response["trackRegistrationResponse"]["trackDetail"]["guid"]
|
|
@@ -83,15 +83,15 @@ class Client
|
|
|
83
83
|
body = {:guid=>guid,
|
|
84
84
|
:type =>type,
|
|
85
85
|
"registerType" => "oauth" }
|
|
86
|
-
response = Client.post('/partner/user/track/register',:body=>body.to_xml(:root=>'trackRegistrationRequest'))
|
|
86
|
+
response = TwoNet::Client.post('/partner/user/track/register',:body=>body.to_xml(:root=>'trackRegistrationRequest'))
|
|
87
87
|
return false if @error = response["errorStatus"].blank? == false
|
|
88
88
|
return nil if response["trackRegistrationResponse"]["status"]["code"].to_s != "1"
|
|
89
89
|
return response["trackRegistrationResponse"]["oauthAuthorizationUrl"]
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
def self.remove_sensor(guid,track_id)
|
|
93
|
-
response = Client.delete("/partner/user/track/unregister/#{guid}/#{track_id}")
|
|
94
|
-
return Client.check_status_response response
|
|
93
|
+
response = TwoNet::Client.delete("/partner/user/track/unregister/#{guid}/#{track_id}")
|
|
94
|
+
return TwoNet::Client.check_status_response response
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
def self.generate_guid()
|
|
@@ -101,8 +101,8 @@ class Client
|
|
|
101
101
|
guid = opts[:guid]
|
|
102
102
|
track_guid = opts[:track_guid]
|
|
103
103
|
#timezone = 'Canada/Atlantic'
|
|
104
|
-
body = Client.trackRequest_xml(guid: guid, track_guid: track_guid)
|
|
105
|
-
response = Client.post('/partner/user/track/latest',:body=>body)
|
|
104
|
+
body = TwoNet::Client.trackRequest_xml(guid: guid, track_guid: track_guid)
|
|
105
|
+
response = TwoNet::Client.post('/partner/user/track/latest',:body=>body)
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
def self.latest_activity(opts={})
|
|
@@ -111,7 +111,7 @@ class Client
|
|
|
111
111
|
timezone = opts[:timezone]
|
|
112
112
|
#timezone = 'Canada/Atlantic'
|
|
113
113
|
body = activityRequest_xml(guid: guid, track_guid: track_guid, timezone: timezone)
|
|
114
|
-
response = Client.post('/partner/activity/day/latest',:body=>body)
|
|
114
|
+
response = TwoNet::Client.post('/partner/activity/day/latest',:body=>body)
|
|
115
115
|
end
|
|
116
116
|
|
|
117
117
|
def self.filtered_activity(opts={})
|
|
@@ -121,10 +121,10 @@ class Client
|
|
|
121
121
|
start_date = opts[:start_date]
|
|
122
122
|
end_date = opts[:end_date]
|
|
123
123
|
|
|
124
|
-
body = Client.activityRequestFilter_xml(guid: guid, track_guid: track_guid,
|
|
124
|
+
body = TwoNet::Client.activityRequestFilter_xml(guid: guid, track_guid: track_guid,
|
|
125
125
|
start_date: start_date.to_i, end_date: end_date.to_i,
|
|
126
126
|
timezone: timezone )
|
|
127
|
-
response = Client.post('/partner/activity/filtered',:body=>body)
|
|
127
|
+
response = TwoNet::Client.post('/partner/activity/filtered',:body=>body)
|
|
128
128
|
end
|
|
129
129
|
|
|
130
130
|
def self.latest_blood(opts={})
|
|
@@ -132,7 +132,7 @@ class Client
|
|
|
132
132
|
track_guid = opts[:track_guid]
|
|
133
133
|
|
|
134
134
|
body = measureRequest_xml(guid: guid, track_guid: track_guid)
|
|
135
|
-
response = Client.post('/partner/measure/blood/latest',:body=>body)
|
|
135
|
+
response = TwoNet::Client.post('/partner/measure/blood/latest',:body=>body)
|
|
136
136
|
return nil if @error = response["measureResponse"]["status"]["code"].to_s != "1"
|
|
137
137
|
return response["measureResponse"]
|
|
138
138
|
end
|
|
@@ -142,7 +142,7 @@ class Client
|
|
|
142
142
|
track_guid = opts[:track_guid]
|
|
143
143
|
|
|
144
144
|
body = measureRequest_xml(guid: guid, track_guid: track_guid)
|
|
145
|
-
response = Client.post('/partner/measure/breath/latest',:body=>body)
|
|
145
|
+
response = TwoNet::Client.post('/partner/measure/breath/latest',:body=>body)
|
|
146
146
|
return nil if response["measureResponse"]["status"]["code"].to_s != "1"
|
|
147
147
|
return response["measureResponse"]
|
|
148
148
|
end
|
|
@@ -152,8 +152,8 @@ class Client
|
|
|
152
152
|
track_guid = opts[:track_guid]
|
|
153
153
|
timezone = opts[:timezone]
|
|
154
154
|
|
|
155
|
-
body = Client.measureRequest_xml(guid: guid, track_guid: track_guid, timezone: timezone)
|
|
156
|
-
response = Client.post('/partner/measure/body/latest',:body=>body)
|
|
155
|
+
body = TwoNet::Client.measureRequest_xml(guid: guid, track_guid: track_guid, timezone: timezone)
|
|
156
|
+
response = TwoNet::Client.post('/partner/measure/body/latest',:body=>body)
|
|
157
157
|
return nil if @error = response["measureResponse"]["status"]["code"] != "1"
|
|
158
158
|
return response["measureResponse"]
|
|
159
159
|
end
|
|
@@ -166,11 +166,11 @@ class Client
|
|
|
166
166
|
timezone = opts[:timezone]
|
|
167
167
|
|
|
168
168
|
if measurement == :blood
|
|
169
|
-
results = Client.latest_blood(guid: patient_guid,track_guid: sensor_guid)
|
|
169
|
+
results = TwoNet::Client.latest_blood(guid: patient_guid,track_guid: sensor_guid)
|
|
170
170
|
elsif measurement == :body
|
|
171
|
-
results = Client.latest_body(guid: patient_guid,track_guid: sensor_guid, timezone: timezone)
|
|
171
|
+
results = TwoNet::Client.latest_body(guid: patient_guid,track_guid: sensor_guid, timezone: timezone)
|
|
172
172
|
elsif measurement == :breath
|
|
173
|
-
results = Client.latest_breath(guid: patient_guid,track_guid: sensor_guid)
|
|
173
|
+
results = TwoNet::Client.latest_breath(guid: patient_guid,track_guid: sensor_guid)
|
|
174
174
|
end
|
|
175
175
|
return results
|
|
176
176
|
end
|
|
@@ -182,11 +182,11 @@ class Client
|
|
|
182
182
|
timezone = opts[:timezone]
|
|
183
183
|
results = Hash.new
|
|
184
184
|
|
|
185
|
-
results["blood"] = Client.latest_blood(guid: patient_guid,track_guid: sensor_guid)
|
|
185
|
+
results["blood"] = TwoNet::Client.latest_blood(guid: patient_guid,track_guid: sensor_guid)
|
|
186
186
|
|
|
187
|
-
results["body"] = Client.latest_body(guid: patient_guid,track_guid: sensor_guid, timezone: timezone)
|
|
187
|
+
results["body"] = TwoNet::Client.latest_body(guid: patient_guid,track_guid: sensor_guid, timezone: timezone)
|
|
188
188
|
|
|
189
|
-
results["breath"] = Client.latest_breath(guid: patient_guid,track_guid: sensor_guid)
|
|
189
|
+
results["breath"] = TwoNet::Client.latest_breath(guid: patient_guid,track_guid: sensor_guid)
|
|
190
190
|
|
|
191
191
|
return results
|
|
192
192
|
end
|
|
@@ -199,15 +199,15 @@ class Client
|
|
|
199
199
|
end_date = opts[:end_date]
|
|
200
200
|
timezone = opts[:timezone]
|
|
201
201
|
|
|
202
|
-
body = Client.measureRequest_xml(guid: guid, track_guid: track_guid, timezone: timezone, start_date: start_date, end_date: end_date)
|
|
202
|
+
body = TwoNet::Client.measureRequest_xml(guid: guid, track_guid: track_guid, timezone: timezone, start_date: start_date, end_date: end_date)
|
|
203
203
|
if measurement == "blood"
|
|
204
|
-
response = Client.post('/partner/measure/blood/filtered', :body=>body)
|
|
204
|
+
response = TwoNet::Client.post('/partner/measure/blood/filtered', :body=>body)
|
|
205
205
|
elsif measurement == "body"
|
|
206
|
-
response = Client.post('/partner/measure/body/filtered', :body=>body)
|
|
206
|
+
response = TwoNet::Client.post('/partner/measure/body/filtered', :body=>body)
|
|
207
207
|
elsif measurement == "breath"
|
|
208
|
-
response = Client.post('/partner/measure/breath/filtered',:body=>body)
|
|
208
|
+
response = TwoNet::Client.post('/partner/measure/breath/filtered',:body=>body)
|
|
209
209
|
elsif measurement == "activity"
|
|
210
|
-
response = Client.post('/partner/measure/activity/filtered',:body=>body)
|
|
210
|
+
response = TwoNet::Client.post('/partner/measure/activity/filtered',:body=>body)
|
|
211
211
|
end
|
|
212
212
|
|
|
213
213
|
return nil if response["measureResponse"]["status"]["code"] != "1"
|
|
@@ -223,13 +223,13 @@ class Client
|
|
|
223
223
|
timezone = opts[:timezone]
|
|
224
224
|
responses = Hash.new
|
|
225
225
|
|
|
226
|
-
body = Client.measureRequest_xml(guid: guid, track_guid: track_guid, timezone: timezone, start_date: start_date, end_date: end_date)
|
|
226
|
+
body = TwoNet::Client.measureRequest_xml(guid: guid, track_guid: track_guid, timezone: timezone, start_date: start_date, end_date: end_date)
|
|
227
227
|
|
|
228
|
-
responses["blood"] = Client.post('/partner/measure/blood/filtered', :body=>body)
|
|
228
|
+
responses["blood"] = TwoNet::Client.post('/partner/measure/blood/filtered', :body=>body)
|
|
229
229
|
|
|
230
|
-
responses["body"] = Client.post('/partner/measure/body/filtered', :body=>body)
|
|
230
|
+
responses["body"] = TwoNet::Client.post('/partner/measure/body/filtered', :body=>body)
|
|
231
231
|
|
|
232
|
-
responses["breath"] = Client.post('/partner/measure/breath/filtered',:body=>body)
|
|
232
|
+
responses["breath"] = TwoNet::Client.post('/partner/measure/breath/filtered',:body=>body)
|
|
233
233
|
|
|
234
234
|
|
|
235
235
|
|
|
@@ -402,7 +402,7 @@ class Client
|
|
|
402
402
|
:type =>"2net",
|
|
403
403
|
:properties => properties,
|
|
404
404
|
"registerType" => "properties" }
|
|
405
|
-
response = Client.post('/partner/user/track/register',:body=>TwoNet.trackRegistrationRequest_xml(body))
|
|
405
|
+
response = TwoNet::Client.post('/partner/user/track/register',:body=>TwoNet::Client.trackRegistrationRequest_xml(body))
|
|
406
406
|
return false if response["errorStatus"].blank? == false
|
|
407
407
|
return nil if response["trackRegistrationResponse"]["status"]["code"].to_s != "1"
|
|
408
408
|
return response["trackRegistrationResponse"]["trackDetail"]["guid"]
|
|
@@ -414,7 +414,7 @@ class Client
|
|
|
414
414
|
|
|
415
415
|
track_detail = track_details["trackDetail"]
|
|
416
416
|
return [] if track_detail.blank?
|
|
417
|
-
track_detail = Client.arrayify(track_detail)
|
|
417
|
+
track_detail = TwoNet::Client.arrayify(track_detail)
|
|
418
418
|
track_detail.each do |track_detail|
|
|
419
419
|
h[ track_detail["guid"] ] = track_detail["properties"]
|
|
420
420
|
end
|
|
@@ -422,11 +422,11 @@ class Client
|
|
|
422
422
|
end
|
|
423
423
|
|
|
424
424
|
def print_uid_sensors(guids = nil)
|
|
425
|
-
guids = Client.get_guids() if guids == nil
|
|
426
|
-
guids= Client.arrayify(guids)
|
|
425
|
+
guids = TwoNet::Client.get_guids() if guids == nil
|
|
426
|
+
guids= TwoNet::Client.arrayify(guids)
|
|
427
427
|
h = Hash.new
|
|
428
428
|
guids.each do |guid|
|
|
429
|
-
results = Client.user_track_details(guid)
|
|
429
|
+
results = TwoNet::Client.user_track_details(guid)
|
|
430
430
|
h[guid] = compress_track(results)
|
|
431
431
|
end
|
|
432
432
|
return h
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: two_net
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Justin Evaniew
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-06-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
117
117
|
version: '0'
|
|
118
118
|
requirements: []
|
|
119
119
|
rubyforge_project:
|
|
120
|
-
rubygems_version: 2.0.
|
|
120
|
+
rubygems_version: 2.0.14
|
|
121
121
|
signing_key:
|
|
122
122
|
specification_version: 4
|
|
123
123
|
summary: Connect to Qualcomm 2Net.
|