Browse files

documented example.rb and README

made TestServer open ie on windows

git-svn-id: svn:// 5e59f7e3-561f-4167-93e6-46889eec4fca
  • Loading branch information...
1 parent ff157b5 commit 153fedb0c774e033021512d8ec1bab0571c3b671 dannycoates committed Jun 7, 2008
Showing with 64 additions and 4 deletions.
  1. +17 −1 README
  2. +34 −1 bin/example.rb
  3. +1 −1 nbproject/private/
  4. +1 −0 nbproject/
  5. +1 −0 nbproject/project.xml
  6. +10 −1 spec/support/test_server.rb
@@ -1,3 +1,19 @@
== HealthVaultRubyLib
-You should document your project here.
+Please refer to bin/example.rb as a quick introduction.
+The RDoc documentation provides basic but helpful api specifications for the
+generated HealthVault classes.
+When using as a gem:
+require 'healthvault'
+- PFX certificates do not load properly on Windows, they must be a pem
+- TestServer doesn't open a browser on Windows when running with JRuby
+- Validation of SimpleTypes and ComplexTypes is not implemented
+- All XSD base types including numbers (like 'int') are represented as String
+- HealthVault 'versions' of Things and Methods are not supported
+- When parsing a response that is defined to contain 'any' value, the parser
+ will only try to guess if its a Thing, otherwise it will skip
@@ -3,29 +3,62 @@
require File.dirname(__FILE__) + "/../spec/support/test_server"
include HealthVault
+#The first thing we should do is set our Configuration.
+#This example uses the defaults from config.rb, so nothing needs to be done
+#To make changes follow this commented example:
+#Configuration.instance.app_id = "05a059c9-c309-46af-9b86-b06d42510550"
+#Configuration.instance.logger = RAILS_DEFAULT_LOGGER
+#Then we need an Application.
+#Application.default will use settings from Configuration,
+#or you can use to use other parameters
app = Application.default
+#Once we have an Application, we can create Connections.
+#A connection contains the session_token and shared_secret
+#for maintaining a session with HealthVault. It can also hold
+#the user_auth_token of a HealthVault user, and it can be serialized
+#and saved for later, for instance, in a Rails session
connection = app.create_connection
+#Authenticating a connection creates a shared_secret and session_token
+#with HealthVault using the and certificate as credentials.
+#Most useful HealthVault methods require an authenticated connection.
puts 'authenticated application...'
+#Requests are used to communicate with HealthVault.
+#They are created with Request.create passing in the name of the method,
+#and the connection. Depending on the method, additional info may be required
+#before sending the request.
request = Request.create("GetVocabulary", connection) =[0].name = "thing-types"[0].family = "wc"[0].version = '1' = 'true'
+#the return value of request.send is a Response object if the request succeeds,
+#otherwise a StandardError is raised.
result = request.send
puts 'got thing-type vocabulary...'
+#The TestServer allows us to authenticate a user through the browser.
+#It should not be used for anything but testing.
t =
+#We set the user_auth_token of connection. Now we can make requests that require
+#the user to be logged in.
connection.user_auth_token = t.auth_token
+#now that the user is logged in, we can get their info
request = Request.create("GetPersonInfo", connection)
result = request.send
+#selected_record_id is an important field used by many HealthVault methods.
+#Once we have it, it should be added to our Request.header.record_id on
+#future requests like GetThings, PutThings, etc.
record_id =
puts 'got person info for...'
@@ -1 +1 @@
@@ -4,5 +4,6 @@
@@ -5,6 +5,7 @@
<data xmlns="">
+ <root id="src.bin.dir"/>
<root id="src.dir"/>
@@ -1,3 +1,6 @@
+if RUBY_PLATFORM =~ /(:?mswin|mingw)/ #TODO: what about jruby?
+ require 'win32ole'
require 'cgi'
require 'webrick'
require 'thread'
@@ -27,7 +30,13 @@ def wait_for_auth
def open_login
- system("open","")
+ if RUBY_PLATFORM =~ /(:?mswin|mingw)/
+ ie ='InternetExplorer.Application')
+ ie.visible = true
+ ie.navigate("")
+ else
+ system("open","")
+ end

0 comments on commit 153fedb

Please sign in to comment.