Skip to content
This repository has been archived by the owner on Apr 10, 2018. It is now read-only.

Commit

Permalink
XML and XSD renderings along with fixed tests, and removing of some o…
Browse files Browse the repository at this point in the history
…ther files that broke things.
  • Loading branch information
kylekampy committed Apr 11, 2012
1 parent 38b1244 commit a852df0
Show file tree
Hide file tree
Showing 13 changed files with 97 additions and 44 deletions.
3 changes: 0 additions & 3 deletions app/controllers/medical_staff_controller.rb

This file was deleted.

2 changes: 2 additions & 0 deletions app/controllers/medical_staffs_controller.rb
Expand Up @@ -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

Expand All @@ -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

Expand Down
12 changes: 12 additions & 0 deletions app/views/medical_staffs/index.xml.builder
@@ -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
8 changes: 8 additions & 0 deletions app/views/medical_staffs/show.xml.builder
@@ -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
4 changes: 0 additions & 4 deletions config/routes.rb
Expand Up @@ -33,10 +33,6 @@

resources :bills

get "say/hello"

get "say/goodbye"

# The priority is based upon order of creation:
# first created -> highest priority.

Expand Down
12 changes: 0 additions & 12 deletions db/migrate/20120410020145_create_medical_staffs.rb

This file was deleted.

2 changes: 1 addition & 1 deletion db/schema.rb
Expand Up @@ -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"
Expand Down
8 changes: 8 additions & 0 deletions db/seeds.rb
Expand Up @@ -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
Expand All @@ -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")
Expand Down
14 changes: 14 additions & 0 deletions public/xsd/medical_staff_1.xsd
@@ -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>
20 changes: 20 additions & 0 deletions public/xsd/medical_staffs.xsd
@@ -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>
24 changes: 0 additions & 24 deletions test/functional/medical_staff_controller_test.rb

This file was deleted.

8 changes: 8 additions & 0 deletions test/unit/xsd_tests/test_xmls/medical_staff_1.xml
@@ -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>
24 changes: 24 additions & 0 deletions test/unit/xsd_tests/test_xmls/medical_staffs.xml
@@ -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.