Permalink
Browse files

XML and XSD renderings along with fixed tests, and removing of some o…

…ther files that broke things.
  • Loading branch information...
kkamperschroer committed Apr 11, 2012
1 parent 38b1244 commit a852df05d519171e74c4fabb551d9f5fdb349de7
@@ -1,3 +0,0 @@
-class MedicalStaffController < ApplicationController
-
-end
@@ -7,6 +7,7 @@ def index
respond_to do |format|
format.html # index.html.erb
format.json { render :json => @medical_staffs }
+ format.xml #index.xml.builder
end
end
@@ -18,6 +19,7 @@ def show
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @medical_staff }
+ format.xml #show.xml.builder
end
end
@@ -0,0 +1,12 @@
+xml.instruct!
+xml.medical_staffs({"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance"}) do
+ @medical_staffs.each do |staff|
+ xml.medical_staff do
+ xml.id staff.id
+ xml.firstname staff.firstname
+ xml.middlename staff.middlename
+ xml.lastname staff.lastname
+ xml.doc_id staff.doc_id
+ end
+ end
+end
@@ -0,0 +1,8 @@
+xml.instruct!
+ xml.medical_staff({"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance"}) do
+ xml.id @medical_staff.id
+ xml.firstname @medical_staff.firstname
+ xml.middlename @medical_staff.middlename
+ xml.lastname @medical_staff.lastname
+ xml.doc_id @medical_staff.doc_id
+ end
View
@@ -33,10 +33,6 @@
resources :bills
- get "say/hello"
-
- get "say/goodbye"
-
# The priority is based upon order of creation:
# first created -> highest priority.
@@ -1,12 +0,0 @@
-class CreateMedicalStaffs < ActiveRecord::Migration
- def change
- create_table :medical_staffs do |t|
- t.string :firstname
- t.string :middlename
- t.string :lastname
- t.integer :doc_id
-
- t.timestamps
- end
- end
-end
View
@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120410020145) do
+ActiveRecord::Schema.define(:version => 20120410204746) do
create_table "addresses", :force => true do |t|
t.string "zip"
View
@@ -38,6 +38,9 @@ def sch(start_time, end_time)
return Schedule.create([{ :start_time => start_time, :end_time => end_time, :phy_id => Physician.all[rand(Physician.all.length)].id }])[0]
end
+def staff(fn, mn, ln, login)
+ return MedicalStaff.create([{ :firstname => fn, :middlename => mn, :lastname => ln, :doc_id => Physician.all[rand(Physician.all.length)].id, :login=> login }])[0]
+end
#---------------- Seed data ----------------#
#Create an admin account
@@ -50,6 +53,11 @@ def sch(start_time, end_time)
phy("Peter", "A", "Bougie", "Ears", 24, "444-444-4444", l("peter", "password"))
phy("Zhicheng", "A", "Fu", "Mouth", 61, "555-555-5555", l("fu", "password"))
+#Add some medical staff accounts
+staff("Dante", "D", "Amaral", l("dante", "pasword"))
+staff("Leonel", "D", "Marshall", l("leonel", "password"))
+staff("Medical", "D", "Staffer", l("medical", "password"))
+
#Create some patients
pat("John", "B", "Doe", "23-3-1987")
pat("Steve", "B", "Miller", "12-04-1967")
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="medical_staff">
+ <complexType>
+ <sequence>
+ <element name="id" type="integer"/>
+ <element name="firstname" type="string"/>
+ <element name="middlename" type="string"/>
+ <element name="lastname" type="string"/>
+ <element name="doc_id" type="integer"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="medical_staffs">
+ <complexType>
+ <sequence>
+ <element name="medical_staff" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <sequence>
+ <element name="id" type="integer"/>
+ <element name="firstname" type="string"/>
+ <element name="middlename" type="string"/>
+ <element name="lastname" type="string"/>
+ <element name="doc_id" type="integer"/>
+ </sequence>
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
@@ -1,24 +0,0 @@
-require 'test_helper'
-
-class MedicalStaffControllerTest < ActionController::TestCase
- test "should get firstname:string" do
- get :firstname:string
- assert_response :success
- end
-
- test "should get middlename:string" do
- get :middlename:string
- assert_response :success
- end
-
- test "should get lastname:string" do
- get :lastname:string
- assert_response :success
- end
-
- test "should get doc_id:integer" do
- get :doc_id:integer
- assert_response :success
- end
-
-end
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<medical_staff xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <id>1</id>
+ <firstname>Dante</firstname>
+ <middlename>D</middlename>
+ <lastname>Amaral</lastname>
+ <doc_id>4</doc_id>
+</medical_staff>
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<medical_staffs xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <medical_staff>
+ <id>1</id>
+ <firstname>Dante</firstname>
+ <middlename>D</middlename>
+ <lastname>Amaral</lastname>
+ <doc_id>4</doc_id>
+ </medical_staff>
+ <medical_staff>
+ <id>2</id>
+ <firstname>Leonel</firstname>
+ <middlename>D</middlename>
+ <lastname>Marshall</lastname>
+ <doc_id>3</doc_id>
+ </medical_staff>
+ <medical_staff>
+ <id>3</id>
+ <firstname>Medical</firstname>
+ <middlename>D</middlename>
+ <lastname>Staffer</lastname>
+ <doc_id>4</doc_id>
+ </medical_staff>
+</medical_staffs>

0 comments on commit a852df0

Please sign in to comment.