rubyhealthvault 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +52 -0
- data/README +19 -0
- data/Rakefile +149 -0
- data/bin/certs/HelloWorld-SDK_ID-05a059c9-c309-46af-9b86-b06d42510550.pfx +0 -0
- data/bin/certs/helloWorld.pem +52 -0
- data/bin/example.rb +80 -0
- data/bin/hv.log +118 -0
- data/lib/application.rb +37 -0
- data/lib/code_generation/xsd_parser.rb +376 -0
- data/lib/config.rb +28 -0
- data/lib/connection.rb +61 -0
- data/lib/healthvault.rb +2 -0
- data/lib/request.rb +113 -0
- data/lib/response.rb +50 -0
- data/lib/templates/complex_type_template.erb +64 -0
- data/lib/templates/simple_type_template.erb +65 -0
- data/lib/templates/thing_class_extension_template.erb +22 -0
- data/lib/utils/crypto_utils.rb +69 -0
- data/lib/utils/string_utils.rb +35 -0
- data/lib/wc_data/complex_type.rb +249 -0
- data/lib/wc_data/generated/application/app.rb +217 -0
- data/lib/wc_data/generated/application/app_id_and_incr_auth.rb +118 -0
- data/lib/wc_data/generated/application/app_large_logo.rb +56 -0
- data/lib/wc_data/generated/application/app_large_logo_info.rb +66 -0
- data/lib/wc_data/generated/application/app_persistent_tokens.rb +64 -0
- data/lib/wc_data/generated/application/app_small_logo.rb +56 -0
- data/lib/wc_data/generated/application/app_small_logo_info.rb +66 -0
- data/lib/wc_data/generated/application/app_with_logos.rb +291 -0
- data/lib/wc_data/generated/application/public_key.rb +43 -0
- data/lib/wc_data/generated/application/public_keys.rb +48 -0
- data/lib/wc_data/generated/application/statement.rb +30 -0
- data/lib/wc_data/generated/application/statement_info.rb +66 -0
- data/lib/wc_data/generated/auth/app_record_auth_action.rb +61 -0
- data/lib/wc_data/generated/auth/associated_cred_info.rb +70 -0
- data/lib/wc_data/generated/auth/auth.rb +44 -0
- data/lib/wc_data/generated/auth/auth_session_credential.rb +68 -0
- data/lib/wc_data/generated/auth/auth_session_sub_credential.rb +45 -0
- data/lib/wc_data/generated/auth/auth_xml.rb +44 -0
- data/lib/wc_data/generated/auth/federating_cred.rb +48 -0
- data/lib/wc_data/generated/auth/rule.rb +187 -0
- data/lib/wc_data/generated/auth/rules.rb +48 -0
- data/lib/wc_data/generated/auth/set.rb +70 -0
- data/lib/wc_data/generated/auth/simple_card_space_credential.rb +48 -0
- data/lib/wc_data/generated/auth/simple_passport_credential.rb +47 -0
- data/lib/wc_data/generated/auth/simple_user_pass_credential.rb +48 -0
- data/lib/wc_data/generated/auth/textual_permissions.rb +66 -0
- data/lib/wc_data/generated/auth/textual_permissions_type.rb +81 -0
- data/lib/wc_data/generated/auth/textual_rule.rb +154 -0
- data/lib/wc_data/generated/auth/token.rb +90 -0
- data/lib/wc_data/generated/auth/user_pass_auth_session_cred.rb +92 -0
- data/lib/wc_data/generated/auth/user_pass_cred.rb +70 -0
- data/lib/wc_data/generated/dates/approx_date.rb +82 -0
- data/lib/wc_data/generated/dates/approx_date_time.rb +62 -0
- data/lib/wc_data/generated/dates/date.rb +86 -0
- data/lib/wc_data/generated/dates/date_time.rb +82 -0
- data/lib/wc_data/generated/dates/day.rb +56 -0
- data/lib/wc_data/generated/dates/hour.rb +56 -0
- data/lib/wc_data/generated/dates/millisecond.rb +56 -0
- data/lib/wc_data/generated/dates/minute.rb +56 -0
- data/lib/wc_data/generated/dates/month.rb +56 -0
- data/lib/wc_data/generated/dates/second.rb +56 -0
- data/lib/wc_data/generated/dates/structured_approx_date.rb +82 -0
- data/lib/wc_data/generated/dates/time.rb +102 -0
- data/lib/wc_data/generated/dates/year.rb +56 -0
- data/lib/wc_data/generated/methods/add_application/info.rb +375 -0
- data/lib/wc_data/generated/methods/create_authenticated_session_token/auth_token_info.rb +72 -0
- data/lib/wc_data/generated/methods/create_authenticated_session_token/credential.rb +88 -0
- data/lib/wc_data/generated/methods/create_authenticated_session_token/info.rb +50 -0
- data/lib/wc_data/generated/methods/create_connect_request/info.rb +136 -0
- data/lib/wc_data/generated/methods/delete_open_query/info.rb +50 -0
- data/lib/wc_data/generated/methods/delete_pending_connect_request/info.rb +49 -0
- data/lib/wc_data/generated/methods/get_authorized_connect_requests/info.rb +48 -0
- data/lib/wc_data/generated/methods/get_authorized_records/info.rb +52 -0
- data/lib/wc_data/generated/methods/get_open_query_info/info.rb +50 -0
- data/lib/wc_data/generated/methods/get_person_info/info.rb +48 -0
- data/lib/wc_data/generated/methods/get_thing_type/info.rb +118 -0
- data/lib/wc_data/generated/methods/get_thing_type/thing_type_section_spec.rb +63 -0
- data/lib/wc_data/generated/methods/get_things/info.rb +51 -0
- data/lib/wc_data/generated/methods/get_things/thing_filter_spec.rb +296 -0
- data/lib/wc_data/generated/methods/get_things/thing_format_spec.rb +75 -0
- data/lib/wc_data/generated/methods/get_things/thing_request_group.rb +197 -0
- data/lib/wc_data/generated/methods/get_things/thing_section_spec.rb +67 -0
- data/lib/wc_data/generated/methods/get_vocabulary/info.rb +48 -0
- data/lib/wc_data/generated/methods/get_vocabulary/vocabulary_parameters.rb +73 -0
- data/lib/wc_data/generated/methods/put_things/info.rb +51 -0
- data/lib/wc_data/generated/methods/query_permissions/info.rb +51 -0
- data/lib/wc_data/generated/methods/remove_things/info.rb +52 -0
- data/lib/wc_data/generated/methods/response/add_application/info.rb +51 -0
- data/lib/wc_data/generated/methods/response/any/info.rb +52 -0
- data/lib/wc_data/generated/methods/response/create_authenticated_session_token/app_auth_token_absence_reason.rb +72 -0
- data/lib/wc_data/generated/methods/response/create_authenticated_session_token/auth_token_absence_reason.rb +49 -0
- data/lib/wc_data/generated/methods/response/create_authenticated_session_token/info.rb +78 -0
- data/lib/wc_data/generated/methods/response/create_connect_request/info.rb +52 -0
- data/lib/wc_data/generated/methods/response/delete_open_query/info.rb +52 -0
- data/lib/wc_data/generated/methods/response/get_application_settings/app_settings.rb +54 -0
- data/lib/wc_data/generated/methods/response/get_application_settings/info.rb +70 -0
- data/lib/wc_data/generated/methods/response/get_authorized_connect_requests/connect_request.rb +114 -0
- data/lib/wc_data/generated/methods/response/get_authorized_connect_requests/info.rb +72 -0
- data/lib/wc_data/generated/methods/response/get_authorized_records/info.rb +53 -0
- data/lib/wc_data/generated/methods/response/get_people_for_record/info.rb +76 -0
- data/lib/wc_data/generated/methods/response/get_person_info/info.rb +52 -0
- data/lib/wc_data/generated/methods/response/get_service_definition/configuration_entry.rb +71 -0
- data/lib/wc_data/generated/methods/response/get_service_definition/info.rb +141 -0
- data/lib/wc_data/generated/methods/response/get_service_definition/platform.rb +98 -0
- data/lib/wc_data/generated/methods/response/get_service_definition/sdk_assembly.rb +94 -0
- data/lib/wc_data/generated/methods/response/get_service_definition/shell.rb +95 -0
- data/lib/wc_data/generated/methods/response/get_service_definition/shell_redirect_token.rb +93 -0
- data/lib/wc_data/generated/methods/response/get_service_definition/xml_method.rb +75 -0
- data/lib/wc_data/generated/methods/response/get_service_definition/xml_method_version.rb +92 -0
- data/lib/wc_data/generated/methods/response/get_thing_type/column.rb +130 -0
- data/lib/wc_data/generated/methods/response/get_thing_type/columns.rb +52 -0
- data/lib/wc_data/generated/methods/response/get_thing_type/image.rb +71 -0
- data/lib/wc_data/generated/methods/response/get_thing_type/info.rb +53 -0
- data/lib/wc_data/generated/methods/response/get_thing_type/thing_type_info.rb +232 -0
- data/lib/wc_data/generated/methods/response/get_thing_type/transform_source.rb +72 -0
- data/lib/wc_data/generated/methods/response/get_thing_type/transforms.rb +52 -0
- data/lib/wc_data/generated/methods/response/get_things/info.rb +54 -0
- data/lib/wc_data/generated/methods/response/get_things/thing_response_group.rb +118 -0
- data/lib/wc_data/generated/methods/response/get_things/unprocessed_thing_key_info.rb +95 -0
- data/lib/wc_data/generated/methods/response/get_vocabulary/info.rb +76 -0
- data/lib/wc_data/generated/methods/response/put_things/info.rb +53 -0
- data/lib/wc_data/generated/methods/response/query_permissions/info.rb +54 -0
- data/lib/wc_data/generated/methods/response/query_permissions/permissions.rb +53 -0
- data/lib/wc_data/generated/methods/response/query_permissions/thing_type_permission.rb +89 -0
- data/lib/wc_data/generated/methods/response/search_vocabulary/info.rb +74 -0
- data/lib/wc_data/generated/methods/save_open_query/info.rb +227 -0
- data/lib/wc_data/generated/methods/search_vocabulary/info.rb +70 -0
- data/lib/wc_data/generated/methods/search_vocabulary/vocabulary_search_params.rb +69 -0
- data/lib/wc_data/generated/methods/search_vocabulary/vocabulary_search_string.rb +68 -0
- data/lib/wc_data/generated/methods/send_insecure_message/info.rb +155 -0
- data/lib/wc_data/generated/methods/send_insecure_message_from_application/from_mailbox.rb +71 -0
- data/lib/wc_data/generated/methods/send_insecure_message_from_application/info.rb +178 -0
- data/lib/wc_data/generated/methods/set_application_settings/app_settings.rb +52 -0
- data/lib/wc_data/generated/methods/set_application_settings/info.rb +48 -0
- data/lib/wc_data/generated/methods/update_application/info.rb +384 -0
- data/lib/wc_data/generated/methods/update_external_id/info.rb +70 -0
- data/lib/wc_data/generated/record/active_app_authorization.rb +196 -0
- data/lib/wc_data/generated/record/active_person_authorization.rb +290 -0
- data/lib/wc_data/generated/record/active_person_authorization_no_ids.rb +250 -0
- data/lib/wc_data/generated/record/authorized_record_state.rb +53 -0
- data/lib/wc_data/generated/record/non_active_authorization.rb +340 -0
- data/lib/wc_data/generated/record/non_active_authorization_no_ids.rb +300 -0
- data/lib/wc_data/generated/request/authenticated_session_info.rb +88 -0
- data/lib/wc_data/generated/request/header.rb +274 -0
- data/lib/wc_data/generated/request/info.rb +48 -0
- data/lib/wc_data/generated/request/offline_person_info.rb +46 -0
- data/lib/wc_data/generated/request/request.rb +86 -0
- data/lib/wc_data/generated/request/xsl.rb +64 -0
- data/lib/wc_data/generated/thing/access_avenue.rb +49 -0
- data/lib/wc_data/generated/thing/aerobic/aerobic_session.rb +112 -0
- data/lib/wc_data/generated/thing/aerobic_profile/aerobic_profile.rb +153 -0
- data/lib/wc_data/generated/thing/aerobic_profile/heartrate_zone.rb +90 -0
- data/lib/wc_data/generated/thing/aerobic_profile/heartrate_zone_group.rb +72 -0
- data/lib/wc_data/generated/thing/aerobic_profile/max_vo2.rb +68 -0
- data/lib/wc_data/generated/thing/aerobic_profile/zone_boundary.rb +68 -0
- data/lib/wc_data/generated/thing/aerobic_weekly/aerobic_weekly.rb +72 -0
- data/lib/wc_data/generated/thing/allergic_episode/allergic_episode.rb +108 -0
- data/lib/wc_data/generated/thing/allergy/allergy.rb +186 -0
- data/lib/wc_data/generated/thing/annotation/annotation.rb +144 -0
- data/lib/wc_data/generated/thing/application/app_specific.rb +137 -0
- data/lib/wc_data/generated/thing/appointment/appointment.rb +166 -0
- data/lib/wc_data/generated/thing/audit.rb +150 -0
- data/lib/wc_data/generated/thing/audit_action.rb +53 -0
- data/lib/wc_data/generated/thing/basic/basic.rb +180 -0
- data/lib/wc_data/generated/thing/basic/birthyear.rb +58 -0
- data/lib/wc_data/generated/thing/basic/country.rb +45 -0
- data/lib/wc_data/generated/thing/basic/firstdow.rb +58 -0
- data/lib/wc_data/generated/thing/basic/gender.rb +51 -0
- data/lib/wc_data/generated/thing/blood_glucose/blood_glucose.rb +172 -0
- data/lib/wc_data/generated/thing/blood_pressure/blood_pressure.rb +133 -0
- data/lib/wc_data/generated/thing/cardiac_profile/cardiac_profile.rb +209 -0
- data/lib/wc_data/generated/thing/cholesterol_profile/cholesterol_profile.rb +129 -0
- data/lib/wc_data/generated/thing/common.rb +126 -0
- data/lib/wc_data/generated/thing/concern/concern.rb +71 -0
- data/lib/wc_data/generated/thing/condition/condition.rb +127 -0
- data/lib/wc_data/generated/thing/contact/contact.rb +49 -0
- data/lib/wc_data/generated/thing/contraindication/contraindication.rb +129 -0
- data/lib/wc_data/generated/thing/daily_medication_usage/daily_medication_usage.rb +218 -0
- data/lib/wc_data/generated/thing/data_other.rb +82 -0
- data/lib/wc_data/generated/thing/data_xml.rb +80 -0
- data/lib/wc_data/generated/thing/diabetic_profile/diabetic_profile.rb +92 -0
- data/lib/wc_data/generated/thing/diabetic_profile/target_glucose_zone.rb +90 -0
- data/lib/wc_data/generated/thing/diabetic_profile/target_glucose_zone_group.rb +72 -0
- data/lib/wc_data/generated/thing/diabetic_profile/zone_boundary.rb +68 -0
- data/lib/wc_data/generated/thing/dietary_intake_daily/dietary_intake_daily.rb +249 -0
- data/lib/wc_data/generated/thing/directive/directive.rb +343 -0
- data/lib/wc_data/generated/thing/discharge_summary/discharge_summary.rb +366 -0
- data/lib/wc_data/generated/thing/effective_permissions.rb +66 -0
- data/lib/wc_data/generated/thing/emotion/emotion.rb +109 -0
- data/lib/wc_data/generated/thing/encounter/encounter.rb +143 -0
- data/lib/wc_data/generated/thing/equipment/device.rb +163 -0
- data/lib/wc_data/generated/thing/extension.rb +123 -0
- data/lib/wc_data/generated/thing/family_history/family_history.rb +203 -0
- data/lib/wc_data/generated/thing/family_history_condition/family_history_condition.rb +49 -0
- data/lib/wc_data/generated/thing/family_history_person/family_history_person.rb +107 -0
- data/lib/wc_data/generated/thing/file/file.rb +90 -0
- data/lib/wc_data/generated/thing/guid_and_name.rb +66 -0
- data/lib/wc_data/generated/thing/hb_a1_c/hb_a1_c.rb +111 -0
- data/lib/wc_data/generated/thing/healthcare_proxy/healthcare_proxy.rb +144 -0
- data/lib/wc_data/generated/thing/height/height.rb +71 -0
- data/lib/wc_data/generated/thing/immunization/immunization.rb +244 -0
- data/lib/wc_data/generated/thing/inhaler/alert.rb +74 -0
- data/lib/wc_data/generated/thing/inhaler/asthma_inhaler.rb +272 -0
- data/lib/wc_data/generated/thing/inhaler/dow.rb +58 -0
- data/lib/wc_data/generated/thing/inhaler/purpose.rb +55 -0
- data/lib/wc_data/generated/thing/inhaler_use/asthma_inhaler_use.rb +152 -0
- data/lib/wc_data/generated/thing/insulin/insulin_injection.rb +93 -0
- data/lib/wc_data/generated/thing/insulin_injection_use/diabetes_insulin_injection_use.rb +114 -0
- data/lib/wc_data/generated/thing/lab_test_results/lab_test_results.rb +89 -0
- data/lib/wc_data/generated/thing/life_goal/life_goal.rb +68 -0
- data/lib/wc_data/generated/thing/link/link.rb +68 -0
- data/lib/wc_data/generated/thing/medication/dose_value.rb +107 -0
- data/lib/wc_data/generated/thing/medication/medication.rb +491 -0
- data/lib/wc_data/generated/thing/microbiology/microbiology_lab_results.rb +186 -0
- data/lib/wc_data/generated/thing/password/protected/package/algorithm_name.rb +59 -0
- data/lib/wc_data/generated/thing/password/protected/package/package_encryption_type.rb +71 -0
- data/lib/wc_data/generated/thing/password/protected/package/password_protected_package.rb +53 -0
- data/lib/wc_data/generated/thing/password/protected/package/pbe_parameters_type.rb +97 -0
- data/lib/wc_data/generated/thing/payer/payer.rb +265 -0
- data/lib/wc_data/generated/thing/personal/personal.rb +303 -0
- data/lib/wc_data/generated/thing/personal_image/personal_image.rb +28 -0
- data/lib/wc_data/generated/thing/problem/importance.rb +45 -0
- data/lib/wc_data/generated/thing/problem/problem.rb +114 -0
- data/lib/wc_data/generated/thing/procedure/procedure.rb +125 -0
- data/lib/wc_data/generated/thing/radiology_lab_results/radiology_lab_results.rb +106 -0
- data/lib/wc_data/generated/thing/related_thing.rb +88 -0
- data/lib/wc_data/generated/thing/respiratory_profile/respiratory_profile.rb +109 -0
- data/lib/wc_data/generated/thing/sjam/awakening.rb +70 -0
- data/lib/wc_data/generated/thing/sjam/sleep_am.rb +195 -0
- data/lib/wc_data/generated/thing/sjam/wake_state.rb +58 -0
- data/lib/wc_data/generated/thing/sjpm/activity.rb +70 -0
- data/lib/wc_data/generated/thing/sjpm/sleep_pm.rb +162 -0
- data/lib/wc_data/generated/thing/sjpm/sleepiness.rb +58 -0
- data/lib/wc_data/generated/thing/spirometer/spirometer.rb +317 -0
- data/lib/wc_data/generated/thing/spirometer/volume_value.rb +69 -0
- data/lib/wc_data/generated/thing/thing.rb +213 -0
- data/lib/wc_data/generated/thing/thing_key.rb +66 -0
- data/lib/wc_data/generated/thing/thing_state.rb +49 -0
- data/lib/wc_data/generated/thing/thing_type.rb +64 -0
- data/lib/wc_data/generated/thing/types/address.rb +176 -0
- data/lib/wc_data/generated/thing/types/aerobic_lap_session.rb +86 -0
- data/lib/wc_data/generated/thing/types/aerobic_session.rb +745 -0
- data/lib/wc_data/generated/thing/types/aerobic_session_samples.rb +310 -0
- data/lib/wc_data/generated/thing/types/altitude_value.rb +70 -0
- data/lib/wc_data/generated/thing/types/blood_glucose_value.rb +69 -0
- data/lib/wc_data/generated/thing/types/codable_value.rb +74 -0
- data/lib/wc_data/generated/thing/types/coded_value.rb +112 -0
- data/lib/wc_data/generated/thing/types/communication_type.rb +112 -0
- data/lib/wc_data/generated/thing/types/condition.rb +148 -0
- data/lib/wc_data/generated/thing/types/contact.rb +97 -0
- data/lib/wc_data/generated/thing/types/display_value.rb +90 -0
- data/lib/wc_data/generated/thing/types/document_reference_type.rb +112 -0
- data/lib/wc_data/generated/thing/types/double_range.rb +70 -0
- data/lib/wc_data/generated/thing/types/dow.rb +58 -0
- data/lib/wc_data/generated/thing/types/duration_value.rb +69 -0
- data/lib/wc_data/generated/thing/types/email.rb +89 -0
- data/lib/wc_data/generated/thing/types/flow_value.rb +69 -0
- data/lib/wc_data/generated/thing/types/general_measurement.rb +74 -0
- data/lib/wc_data/generated/thing/types/goal.rb +86 -0
- data/lib/wc_data/generated/thing/types/goal_status.rb +55 -0
- data/lib/wc_data/generated/thing/types/insulin_injection_value.rb +69 -0
- data/lib/wc_data/generated/thing/types/lab_result_type.rb +149 -0
- data/lib/wc_data/generated/thing/types/lab_test_result_type.rb +167 -0
- data/lib/wc_data/generated/thing/types/lab_test_result_value_type.rb +99 -0
- data/lib/wc_data/generated/thing/types/lab_test_results_group_type.rb +138 -0
- data/lib/wc_data/generated/thing/types/lab_test_type.rb +209 -0
- data/lib/wc_data/generated/thing/types/language.rb +69 -0
- data/lib/wc_data/generated/thing/types/length_value.rb +69 -0
- data/lib/wc_data/generated/thing/types/name.rb +148 -0
- data/lib/wc_data/generated/thing/types/non_negative_double.rb +45 -0
- data/lib/wc_data/generated/thing/types/one_to_five.rb +58 -0
- data/lib/wc_data/generated/thing/types/organization.rb +106 -0
- data/lib/wc_data/generated/thing/types/pace_value.rb +69 -0
- data/lib/wc_data/generated/thing/types/percentage.rb +58 -0
- data/lib/wc_data/generated/thing/types/person.rb +146 -0
- data/lib/wc_data/generated/thing/types/phone.rb +89 -0
- data/lib/wc_data/generated/thing/types/positive_double.rb +45 -0
- data/lib/wc_data/generated/thing/types/power_value.rb +69 -0
- data/lib/wc_data/generated/thing/types/sample.rb +88 -0
- data/lib/wc_data/generated/thing/types/sample_set.rb +116 -0
- data/lib/wc_data/generated/thing/types/speed_value.rb +69 -0
- data/lib/wc_data/generated/thing/types/structured_measurement.rb +71 -0
- data/lib/wc_data/generated/thing/types/temperature_value.rb +69 -0
- data/lib/wc_data/generated/thing/types/test_result_range.rb +71 -0
- data/lib/wc_data/generated/thing/types/torque_value.rb +69 -0
- data/lib/wc_data/generated/thing/types/weight_value.rb +69 -0
- data/lib/wc_data/generated/thing/vital_signs/vital_sign_result_type.rb +166 -0
- data/lib/wc_data/generated/thing/vital_signs/vital_signs.rb +110 -0
- data/lib/wc_data/generated/thing/weight/weight.rb +70 -0
- data/lib/wc_data/generated/thing/weight_goal/weight_goal.rb +106 -0
- data/lib/wc_data/generated/types/address.rb +162 -0
- data/lib/wc_data/generated/types/app_info.rb +66 -0
- data/lib/wc_data/generated/types/app_server_cred.rb +70 -0
- data/lib/wc_data/generated/types/app_server_cred_info.rb +70 -0
- data/lib/wc_data/generated/types/app_settings.rb +50 -0
- data/lib/wc_data/generated/types/base64_sha1.rb +56 -0
- data/lib/wc_data/generated/types/card_space_cred.rb +50 -0
- data/lib/wc_data/generated/types/char2.rb +56 -0
- data/lib/wc_data/generated/types/codable_value.rb +72 -0
- data/lib/wc_data/generated/types/coded_value.rb +110 -0
- data/lib/wc_data/generated/types/culture.rb +64 -0
- data/lib/wc_data/generated/types/date_range.rb +62 -0
- data/lib/wc_data/generated/types/email.rb +82 -0
- data/lib/wc_data/generated/types/email_address.rb +56 -0
- data/lib/wc_data/generated/types/gender.rb +49 -0
- data/lib/wc_data/generated/types/group.rb +91 -0
- data/lib/wc_data/generated/types/groups.rb +50 -0
- data/lib/wc_data/generated/types/guid.rb +43 -0
- data/lib/wc_data/generated/types/hash_finalized.rb +48 -0
- data/lib/wc_data/generated/types/hash_finalized_data.rb +68 -0
- data/lib/wc_data/generated/types/hmac_algorithm.rb +48 -0
- data/lib/wc_data/generated/types/hmac_algorithm_data.rb +68 -0
- data/lib/wc_data/generated/types/hmac_finalized.rb +48 -0
- data/lib/wc_data/generated/types/hmac_finalized_data.rb +68 -0
- data/lib/wc_data/generated/types/iso3166.rb +1001 -0
- data/lib/wc_data/generated/types/iso4217.rb +733 -0
- data/lib/wc_data/generated/types/iso639_1.rb +585 -0
- data/lib/wc_data/generated/types/language_competency.rb +64 -0
- data/lib/wc_data/generated/types/localized_string.rb +64 -0
- data/lib/wc_data/generated/types/login_name.rb +56 -0
- data/lib/wc_data/generated/types/name_match_type.rb +53 -0
- data/lib/wc_data/generated/types/omb_ethnicity.rb +65 -0
- data/lib/wc_data/generated/types/open_query_info.rb +149 -0
- data/lib/wc_data/generated/types/permission.rb +61 -0
- data/lib/wc_data/generated/types/person_info.rb +214 -0
- data/lib/wc_data/generated/types/phone.rb +82 -0
- data/lib/wc_data/generated/types/positive_long.rb +43 -0
- data/lib/wc_data/generated/types/puid.rb +43 -0
- data/lib/wc_data/generated/types/rcpt_address.rb +69 -0
- data/lib/wc_data/generated/types/rcpt_person.rb +68 -0
- data/lib/wc_data/generated/types/rcpt_record.rb +48 -0
- data/lib/wc_data/generated/types/record.rb +264 -0
- data/lib/wc_data/generated/types/record_state.rb +57 -0
- data/lib/wc_data/generated/types/sig.rb +112 -0
- data/lib/wc_data/generated/types/string1024.rb +56 -0
- data/lib/wc_data/generated/types/string128.rb +56 -0
- data/lib/wc_data/generated/types/string16.rb +56 -0
- data/lib/wc_data/generated/types/string255.rb +56 -0
- data/lib/wc_data/generated/types/string32.rb +56 -0
- data/lib/wc_data/generated/types/string512.rb +56 -0
- data/lib/wc_data/generated/types/string64.rb +56 -0
- data/lib/wc_data/generated/types/stringnz.rb +43 -0
- data/lib/wc_data/generated/types/stringz1024.rb +56 -0
- data/lib/wc_data/generated/types/stringz128.rb +56 -0
- data/lib/wc_data/generated/types/stringz16.rb +56 -0
- data/lib/wc_data/generated/types/stringz255.rb +56 -0
- data/lib/wc_data/generated/types/stringz32.rb +56 -0
- data/lib/wc_data/generated/types/stringz512.rb +56 -0
- data/lib/wc_data/generated/types/stringz64.rb +56 -0
- data/lib/wc_data/generated/types/url.rb +56 -0
- data/lib/wc_data/generated/types/version.rb +56 -0
- data/lib/wc_data/generated/vocab/info_xml.rb +46 -0
- data/lib/wc_data/generated/vocab/vocabulary_code_item.rb +104 -0
- data/lib/wc_data/generated/vocab/vocabulary_code_set.rb +133 -0
- data/lib/wc_data/generated/vocab/vocabulary_key.rb +106 -0
- data/lib/wc_data/generated/vocab/vocabulary_key_info.rb +26 -0
- data/lib/wc_data/init.rb +27 -0
- data/lib/wc_data/raw_info_xml.rb +12 -0
- data/lib/wc_data/simple_type.rb +16 -0
- data/lib/wc_data/thing.rb +78 -0
- data/lib/xsd/bootstrap/request.xsd +107 -0
- data/lib/xsd/bootstrap/response-getservicedefinition.xsd +119 -0
- data/lib/xsd/bootstrap/types.xsd +1117 -0
- data/lib/xsd/common/application.xsd +766 -0
- data/lib/xsd/common/auth.xsd +1093 -0
- data/lib/xsd/common/dates.xsd +510 -0
- data/lib/xsd/common/record.xsd +1160 -0
- data/lib/xsd/common/request.xsd +524 -0
- data/lib/xsd/common/thing.xsd +881 -0
- data/lib/xsd/common/types.xsd +3131 -0
- data/lib/xsd/common/vocab.xsd +359 -0
- data/lib/xsd/requests/method-addapplication.xsd +349 -0
- data/lib/xsd/requests/method-createauthenticatedsessiontoken.xsd +216 -0
- data/lib/xsd/requests/method-createconnectrequest.xsd +143 -0
- data/lib/xsd/requests/method-deleteopenquery.xsd +75 -0
- data/lib/xsd/requests/method-deletependingconnectrequest.xsd +77 -0
- data/lib/xsd/requests/method-getauthorizedconnectrequests.xsd +78 -0
- data/lib/xsd/requests/method-getauthorizedrecords.xsd +82 -0
- data/lib/xsd/requests/method-getopenqueryinfo.xsd +74 -0
- data/lib/xsd/requests/method-getpersoninfo.xsd +80 -0
- data/lib/xsd/requests/method-getthings.xsd +516 -0
- data/lib/xsd/requests/method-getthingtype.xsd +201 -0
- data/lib/xsd/requests/method-getvocabulary.xsd +135 -0
- data/lib/xsd/requests/method-putthings.xsd +80 -0
- data/lib/xsd/requests/method-querypermissions.xsd +79 -0
- data/lib/xsd/requests/method-removethings.xsd +78 -0
- data/lib/xsd/requests/method-saveopenquery.xsd +219 -0
- data/lib/xsd/requests/method-searchvocabulary.xsd +222 -0
- data/lib/xsd/requests/method-sendinsecuremessage.xsd +185 -0
- data/lib/xsd/requests/method-sendinsecuremessagefromapplication.xsd +274 -0
- data/lib/xsd/requests/method-setapplicationsettings.xsd +166 -0
- data/lib/xsd/requests/method-updateapplication.xsd +357 -0
- data/lib/xsd/requests/method-updateexternalid.xsd +84 -0
- data/lib/xsd/responses/response-addapplication.xsd +79 -0
- data/lib/xsd/responses/response-any.xsd +59 -0
- data/lib/xsd/responses/response-createauthenticatedsessiontoken.xsd +167 -0
- data/lib/xsd/responses/response-createconnectrequest.xsd +88 -0
- data/lib/xsd/responses/response-deleteopenquery.xsd +87 -0
- data/lib/xsd/responses/response-getapplicationsettings.xsd +192 -0
- data/lib/xsd/responses/response-getauthorizedconnectrequests.xsd +135 -0
- data/lib/xsd/responses/response-getauthorizedrecords.xsd +76 -0
- data/lib/xsd/responses/response-getopenqueryinfo.xsd +64 -0
- data/lib/xsd/responses/response-getpeopleforrecord.xsd +95 -0
- data/lib/xsd/responses/response-getpersoninfo.xsd +87 -0
- data/lib/xsd/responses/response-getservicedefinition.xsd +515 -0
- data/lib/xsd/responses/response-getthings.xsd +198 -0
- data/lib/xsd/responses/response-getthingtype.xsd +457 -0
- data/lib/xsd/responses/response-getvocabulary.xsd +93 -0
- data/lib/xsd/responses/response-putthings.xsd +63 -0
- data/lib/xsd/responses/response-querypermissions.xsd +182 -0
- data/lib/xsd/responses/response-saveopenquery.xsd +62 -0
- data/lib/xsd/responses/response-searchvocabulary.xsd +90 -0
- data/lib/xsd/things/Advance Directive.xsd +60 -0
- data/lib/xsd/things/Aerobic Exercise Session.xsd +19 -0
- data/lib/xsd/things/Aerobic Profile.xsd +143 -0
- data/lib/xsd/things/Allergic Episode.xsd +17 -0
- data/lib/xsd/things/Allergy.xsd +39 -0
- data/lib/xsd/things/Application-Specific Information.xsd +42 -0
- data/lib/xsd/things/Appointment.xsd +24 -0
- data/lib/xsd/things/Asthma Inhaler Usage.xsd +44 -0
- data/lib/xsd/things/Asthma Inhaler.xsd +99 -0
- data/lib/xsd/things/Base Thing Type.xsd +1000 -0
- data/lib/xsd/things/Basic Demographic Information.xsd +49 -0
- data/lib/xsd/things/Blood Glucose Measurement.xsd +28 -0
- data/lib/xsd/things/Blood Pressure Measurement.xsd +30 -0
- data/lib/xsd/things/Cardiac Profile.xsd +80 -0
- data/lib/xsd/things/Cholesterol Profile (Lipid Profile).xsd +38 -0
- data/lib/xsd/things/Concern.xsd +17 -0
- data/lib/xsd/things/Condition.xsd +28 -0
- data/lib/xsd/things/Continuity of Care Record.xsd +3 -0
- data/lib/xsd/things/Contraindication.xsd +27 -0
- data/lib/xsd/things/Daily Dietary Intake.xsd +51 -0
- data/lib/xsd/things/Daily Medication Usage.xsd +41 -0
- data/lib/xsd/things/Device.xsd +24 -0
- data/lib/xsd/things/Diabetes Insulin Injection Use.xsd +26 -0
- data/lib/xsd/things/Diabetic Profile.xsd +92 -0
- data/lib/xsd/things/Discharge Summary.xsd +43 -0
- data/lib/xsd/things/Emergency or Provider Contact.xsd +11 -0
- data/lib/xsd/things/Emotional State.xsd +24 -0
- data/lib/xsd/things/Encounter (old).xsd +21 -0
- data/lib/xsd/things/Encounter.xsd +19 -0
- data/lib/xsd/things/Family History Condition.xsd +12 -0
- data/lib/xsd/things/Family History Person.xsd +18 -0
- data/lib/xsd/things/Family History.xsd +27 -0
- data/lib/xsd/things/File.xsd +28 -0
- data/lib/xsd/things/HL7 Continuity of Care Document.xsd +33 -0
- data/lib/xsd/things/HbA1C Measurement.xsd +23 -0
- data/lib/xsd/things/Healthcare Proxy.xsd +21 -0
- data/lib/xsd/things/Height Measurement.xsd +13 -0
- data/lib/xsd/things/Immunization.xsd +32 -0
- data/lib/xsd/things/Insulin Injection.xsd +30 -0
- data/lib/xsd/things/Insurance Plan.xsd +46 -0
- data/lib/xsd/things/Lab Test Result.xsd +11 -0
- data/lib/xsd/things/Life Goal.xsd +19 -0
- data/lib/xsd/things/Link.xsd +12 -0
- data/lib/xsd/things/Medical Annotation.xsd +21 -0
- data/lib/xsd/things/Medical Problem.xsd +15 -0
- data/lib/xsd/things/Medication.xsd +82 -0
- data/lib/xsd/things/Microbiology Lab Test Result.xsd +25 -0
- data/lib/xsd/things/Password Protected Package.xsd +23 -0
- data/lib/xsd/things/Personal Contact Information.xsd +18 -0
- data/lib/xsd/things/Personal Demographic Information.xsd +63 -0
- data/lib/xsd/things/Personal Image.xsd +13 -0
- data/lib/xsd/things/Procedure.xsd +19 -0
- data/lib/xsd/things/Radiology Lab Result.xsd +19 -0
- data/lib/xsd/things/Respiratory Profile.xsd +33 -0
- data/lib/xsd/things/Sleep Related Activity.xsd +45 -0
- data/lib/xsd/things/Sleep Session.xsd +51 -0
- data/lib/xsd/things/Spirometer Measurement.xsd +113 -0
- data/lib/xsd/things/Vital Signs.xsd +31 -0
- data/lib/xsd/things/Weekly Aerobic Exercise Goal.xsd +25 -0
- data/lib/xsd/things/Weight Goal.xsd +33 -0
- data/lib/xsd/things/Weight Measurement.xsd +10 -0
- data/spec/connection_spec.rb +17 -0
- data/spec/request_spec.rb +42 -0
- data/spec/support/test_server.rb +42 -0
- metadata +646 -0
data/lib/healthvault.rb
ADDED
data/lib/request.rb
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#--
|
3
|
+
# Copyright 2008 Danny Coates, Ashkan Farhadtouski
|
4
|
+
# All rights reserved.
|
5
|
+
# See LICENSE for permissions.
|
6
|
+
#++
|
7
|
+
|
8
|
+
require 'rexml/document'
|
9
|
+
require 'date'
|
10
|
+
require File.dirname(__FILE__) + '/utils/string_utils'
|
11
|
+
require File.dirname(__FILE__) + '/wc_data/init'
|
12
|
+
|
13
|
+
# HealtVault doesn't adhere to valid xml standards.
|
14
|
+
# Attribute values must be in double quotes to be parseable
|
15
|
+
# So we redefine REXML::Attribute.to_string to accommodate
|
16
|
+
REXML::Attribute.class_eval {def to_string() "#@expanded_name=\"#{to_s().gsub(/"/, '"')}\"" end}
|
17
|
+
|
18
|
+
module HealthVault
|
19
|
+
class Request < HealthVault::WCData::ComplexType
|
20
|
+
include WCData
|
21
|
+
include REXML
|
22
|
+
include StringUtils
|
23
|
+
|
24
|
+
# HealthVault::WCData::Types::HMACFinalized
|
25
|
+
def auth=(value)
|
26
|
+
@children['auth'][:value] = value
|
27
|
+
end
|
28
|
+
|
29
|
+
def auth
|
30
|
+
return @children['auth'][:value]
|
31
|
+
end
|
32
|
+
|
33
|
+
# HealthVault::WCData::Request::Header
|
34
|
+
def header=(value)
|
35
|
+
@children['header'][:value] = value
|
36
|
+
end
|
37
|
+
|
38
|
+
def header
|
39
|
+
return @children['header'][:value]
|
40
|
+
end
|
41
|
+
|
42
|
+
# HealthVault::WCData::Request::Info
|
43
|
+
def info=(value)
|
44
|
+
@children['info'][:value] = value
|
45
|
+
end
|
46
|
+
|
47
|
+
def info
|
48
|
+
return @children['info'][:value]
|
49
|
+
end
|
50
|
+
|
51
|
+
def initialize(connection)
|
52
|
+
super()
|
53
|
+
@connection = connection
|
54
|
+
@children['auth'] = {:name => 'auth', :class => HealthVault::WCData::Types::HMACFinalized, :value => nil, :min => 0, :max => 1, :order => 1, :place => :element }
|
55
|
+
@children['header'] = {:name => 'header', :class => HealthVault::WCData::Request::Header, :value => nil, :min => 1, :max => 1, :order => 2, :place => :element }
|
56
|
+
@children['header'][:value] = WCData::Request::Header.new
|
57
|
+
@children['info'] = {:name => 'info', :class => HealthVault::WCData::Request::Info, :value => nil, :min => 1, :max => 1, :order => 3, :place => :element }
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.create(method_name, connection)
|
61
|
+
request = Request.new(connection)
|
62
|
+
request.header.method = method_name
|
63
|
+
request.header.method_version = "1"
|
64
|
+
request.header.language = "en"
|
65
|
+
request.header.country = "US"
|
66
|
+
request.header.msg_time = DateTime.now
|
67
|
+
request.header.msg_ttl = 29100
|
68
|
+
request.header.version = "0.0.0.1"
|
69
|
+
request.info = request.new_request_info
|
70
|
+
return request
|
71
|
+
end
|
72
|
+
|
73
|
+
def new_request_info
|
74
|
+
begin
|
75
|
+
class_new = "HealthVault::WCData::Methods::#{header.method}::Info.new"
|
76
|
+
return eval(class_new)
|
77
|
+
rescue
|
78
|
+
Configuration.instance.logger.error "No Info class for #{header.method}"
|
79
|
+
return HealthVault::WCData::RawInfoXml.new
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def element
|
84
|
+
e = Element.new('wc-request:request')
|
85
|
+
e.add_namespace("wc-request", "urn:com.microsoft.wc.request")
|
86
|
+
super(e)
|
87
|
+
end
|
88
|
+
|
89
|
+
def send
|
90
|
+
if @connection.authenticated?
|
91
|
+
header.info_hash = Types::HashFinalized.new
|
92
|
+
header.info_hash.hash_data = Types::HashFinalizedData.new
|
93
|
+
header.info_hash.hash_data.alg_name = "SHA1"
|
94
|
+
header.info_hash.hash_data.data = CryptoUtils.encode64(CryptoUtils.digest(info.element.to_s))
|
95
|
+
header.auth_session = WCData::Request::AuthenticatedSessionInfo.new
|
96
|
+
header.auth_session.auth_token = @connection.session_token
|
97
|
+
header.auth_session.user_auth_token = @connection.user_auth_token #or offline_person_info
|
98
|
+
#INFO: call the auth= method, not create an auth variable
|
99
|
+
self.auth = Types::HMACFinalized.new
|
100
|
+
auth.hmac_data = Types::HMACFinalizedData.new
|
101
|
+
auth.hmac_data.alg_name = "HMACSHA1"
|
102
|
+
auth.hmac_data.data = CryptoUtils.encode64(CryptoUtils.hmac(@connection.shared_secret, header.element.to_s))
|
103
|
+
else
|
104
|
+
header.app_id = @connection.application.id
|
105
|
+
end
|
106
|
+
#if self.valid?
|
107
|
+
return @connection.send(self)
|
108
|
+
#else
|
109
|
+
# raise StandardError.new("request is not valid")
|
110
|
+
#end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
data/lib/response.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#--
|
3
|
+
# Copyright 2008 Danny Coates, Ashkan Farhadtouski
|
4
|
+
# All rights reserved.
|
5
|
+
# See LICENSE for permissions.
|
6
|
+
#++
|
7
|
+
|
8
|
+
require 'rexml/document'
|
9
|
+
require File.dirname(__FILE__) + '/utils/string_utils'
|
10
|
+
|
11
|
+
module HealthVault
|
12
|
+
class Response
|
13
|
+
include REXML
|
14
|
+
include StringUtils
|
15
|
+
include WCData
|
16
|
+
|
17
|
+
attr_reader :xml, :info
|
18
|
+
|
19
|
+
def initialize(http_response)
|
20
|
+
@http_response = http_response
|
21
|
+
@xml = Document.new(@http_response.body)
|
22
|
+
code = XPath.first(@xml, "//code").text
|
23
|
+
if code.to_i > 0
|
24
|
+
msg = XPath.first(@xml, "//error/message").text
|
25
|
+
Configuration.instance.logger.error "ERRORCODE: #{code.to_s} MESSAGE: #{msg}"
|
26
|
+
raise StandardError.new(msg)
|
27
|
+
end
|
28
|
+
Configuration.instance.logger.debug @xml.to_s
|
29
|
+
info_node = XPath.first(@xml, '//wc:info')
|
30
|
+
response_namespace = info_node.attribute('xmlns:wc').to_s
|
31
|
+
m = response_namespace.match(/urn\:com\.microsoft\.wc\.(.*)/)
|
32
|
+
if m.nil?
|
33
|
+
@info = nil
|
34
|
+
else
|
35
|
+
begin
|
36
|
+
mod = (m[1].split('.').collect {|s| classify(s)}).join('::') + "::Info.new"
|
37
|
+
# eval may as well be called evil
|
38
|
+
nfo = eval mod
|
39
|
+
@info = nfo
|
40
|
+
@info.parse_element(info_node)
|
41
|
+
rescue => e
|
42
|
+
puts e
|
43
|
+
Configuration.instance.logger.error e
|
44
|
+
@info = nil
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#--
|
3
|
+
# Copyright 2008 Danny Coates, Ashkan Farhadtouski
|
4
|
+
# All rights reserved.
|
5
|
+
# See LICENSE for permissions.
|
6
|
+
#++
|
7
|
+
# AUTOGENERATED ComplexType
|
8
|
+
|
9
|
+
module HealthVault
|
10
|
+
module WCData
|
11
|
+
<% modules.each do |m| %>module <%= classify(m) %>
|
12
|
+
<% end %>
|
13
|
+
class <%= class_name %> < ComplexType
|
14
|
+
|
15
|
+
<% children.each do |child| %>
|
16
|
+
<% if child[:max] == '1' %>
|
17
|
+
<% if child[:min].to_i > 0 %>#<b>REQUIRED</b><% end %>
|
18
|
+
<%= child[:doc] %><%= "#<em>value</em> is a #{child[:class]}" %>
|
19
|
+
def <%= underscore(child[:name]) %>=(value)
|
20
|
+
@children['<%= child[:name] %>'][:value] = value
|
21
|
+
end
|
22
|
+
|
23
|
+
<%= "#<b>returns</b>: a #{child[:class]}" %>
|
24
|
+
def <%= underscore(child[:name]) %>
|
25
|
+
return @children['<%= child[:name] %>'][:value]
|
26
|
+
end
|
27
|
+
<% else %>
|
28
|
+
<%= "#<em>value</em> is a #{child[:class]}" %>
|
29
|
+
def add_<%= underscore(child[:name]) %>(value)
|
30
|
+
@children['<%= child[:name] %>'][:value] << value
|
31
|
+
end
|
32
|
+
|
33
|
+
<%= "#<em>value</em> is a ##{child[:class]}" %>
|
34
|
+
def remove_<%= underscore(child[:name]) %>(value)
|
35
|
+
@children['<%= child[:name] %>'][:value].delete(value)
|
36
|
+
end
|
37
|
+
|
38
|
+
<% if child[:min].to_i > 0 %>#<b>REQUIRED</b><% end %>
|
39
|
+
<%= child[:doc] %><%= "#<b>returns</b>: a #{child[:class]} Array" %>
|
40
|
+
def <%= underscore(child[:name]) %>
|
41
|
+
return @children['<%= child[:name] %>'][:value]
|
42
|
+
end
|
43
|
+
<% end %>
|
44
|
+
<% end %>
|
45
|
+
|
46
|
+
def initialize
|
47
|
+
super
|
48
|
+
self.tag_name = '<%= tag_name %>'
|
49
|
+
<% children.each do |child| %>
|
50
|
+
<% if child[:max] == '1' %>
|
51
|
+
@children['<%= child[:name] %>'] = {:name => '<%= child[:name] %>', :class => <%= child[:class] %>, :value => nil, :min => <%= child[:min] %>, :max => <%= child[:max] %>, :order => <%= child[:order] %>, :place => :<%= child[:type] %>, :choice => <%= child[:choice].to_i %> }
|
52
|
+
<% if child[:min] == '1' && child[:choice].nil? %>
|
53
|
+
@children['<%= child[:name] %>'][:value] = <%= child[:class] %>.new
|
54
|
+
<% end %>
|
55
|
+
<% else %>
|
56
|
+
@children['<%= child[:name] %>'] = {:name => '<%= child[:name] %>', :class => <%= child[:class] %>, :value => Array.new, :min => <%= child[:min] %>, :max => <%= child[:max] %>, :order => <%= child[:order] %>, :place => :<%= child[:type] %>, :choice => <%= child[:choice].to_i %> }
|
57
|
+
<% end %>
|
58
|
+
<% end %>
|
59
|
+
end
|
60
|
+
end
|
61
|
+
<%modules.length.times do %>end
|
62
|
+
<% end %>
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#--
|
3
|
+
# Copyright 2008 Danny Coates, Ashkan Farhadtouski
|
4
|
+
# All rights reserved.
|
5
|
+
# See LICENSE for permissions.
|
6
|
+
#++
|
7
|
+
# AUTOGENERATED class
|
8
|
+
|
9
|
+
module HealthVault
|
10
|
+
module WCData
|
11
|
+
<% modules.each do |m| %>module <%= classify(m) + "\n" %><% end %>
|
12
|
+
<%= "##{class_name} is a #{children['base'].to_s}" %>
|
13
|
+
class <%= class_name %> < SimpleType
|
14
|
+
<% children.each do |name, target| %>
|
15
|
+
<% if name == 'enumeration' %>
|
16
|
+
<% target.each do |enum| %>
|
17
|
+
def self.<%= enum.empty? ? 'empty' : underscore(enum.to_s.downcase.strip.gsub(' ', '_')) %>
|
18
|
+
return '<%= enum.to_s %>'
|
19
|
+
end
|
20
|
+
<% end %>
|
21
|
+
def self.enum
|
22
|
+
return ['<%= target.join("','") %>']
|
23
|
+
end
|
24
|
+
<% elsif name != 'base' %>
|
25
|
+
<%= "##{name} = #{target.to_s}" %>
|
26
|
+
def <%= name %>(value)
|
27
|
+
<% case name
|
28
|
+
when 'minExclusive' %>
|
29
|
+
return value > <%= target %>
|
30
|
+
<% when 'minInclusive' %>
|
31
|
+
return value >= <%= target %>
|
32
|
+
<% when 'maxExclusive' %>
|
33
|
+
return value < <%= target %>
|
34
|
+
<% when 'minInclusive' %>
|
35
|
+
return value <= <%= target %>
|
36
|
+
<% when 'length' %>
|
37
|
+
return value.length == <%= target %>
|
38
|
+
<% when 'minLength' %>
|
39
|
+
return value.length > <%= target %>
|
40
|
+
<% when 'maxLength' %>
|
41
|
+
return value.length < <%= target %>
|
42
|
+
<% else %>
|
43
|
+
return true
|
44
|
+
<% end %>
|
45
|
+
end
|
46
|
+
<% end %>
|
47
|
+
<% end %>
|
48
|
+
def self.valid?(value)
|
49
|
+
result = true
|
50
|
+
<% children.each do |name, target| %>
|
51
|
+
<% case name
|
52
|
+
when 'enumeration'%>
|
53
|
+
result = result && self.enum.include?(value)
|
54
|
+
<% when 'base' %>
|
55
|
+
<% else %>
|
56
|
+
result = result && self.<%= name %>(value)
|
57
|
+
<% end %>
|
58
|
+
<% end %>
|
59
|
+
return result
|
60
|
+
end
|
61
|
+
end
|
62
|
+
<%modules.length.times do %>end
|
63
|
+
<% end %>
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#--
|
3
|
+
# Copyright 2008 Danny Coates, Ashkan Farhadtouski
|
4
|
+
# All rights reserved.
|
5
|
+
# See LICENSE for permissions.
|
6
|
+
#++
|
7
|
+
#AUTOGENERATED Thing extension
|
8
|
+
|
9
|
+
module HealthVault
|
10
|
+
module WCData
|
11
|
+
module Thing
|
12
|
+
class Thing
|
13
|
+
@@class_hash = Hash.new
|
14
|
+
<% class_hash.each do |key, val| %>
|
15
|
+
@@class_hash['<%= key %>'] = <%= val %><% end %>
|
16
|
+
def self.guid_to_class(guid)
|
17
|
+
return @@class_hash[guid]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#--
|
3
|
+
# Copyright 2008 Danny Coates, Ashkan Farhadtouski
|
4
|
+
# All rights reserved.
|
5
|
+
# See LICENSE for permissions.
|
6
|
+
#++
|
7
|
+
|
8
|
+
require 'openssl'
|
9
|
+
require 'base64'
|
10
|
+
|
11
|
+
module HealthVault
|
12
|
+
class CryptoUtils
|
13
|
+
include OpenSSL
|
14
|
+
def self.create_shared_secret
|
15
|
+
unless File.exist?("/dev/urandom")
|
16
|
+
Random.seed(rand(0).to_s + Time.now.usec.to_s)
|
17
|
+
end
|
18
|
+
data = BN.rand(2048, -1, false).to_s
|
19
|
+
return OpenSSL::Digest::SHA1.new(data).digest
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.encode64(text)
|
23
|
+
return Base64.encode64(text).gsub(/\n/, "")
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.hmac(key, text)
|
27
|
+
return HMAC.digest(OpenSSL::Digest::Digest.new("SHA1"), key, text)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.digest(text)
|
31
|
+
return OpenSSL::Digest::SHA1.new(text).digest
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class CryptoKey
|
36
|
+
def initialize(pfx_or_pem_filename, password = nil)
|
37
|
+
begin
|
38
|
+
#INFO: I can't get OpenSSL::PKCS12 working on windows.
|
39
|
+
# This call fails with 'mac verify failed'
|
40
|
+
# To work around this I created a pem on the command line like:
|
41
|
+
# openssl pkcs12 -in xxx.pfx -out xxx.pem -nodes
|
42
|
+
@pfx = OpenSSL::PKCS12::PKCS12.new(File.read(pfx_or_pem_filename), password)
|
43
|
+
#TODO if pfx files are going to be a problem, maybe we just ought to remove
|
44
|
+
rescue
|
45
|
+
@pfx = nil
|
46
|
+
@pkey = OpenSSL::PKey::RSA.new(File.read(pfx_or_pem_filename),password)
|
47
|
+
@cert = OpenSSL::X509::Certificate.new(File.read(pfx_or_pem_filename))
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def sign(text)
|
52
|
+
if @pfx.nil?
|
53
|
+
return @pkey.sign(OpenSSL::Digest::SHA1.new, text)
|
54
|
+
else
|
55
|
+
return @pfx.key.sign(OpenSSL::Digest::SHA1.new, text)
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
def fingerprint
|
61
|
+
if @pfx.nil?
|
62
|
+
return OpenSSL::Digest::SHA1.hexdigest(@cert.to_der)
|
63
|
+
else
|
64
|
+
return OpenSSL::Digest::SHA1.hexdigest(@pfx.certificate.to_der)
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#--
|
3
|
+
# Copyright 2008 Danny Coates, Ashkan Farhadtouski
|
4
|
+
# All rights reserved.
|
5
|
+
# See LICENSE for permissions.
|
6
|
+
#++
|
7
|
+
|
8
|
+
module HealthVault
|
9
|
+
module StringUtils
|
10
|
+
def camelize(string)
|
11
|
+
result = ""
|
12
|
+
parts = string.split('_')
|
13
|
+
result << parts.first.downcase
|
14
|
+
parts[1..-1].each {|s| result << s.downcase.capitalize}
|
15
|
+
return result
|
16
|
+
end
|
17
|
+
|
18
|
+
def underscore(camel_cased_word)
|
19
|
+
return camel_cased_word.to_s.gsub(/::/, '/').
|
20
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
21
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
22
|
+
tr("-", "_").
|
23
|
+
downcase
|
24
|
+
end
|
25
|
+
|
26
|
+
def classify(string)
|
27
|
+
if string.length > 1
|
28
|
+
class_name = string[/./].upcase + string[1..-1]
|
29
|
+
else
|
30
|
+
class_name = string
|
31
|
+
end
|
32
|
+
return class_name.gsub('-', '')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,249 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#--
|
3
|
+
# Copyright 2008 Danny Coates, Ashkan Farhadtouski
|
4
|
+
# All rights reserved.
|
5
|
+
# See LICENSE for permissions.
|
6
|
+
#++
|
7
|
+
|
8
|
+
require 'rexml/document'
|
9
|
+
|
10
|
+
module HealthVault
|
11
|
+
module WCData
|
12
|
+
class ComplexType
|
13
|
+
include REXML
|
14
|
+
attr_accessor :tag_name
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
@children = Hash.new
|
18
|
+
end
|
19
|
+
|
20
|
+
def required_elements
|
21
|
+
return query_elements {|v| v[:min] > 0}
|
22
|
+
end
|
23
|
+
|
24
|
+
def optional_elements
|
25
|
+
return query_elements {|v| v[:min] == 0}
|
26
|
+
end
|
27
|
+
|
28
|
+
def query_elements
|
29
|
+
result = Array.new
|
30
|
+
if block_given?
|
31
|
+
@children.each do |key, value|
|
32
|
+
if yield value
|
33
|
+
result << key
|
34
|
+
end
|
35
|
+
end
|
36
|
+
else
|
37
|
+
result = @children.keys
|
38
|
+
end
|
39
|
+
return result
|
40
|
+
end
|
41
|
+
|
42
|
+
# construct REXML::Element tree from children
|
43
|
+
def element(container = nil)
|
44
|
+
#cname = self.class.to_s
|
45
|
+
my_name = tag_name.to_s.strip.downcase#cname.split('::')[-1].downcase#
|
46
|
+
if container.nil?
|
47
|
+
me = Element.new(my_name)
|
48
|
+
elsif container.is_a?(String)
|
49
|
+
me = Element.new(container)
|
50
|
+
else
|
51
|
+
me = container
|
52
|
+
end
|
53
|
+
elements = @children.values.sort{|a,b| a[:order] <=> b[:order]}
|
54
|
+
elements.each do |el|
|
55
|
+
val = el[:value]
|
56
|
+
next if val.nil?
|
57
|
+
if val.is_a?(Array)
|
58
|
+
val.each do |v|
|
59
|
+
sub_element(el[:name], v, me)
|
60
|
+
end
|
61
|
+
else
|
62
|
+
if el[:place] == :extension
|
63
|
+
sub_element(el[:name], val, me, false)
|
64
|
+
elsif el[:place] == :attribute
|
65
|
+
me.add_attribute(el[:name], val.to_s)
|
66
|
+
else
|
67
|
+
sub_element(el[:name], val, me)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
return me
|
72
|
+
end
|
73
|
+
|
74
|
+
# parse WCData from the given xml element
|
75
|
+
def parse_element(e)
|
76
|
+
# parse elements
|
77
|
+
e.elements.each do |child|
|
78
|
+
node = child.name
|
79
|
+
if @children[node].nil?
|
80
|
+
begin
|
81
|
+
unless @children['anything'].nil?
|
82
|
+
#see if the parent is a 'thing'
|
83
|
+
types = e.parent.get_elements('type-id')
|
84
|
+
unless types.empty?
|
85
|
+
type_guid = types[0].text.to_s
|
86
|
+
type = WCData::Thing::Thing.guid_to_class(type_guid)
|
87
|
+
#add_new_to_children(@children['anything'][:value], child, type)
|
88
|
+
x = type.new
|
89
|
+
#TODO make SimpleTypes behave like their base types
|
90
|
+
#<HACK>
|
91
|
+
if x.is_a?(SimpleType) || x.is_a?(String)
|
92
|
+
x = child.text
|
93
|
+
end
|
94
|
+
#</HACK>
|
95
|
+
if x.respond_to?(:parse_element)
|
96
|
+
x.parse_element(child)
|
97
|
+
end
|
98
|
+
@children['anything'][:class] = type
|
99
|
+
if @children['anything'][:value].is_a?(Array)
|
100
|
+
@children['anything'][:value] << x
|
101
|
+
else
|
102
|
+
@children['anything'][:value] = x
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
rescue => err
|
107
|
+
Configuration.instance.logger.error err
|
108
|
+
end
|
109
|
+
# unknown node type
|
110
|
+
Configuration.instance.logger.debug "unknown node of #{node} for #{self.class.to_s}"
|
111
|
+
else
|
112
|
+
#add_new_to_children(@children[node][:value],child, @children[node][:class])
|
113
|
+
x = @children[node][:class].new
|
114
|
+
#TODO make SimpleTypes behave like their base types
|
115
|
+
#<HACK>
|
116
|
+
if x.is_a?(SimpleType) || x.is_a?(String)
|
117
|
+
x = child.text
|
118
|
+
end
|
119
|
+
#</HACK>
|
120
|
+
if x.respond_to?(:parse_element)
|
121
|
+
x.parse_element(child)
|
122
|
+
end
|
123
|
+
if @children[node][:value].is_a?(Array)
|
124
|
+
@children[node][:value] << x
|
125
|
+
else
|
126
|
+
@children[node][:value] = x
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
# parse inner text
|
131
|
+
if !@children['data'].nil? && !e.text.empty?
|
132
|
+
@children['data'][:value] = e.text
|
133
|
+
end
|
134
|
+
# parse attributes
|
135
|
+
e.attributes.each_attribute do |attr|
|
136
|
+
name = attr.name
|
137
|
+
if @children[name].nil?
|
138
|
+
# unknown attribute type
|
139
|
+
Configuration.instance.logger.debug "unknown attribute of #{name} for #{self.class.to_s}"
|
140
|
+
else
|
141
|
+
@children[name][:value] = attr.value.to_s
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def add_new_to_children(target, node, klass)
|
147
|
+
x = klass.new
|
148
|
+
#TODO make SimpleTypes behave like their base types
|
149
|
+
#<HACK>
|
150
|
+
if x.is_a?(SimpleType) || x.is_a?(String)
|
151
|
+
x = node.text
|
152
|
+
end
|
153
|
+
#</HACK>
|
154
|
+
if x.respond_to?(:parse_element)
|
155
|
+
x.parse_element(node)
|
156
|
+
end
|
157
|
+
if target.is_a?(Array)
|
158
|
+
target << x
|
159
|
+
else
|
160
|
+
target = x
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
def valid?
|
165
|
+
valid = true
|
166
|
+
choices = Hash.new
|
167
|
+
@children.values.each do |child|
|
168
|
+
if child[:place] == :element && child[:choice].to_i > 0
|
169
|
+
choices[child[:choice]] ||= false
|
170
|
+
#TODO: validate choices
|
171
|
+
elsif child[:min] > 1
|
172
|
+
len = child[:value].length
|
173
|
+
valid = valid && (len > child[:min])
|
174
|
+
valid = valid && (len < child[:max])
|
175
|
+
child[:value].each do |v|
|
176
|
+
break if !valid
|
177
|
+
begin
|
178
|
+
if child[:class].superclass == ComplexType
|
179
|
+
valid = valid && v.valid?
|
180
|
+
elsif child[:class].superclass == SimpleType
|
181
|
+
valid = valid && child[:class].valid?(v)
|
182
|
+
else
|
183
|
+
valid = valid && !(v.nil? || v.to_s.empty?)
|
184
|
+
end
|
185
|
+
rescue => e
|
186
|
+
Configuration.instance.logger.error e
|
187
|
+
valid = false
|
188
|
+
break
|
189
|
+
end
|
190
|
+
end
|
191
|
+
elsif child[:min] == 1
|
192
|
+
#TODO extract the checks to a seperate method
|
193
|
+
begin
|
194
|
+
if child[:class].superclass == ComplexType
|
195
|
+
valid = valid && child[:value].valid?
|
196
|
+
elsif child[:class].superclass == SimpleType
|
197
|
+
valid = valid && child[:class].valid?(child[:value])
|
198
|
+
else
|
199
|
+
valid = valid && !(child[:value].nil? || child[:value].to_s.empty?)
|
200
|
+
end
|
201
|
+
rescue => e
|
202
|
+
Configuration.instance.logger.error e
|
203
|
+
valid = false
|
204
|
+
break
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
return valid
|
209
|
+
end
|
210
|
+
|
211
|
+
# xml string
|
212
|
+
def to_s
|
213
|
+
return element.to_s
|
214
|
+
end
|
215
|
+
|
216
|
+
def method_missing(name, *args, &blk)
|
217
|
+
#For more ease of use, forward method calls for
|
218
|
+
#complexTypes that contain 'anything' nodes
|
219
|
+
#to the 'anything', i.e. try to make 'anything' transparent
|
220
|
+
unless @children['anything'].nil?
|
221
|
+
#INFO: this will only work for single 'anythings'
|
222
|
+
if @children['anything'][:value].respond_to?(name)
|
223
|
+
return @children['anything'][:value].send(name, *args, &blk)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
raise NoMethodError
|
227
|
+
end
|
228
|
+
|
229
|
+
private
|
230
|
+
|
231
|
+
def sub_element(name, obj, parent, tag = true)
|
232
|
+
if tag
|
233
|
+
n = Element.new(name, parent)
|
234
|
+
if obj.is_a?(ComplexType)
|
235
|
+
obj.element(n)
|
236
|
+
else
|
237
|
+
n.text = obj.to_s
|
238
|
+
end
|
239
|
+
else
|
240
|
+
if obj.is_a?(ComplexType)
|
241
|
+
parent << obj.element
|
242
|
+
else
|
243
|
+
parent.text = obj.to_s
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|