openagent 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. data/README.md +64 -0
  2. data/lib/openagent.rb +4 -0
  3. data/lib/openagent/agent.rb +24 -0
  4. data/lib/openagent/client.rb +170 -0
  5. data/lib/openagent/errors.rb +30 -0
  6. data/lib/openagent/message_builder.rb +171 -0
  7. data/lib/openagent/ssl_config.rb +26 -0
  8. data/lib/openagent/version.rb +3 -0
  9. data/lib/openagent/xml_helpers.rb +24 -0
  10. data/lib/openagent/zone.rb +58 -0
  11. data/lib/sif/infra/common/application.rb +13 -0
  12. data/lib/sif/infra/common/condition.rb +13 -0
  13. data/lib/sif/infra/common/condition_group.rb +14 -0
  14. data/lib/sif/infra/common/data.rb +11 -0
  15. data/lib/sif/infra/common/error.rb +14 -0
  16. data/lib/sif/infra/common/event.rb +0 -0
  17. data/lib/sif/infra/common/event_object.rb +12 -0
  18. data/lib/sif/infra/common/extended_query.rb +15 -0
  19. data/lib/sif/infra/common/extended_query_results.rb +12 -0
  20. data/lib/sif/infra/common/header.rb +27 -0
  21. data/lib/sif/infra/common/message.rb +49 -0
  22. data/lib/sif/infra/common/object.rb +11 -0
  23. data/lib/sif/infra/common/object_data.rb +46 -0
  24. data/lib/sif/infra/common/other_id.rb +12 -0
  25. data/lib/sif/infra/common/property.rb +12 -0
  26. data/lib/sif/infra/common/protocol.rb +16 -0
  27. data/lib/sif/infra/common/provision.rb +17 -0
  28. data/lib/sif/infra/common/query.rb +16 -0
  29. data/lib/sif/infra/common/query_object.rb +12 -0
  30. data/lib/sif/infra/common/secure_channel.rb +12 -0
  31. data/lib/sif/infra/common/security.rb +13 -0
  32. data/lib/sif/infra/common/status.rb +16 -0
  33. data/lib/sif/infra/common/unprovision.rb +9 -0
  34. data/lib/sif/infra/common/vendor.rb +13 -0
  35. data/lib/sif/infra/messages/ack.rb +16 -0
  36. data/lib/sif/infra/messages/event.rb +12 -0
  37. data/lib/sif/infra/messages/get_agent_acl.rb +11 -0
  38. data/lib/sif/infra/messages/get_message.rb +11 -0
  39. data/lib/sif/infra/messages/get_zone_status.rb +10 -0
  40. data/lib/sif/infra/messages/ping.rb +10 -0
  41. data/lib/sif/infra/messages/provide.rb +16 -0
  42. data/lib/sif/infra/messages/provision.rb +18 -0
  43. data/lib/sif/infra/messages/register.rb +21 -0
  44. data/lib/sif/infra/messages/request.rb +16 -0
  45. data/lib/sif/infra/messages/responder.rb +9 -0
  46. data/lib/sif/infra/messages/response.rb +18 -0
  47. data/lib/sif/infra/messages/sleep.rb +11 -0
  48. data/lib/sif/infra/messages/subscribe.rb +12 -0
  49. data/lib/sif/infra/messages/system_control.rb +15 -0
  50. data/lib/sif/infra/messages/system_control_data.rb +39 -0
  51. data/lib/sif/infra/messages/unprovide.rb +12 -0
  52. data/lib/sif/infra/messages/unregister.rb +11 -0
  53. data/lib/sif/infra/messages/unsubscribe.rb +12 -0
  54. data/lib/sif/infra/messages/wakeup.rb +11 -0
  55. data/lib/sif/infra/messages/zone_status_role.rb +12 -0
  56. data/lib/sif/infra/objects/agent_acl.rb +19 -0
  57. data/lib/sif/infra/objects/zone_status.rb +30 -0
  58. data/lib/sif/models/common/address.rb +21 -0
  59. data/lib/sif/models/common/alert_message.rb +12 -0
  60. data/lib/sif/models/common/base_name.rb +12 -0
  61. data/lib/sif/models/common/calendar_summary.rb +28 -0
  62. data/lib/sif/models/common/code.rb +12 -0
  63. data/lib/sif/models/common/contact_info.rb +21 -0
  64. data/lib/sif/models/common/credits_attempted.rb +12 -0
  65. data/lib/sif/models/common/demographics.rb +31 -0
  66. data/lib/sif/models/common/dwelling_arrangement.rb +14 -0
  67. data/lib/sif/models/common/earned_status.rb +15 -0
  68. data/lib/sif/models/common/electronic_id.rb +12 -0
  69. data/lib/sif/models/common/email.rb +13 -0
  70. data/lib/sif/models/common/english_proficiency.rb +14 -0
  71. data/lib/sif/models/common/exceptionality_category.rb +13 -0
  72. data/lib/sif/models/common/grade_level.rb +12 -0
  73. data/lib/sif/models/common/grid_location.rb +12 -0
  74. data/lib/sif/models/common/identification_info.rb +12 -0
  75. data/lib/sif/models/common/language.rb +14 -0
  76. data/lib/sif/models/common/meal_status.rb +16 -0
  77. data/lib/sif/models/common/medical_alert_message.rb +12 -0
  78. data/lib/sif/models/common/meeting_time.rb +12 -0
  79. data/lib/sif/models/common/name.rb +19 -0
  80. data/lib/sif/models/common/other_code.rb +12 -0
  81. data/lib/sif/models/common/other_id.rb +12 -0
  82. data/lib/sif/models/common/phone_number.rb +15 -0
  83. data/lib/sif/models/common/principal_info.rb +12 -0
  84. data/lib/sif/models/common/race.rb +15 -0
  85. data/lib/sif/models/common/sced_code.rb +15 -0
  86. data/lib/sif/models/common/schedule_info.rb +14 -0
  87. data/lib/sif/models/common/schedule_info_override.rb +13 -0
  88. data/lib/sif/models/common/school_contact.rb +13 -0
  89. data/lib/sif/models/common/school_course_info_override.rb +18 -0
  90. data/lib/sif/models/common/street.rb +22 -0
  91. data/lib/sif/models/common/subject_area.rb +13 -0
  92. data/lib/sif/models/groups/data_model/term_span.rb +14 -0
  93. data/lib/sif/models/groups/sis/attendance_code_info.rb +23 -0
  94. data/lib/sif/models/groups/sis/calendar_date.rb +25 -0
  95. data/lib/sif/models/groups/sis/discipline_incident.rb +31 -0
  96. data/lib/sif/models/groups/sis/lea_info.rb +28 -0
  97. data/lib/sif/models/groups/sis/personal_representer.rb +22 -0
  98. data/lib/sif/models/groups/sis/school_course_info.rb +30 -0
  99. data/lib/sif/models/groups/sis/school_info.rb +32 -0
  100. data/lib/sif/models/groups/sis/section_info.rb +26 -0
  101. data/lib/sif/models/groups/sis/sis_representer.rb +15 -0
  102. data/lib/sif/models/groups/sis/staff_personal.rb +20 -0
  103. data/lib/sif/models/groups/sis/student_personal.rb +37 -0
  104. data/lib/sif/models/groups/sis/student_section_enrollment.rb +21 -0
  105. data/lib/sif/models/groups/sis/term_info.rb +29 -0
  106. data/lib/sif/representations/infra/common/application.rb +16 -0
  107. data/lib/sif/representations/infra/common/condition.rb +16 -0
  108. data/lib/sif/representations/infra/common/condition_group.rb +18 -0
  109. data/lib/sif/representations/infra/common/data.rb +17 -0
  110. data/lib/sif/representations/infra/common/error.rb +17 -0
  111. data/lib/sif/representations/infra/common/event.rb +0 -0
  112. data/lib/sif/representations/infra/common/event_object.rb +15 -0
  113. data/lib/sif/representations/infra/common/extended_query.rb +18 -0
  114. data/lib/sif/representations/infra/common/extended_query_results.rb +15 -0
  115. data/lib/sif/representations/infra/common/header.rb +23 -0
  116. data/lib/sif/representations/infra/common/message.rb +54 -0
  117. data/lib/sif/representations/infra/common/object.rb +14 -0
  118. data/lib/sif/representations/infra/common/object_data.rb +43 -0
  119. data/lib/sif/representations/infra/common/other_id.rb +15 -0
  120. data/lib/sif/representations/infra/common/property.rb +15 -0
  121. data/lib/sif/representations/infra/common/protocol.rb +22 -0
  122. data/lib/sif/representations/infra/common/provision.rb +38 -0
  123. data/lib/sif/representations/infra/common/query.rb +24 -0
  124. data/lib/sif/representations/infra/common/query_object.rb +15 -0
  125. data/lib/sif/representations/infra/common/secure_channel.rb +15 -0
  126. data/lib/sif/representations/infra/common/security.rb +18 -0
  127. data/lib/sif/representations/infra/common/status.rb +18 -0
  128. data/lib/sif/representations/infra/messages/ack.rb +25 -0
  129. data/lib/sif/representations/infra/messages/event.rb +19 -0
  130. data/lib/sif/representations/infra/messages/get_message.rb +12 -0
  131. data/lib/sif/representations/infra/messages/ping.rb +13 -0
  132. data/lib/sif/representations/infra/messages/provide.rb +19 -0
  133. data/lib/sif/representations/infra/messages/provision.rb +37 -0
  134. data/lib/sif/representations/infra/messages/register.rb +30 -0
  135. data/lib/sif/representations/infra/messages/request.rb +24 -0
  136. data/lib/sif/representations/infra/messages/response.rb +29 -0
  137. data/lib/sif/representations/infra/messages/sleep.rb +14 -0
  138. data/lib/sif/representations/infra/messages/subscribe.rb +19 -0
  139. data/lib/sif/representations/infra/messages/system_control.rb +23 -0
  140. data/lib/sif/representations/infra/messages/system_control_data.rb +31 -0
  141. data/lib/sif/representations/infra/messages/wakeup.rb +14 -0
  142. data/lib/sif/representations/models/common/address.rb +24 -0
  143. data/lib/sif/representations/models/common/alert_message.rb +16 -0
  144. data/lib/sif/representations/models/common/contact_info.rb +28 -0
  145. data/lib/sif/representations/models/common/credits_attempted.rb +15 -0
  146. data/lib/sif/representations/models/common/demographics.rb +43 -0
  147. data/lib/sif/representations/models/common/dwelling_arrangement.rb +18 -0
  148. data/lib/sif/representations/models/common/electronic_id.rb +16 -0
  149. data/lib/sif/representations/models/common/email.rb +16 -0
  150. data/lib/sif/representations/models/common/english_proficiency.rb +17 -0
  151. data/lib/sif/representations/models/common/identification_info.rb +16 -0
  152. data/lib/sif/representations/models/common/language.rb +19 -0
  153. data/lib/sif/representations/models/common/medical_alert_message.rb +15 -0
  154. data/lib/sif/representations/models/common/meeting_time.rb +16 -0
  155. data/lib/sif/representations/models/common/name.rb +22 -0
  156. data/lib/sif/representations/models/common/other_code.rb +15 -0
  157. data/lib/sif/representations/models/common/other_id.rb +15 -0
  158. data/lib/sif/representations/models/common/phone_number.rb +18 -0
  159. data/lib/sif/representations/models/common/principal_info.rb +15 -0
  160. data/lib/sif/representations/models/common/race.rb +18 -0
  161. data/lib/sif/representations/models/common/sced_code.rb +18 -0
  162. data/lib/sif/representations/models/common/schedule_info.rb +19 -0
  163. data/lib/sif/representations/models/common/schedule_info_override.rb +18 -0
  164. data/lib/sif/representations/models/common/school_contact.rb +17 -0
  165. data/lib/sif/representations/models/common/school_course_info_override.rb +21 -0
  166. data/lib/sif/representations/models/common/street.rb +26 -0
  167. data/lib/sif/representations/models/common/subject_area.rb +17 -0
  168. data/lib/sif/representations/models/groups/data_model/term_span.rb +20 -0
  169. data/lib/sif/representations/models/groups/sis/personal_representer.rb +38 -0
  170. data/lib/sif/representations/models/groups/sis/school_course_info.rb +36 -0
  171. data/lib/sif/representations/models/groups/sis/school_info.rb +47 -0
  172. data/lib/sif/representations/models/groups/sis/section_info.rb +29 -0
  173. data/lib/sif/representations/models/groups/sis/sis_representer.rb +17 -0
  174. data/lib/sif/representations/models/groups/sis/staff_personal.rb +19 -0
  175. data/lib/sif/representations/models/groups/sis/student_personal.rb +37 -0
  176. data/lib/sif/representations/models/groups/sis/student_section_enrollment.rb +26 -0
  177. data/lib/sif/representations/models/groups/sis/term_info.rb +30 -0
  178. data/lib/sif/sif.rb +249 -0
  179. data/openagent.gemspec +33 -0
  180. data/spec/agent_spec.rb +32 -0
  181. data/spec/client_spec.rb +96 -0
  182. data/spec/fixtures/agent.yaml +31 -0
  183. data/spec/fixtures/messages/event.xml +72 -0
  184. data/spec/fixtures/messages/response.xml +107 -0
  185. data/spec/fixtures/sif/attendance_code_info.xml +9 -0
  186. data/spec/fixtures/sif/calendar_date.xml +22 -0
  187. data/spec/fixtures/sif/calendar_summary.xml +21 -0
  188. data/spec/fixtures/sif/demographics.xml +33 -0
  189. data/spec/fixtures/sif/discipline_incident.xml +70 -0
  190. data/spec/fixtures/sif/lea_info.xml +55 -0
  191. data/spec/fixtures/sif/section_info.xml +1536 -0
  192. data/spec/fixtures/sif/sif_header.xml +12 -0
  193. data/spec/fixtures/sif/sif_message__response.xml +107 -0
  194. data/spec/fixtures/sif/sif_object_data.xml +5 -0
  195. data/spec/fixtures/sif/sif_protocol.xml +3 -0
  196. data/spec/fixtures/sif/sif_protocol__properties.xml +10 -0
  197. data/spec/fixtures/sif/sif_provide.xml +9 -0
  198. data/spec/fixtures/sif/sif_provision.xml +33 -0
  199. data/spec/fixtures/sif/sif_register.xml +20 -0
  200. data/spec/fixtures/sif/sif_request.xml +21 -0
  201. data/spec/fixtures/sif/sif_response.xml +19 -0
  202. data/spec/fixtures/sif/sif_system_control.xml +10 -0
  203. data/spec/fixtures/sif/stu_pers_resp.xml +2 -0
  204. data/spec/fixtures/sif/student_personal.xml +42 -0
  205. data/spec/fixtures/zone.yaml +6 -0
  206. data/spec/message_builder_spec.rb +81 -0
  207. data/spec/response_spec.rb +35 -0
  208. data/spec/sif/representations/xml/header_spec.rb +30 -0
  209. data/spec/sif/representations/xml/message_spec.rb +20 -0
  210. data/spec/sif/representations/xml/object_data_spec.rb +19 -0
  211. data/spec/sif/representations/xml/protocol_spec.rb +34 -0
  212. data/spec/sif/representations/xml/provide_spec.rb +19 -0
  213. data/spec/sif/representations/xml/provision_spec.rb +56 -0
  214. data/spec/sif/representations/xml/register_spec.rb +17 -0
  215. data/spec/sif/representations/xml/request_spec.rb +17 -0
  216. data/spec/sif/representations/xml/response_spec.rb +16 -0
  217. data/spec/sif/representations/xml/spec_helper.rb +7 -0
  218. data/spec/sif/representations/xml/student_personal_spec.rb +69 -0
  219. data/spec/spec_helper.rb +7 -0
  220. data/spec/zone_spec.rb +26 -0
  221. metadata +455 -0
@@ -0,0 +1,20 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe SIF::Representation::Infra::Common::Message do
4
+ let(:xml) { File.read(fixture("sif/sif_message__response.xml")) }
5
+ let(:message) { SIF::Infra::Common::Message.new }
6
+ let(:rep) { SIF::Representation::Infra::Common::Message.new(message) }
7
+
8
+ before do
9
+ rep.from_xml(xml)
10
+ end
11
+
12
+ it "parses" do
13
+ message.version.should == "2.0r1"
14
+ end
15
+
16
+ it "converts to json" do
17
+ rep.to_json
18
+ end
19
+
20
+ end
@@ -0,0 +1,19 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe SIF::Representation::Infra::Common::ObjectData do
4
+ let(:xml) { File.read(fixture("sif/sif_object_data.xml")) }
5
+ let(:object_data) { SIF::Infra::Common::ObjectData.new }
6
+
7
+ before do
8
+ SIF::Representation::Infra::Common::ObjectData.new(object_data).from_xml(xml)
9
+ end
10
+
11
+ it "parses" do
12
+ object_data.student_personals.count.should == 3
13
+ object_data.objects.count.should == 3
14
+ end
15
+
16
+ it "has a datatype" do
17
+ object_data.datatype.should == :student_personal
18
+ end
19
+ end
@@ -0,0 +1,34 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe SIF::Representation::Infra::Common::Protocol do
4
+ let(:protocol) { SIF::Infra::Common::Protocol.new }
5
+
6
+ before do
7
+ SIF::Representation::Infra::Common::Protocol.new(protocol).from_xml(xml)
8
+ end
9
+
10
+ context "url" do
11
+ let(:xml) { File.read(fixture("sif/sif_protocol.xml")) }
12
+
13
+ it "parses" do
14
+ protocol.type.should == "HTTPS"
15
+ end
16
+
17
+ it "has url" do
18
+ protocol.url.should == "https://AcmeHost:8030/StudentAdmin"
19
+ end
20
+ end
21
+
22
+ context "properties" do
23
+ let(:xml) { File.read(fixture("sif/sif_protocol__properties.xml")) }
24
+
25
+ it "parses" do
26
+ protocol.type.should == "Custom"
27
+ end
28
+
29
+ it "has custom protocols" do
30
+ protocol.properties.size.should == 2
31
+ protocol.properties.map{ |p| p.name }.should == ["CN1", "CN2"]
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,19 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe SIF::Representation::Infra::Message::Provide do
4
+ let(:xml) { File.read(fixture("sif/sif_provide.xml")) }
5
+ let(:provide) { SIF::Infra::Message::Provide.new }
6
+
7
+ before do
8
+ SIF::Representation::Infra::Message::Provide.new(provide).from_xml(xml)
9
+ end
10
+
11
+ it "should parse" do
12
+ provide.header.msg_id.should == "34DC87FE3261545A31905937B265CE01"
13
+ provide.objects.size.should == 2
14
+ end
15
+
16
+ it "should list object_names" do
17
+ provide.object_names.should == ["StudentPersonal", "StudentSchoolEnrollment"]
18
+ end
19
+ end
@@ -0,0 +1,56 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe SIF::Representation::Infra::Message::Provision do
4
+ let(:xml) { File.read(fixture("sif/sif_provision.xml")) }
5
+ let(:provision) { SIF::Infra::Message::Provision.new }
6
+
7
+ before do
8
+ SIF::Representation::Infra::Message::Provision.new(provision).from_xml(xml)
9
+ end
10
+
11
+ it "parses" do
12
+ provision.header.msg_id.should == "A10F92EB649F4A648B5BFC44C7FD965C"
13
+ end
14
+
15
+ it "has provide_objects" do
16
+ provision.provide_objects.size.should == 2
17
+ provision.provide_objects.map{ |o| o.object_name }.should ==
18
+ ["StudentPersonal", "StudentSchoolEnrollment"]
19
+ end
20
+
21
+ it "has subscribe_objects" do
22
+ provision.subscribe_objects.size.should == 1
23
+ provision.subscribe_objects.map{ |o| o.object_name }.should ==
24
+ ["StudentPicture"]
25
+ end
26
+
27
+ it "has publish_add_objects" do
28
+ provision.publish_add_objects.size.should == 2
29
+ provision.publish_add_objects.map{ |o| o.object_name }.should ==
30
+ ["StudentPersonal", "StudentSchoolEnrollment"]
31
+ end
32
+
33
+ it "has publish_change_objects" do
34
+ provision.publish_change_objects.size.should == 2
35
+ provision.publish_change_objects.map{ |o| o.object_name }.should ==
36
+ ["StudentPersonal", "StudentSchoolEnrollment"]
37
+ end
38
+
39
+ it "has publish_delete_objects" do
40
+ provision.publish_delete_objects.size.should == 2
41
+ provision.publish_delete_objects.map{ |o| o.object_name }.should ==
42
+ ["StudentPersonal", "StudentSchoolEnrollment"]
43
+ end
44
+
45
+ it "has request_objects" do
46
+ provision.request_objects.size.should == 1
47
+ provision.request_objects.map{ |o| o.object_name }.should ==
48
+ ["StudentPicture"]
49
+ end
50
+
51
+ it "has respond_objects" do
52
+ provision.respond_objects.size.should == 2
53
+ provision.respond_objects.map{ |o| o.object_name }.should ==
54
+ ["StudentPersonal", "StudentSchoolEnrollment"]
55
+ end
56
+ end
@@ -0,0 +1,17 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe SIF::Representation::Infra::Message::Register do
4
+ let(:xml) { File.read(fixture("sif/sif_register.xml")) }
5
+ let(:register) { SIF::Infra::Message::Register.new }
6
+
7
+ before do
8
+ SIF::Representation::Infra::Message::Register.new(register).from_xml(xml)
9
+ end
10
+
11
+ it "parses" do
12
+ register.name.should == "Acme Agent for WAP 2.x"
13
+ register.max_buffer_size.should == 524288
14
+ register.protocol.secure.should be_true
15
+ register.application.version.should == '5.1.2'
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe SIF::Representation::Infra::Message::Request do
4
+ let(:xml) { File.read(fixture("sif/sif_request.xml")) }
5
+ let(:request) { SIF::Infra::Message::Request.new }
6
+
7
+ before do
8
+ SIF::Representation::Infra::Message::Request.new(request).from_xml(xml)
9
+ end
10
+
11
+ it "parses" do
12
+ request.version.should == "2.*"
13
+ request.max_buffer_size.should == 1048576
14
+ request.query.query_object.object_name.should == "LibraryPatronStatus"
15
+ request.query.condition_group.conditions.size.should == 1
16
+ end
17
+ end
@@ -0,0 +1,16 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe SIF::Representation::Infra::Message::Response do
4
+ let(:xml) { File.read(fixture("sif/sif_response.xml")) }
5
+ let(:response) { SIF::Infra::Message::Response.new }
6
+
7
+ before do
8
+ SIF::Representation::Infra::Message::Response.new(response).from_xml(xml)
9
+ end
10
+
11
+ it "parses" do
12
+ response.request_msg_id.should == "FE1078BA3261545A319059376B3A4898"
13
+ response.more_packets.should_not be_true
14
+ # response.object_data
15
+ end
16
+ end
@@ -0,0 +1,7 @@
1
+ $:.unshift(File.join(File.dirname(__FILE__), '..', '..', '..', 'lib'))
2
+
3
+ require 'sif/sif'
4
+
5
+ def fixture(file)
6
+ File.join(File.dirname(__FILE__), '..', '..', '..', 'fixtures', file)
7
+ end
@@ -0,0 +1,69 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe SIF::Representation::Model::Group::SIS::StudentPersonal do
4
+ # let(:xml) { File.read(fixture("sif/student_personal.xml")) }
5
+ # let(:student) { SIF::Model::Group::SIS::StudentPersonal.new }
6
+
7
+ # before do
8
+ # SIF::Representation::Model::Group::SIS::StudentPersonal.new(student).
9
+ # from_xml(xml)
10
+ # end
11
+
12
+ it "justworks" do
13
+ jwxml = <<-myxml
14
+ <user>
15
+ <addresses>
16
+ <address type="01">123 Street</address>
17
+ <address>123 Street</address>
18
+ <address type="02">Cardboard Box</address>
19
+ <address>Cardboard Box</address>
20
+ <address>10</address>
21
+ </addresses>
22
+ </user>
23
+ myxml
24
+
25
+
26
+ class Address
27
+ include Virtus.model
28
+
29
+ attribute :type, String
30
+ attribute :value, String
31
+ attribute :asint, Integer
32
+ end
33
+
34
+ class User
35
+ include Virtus.model
36
+ attribute :addresses, Array[Address]
37
+ end
38
+
39
+ class AddressRep < Representable::Decorator
40
+ include Representable::XML
41
+ self.representation_wrap = :address
42
+ property :type, :attribute => true
43
+ property :value, :as => 'address', :content => true
44
+ property :asint, :as => 'address', :content => true
45
+ end
46
+
47
+ class UserRep < Representable::Decorator
48
+ include Representable::XML
49
+ self.representation_wrap = :user
50
+ collection :addresses, :as => :address, :wrap => :addresses,
51
+ :class => Address, :decorator => AddressRep
52
+ end
53
+
54
+ user = User.new;
55
+ UserRep.new(user).from_xml(jwxml)
56
+ user.addresses.should_not == nil
57
+
58
+ end
59
+
60
+ # it "parses" do
61
+ # SIF::Representation::Model::Group::SIS::StudentPersonal.new(student).from_xml(xml);
62
+ # student.ref_id.should == "D3E34B359D75101A8C3D00AA001A1652"
63
+ # messages = student.alert_messages
64
+ # for message in messages
65
+ # message.type.should == "Legal"
66
+ # #message.value.should == "This is the Legal Alert for Joe Student"
67
+ # end
68
+ # end
69
+ end
@@ -0,0 +1,7 @@
1
+ require "webmock/rspec"
2
+
3
+ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
+
5
+ def fixture(file)
6
+ File.join(File.dirname(__FILE__), 'fixtures', file)
7
+ end
data/spec/zone_spec.rb ADDED
@@ -0,0 +1,26 @@
1
+ require_relative "spec_helper"
2
+ require "openagent/zone"
3
+ require "yaml"
4
+
5
+ describe OpenAgent::Zone do
6
+ context "initialize" do
7
+ let(:zone) { OpenAgent::Zone.new(:uri => "https://localhost:3000/") }
8
+
9
+ it "sets instance variables from config" do
10
+ zone.uri.should == "https://localhost:3000/"
11
+ end
12
+ end
13
+
14
+ context "from yaml" do
15
+ let(:zone) { OpenAgent::Zone.new(YAML.load(File.read(fixture("zone.yaml")))) }
16
+ it "sets instance variables from yaml file" do
17
+ zone.uri.should == "http://test.zone.url/zone"
18
+ zone.instance_variable_get("@uri").should == "http://test.zone.url/zone"
19
+ end
20
+
21
+ it "sets ssl_config" do
22
+ zone.ssl.verify_mode.should == 0
23
+ zone.ssl.cert_key.should == "cert key"
24
+ end
25
+ end
26
+ end
metadata ADDED
@@ -0,0 +1,455 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: openagent
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Christopher Whiteley
9
+ - Duane Johnson
10
+ - Eric Adams
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2013-11-15 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rake
18
+ requirement: !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
23
+ version: '0'
24
+ type: :development
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ! '>='
30
+ - !ruby/object:Gem::Version
31
+ version: '0'
32
+ - !ruby/object:Gem::Dependency
33
+ name: webmock
34
+ requirement: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ - !ruby/object:Gem::Dependency
49
+ name: bundler
50
+ requirement: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: 1.0.0
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: 1.0.0
64
+ - !ruby/object:Gem::Dependency
65
+ name: rspec
66
+ requirement: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ~>
70
+ - !ruby/object:Gem::Version
71
+ version: '2.6'
72
+ type: :development
73
+ prerelease: false
74
+ version_requirements: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ~>
78
+ - !ruby/object:Gem::Version
79
+ version: '2.6'
80
+ - !ruby/object:Gem::Dependency
81
+ name: debugger
82
+ requirement: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ - !ruby/object:Gem::Dependency
97
+ name: pry
98
+ requirement: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ! '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: uuid
114
+ requirement: !ruby/object:Gem::Requirement
115
+ none: false
116
+ requirements:
117
+ - - ! '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ type: :runtime
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ none: false
124
+ requirements:
125
+ - - ! '>='
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ - !ruby/object:Gem::Dependency
129
+ name: representable
130
+ requirement: !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ~>
134
+ - !ruby/object:Gem::Version
135
+ version: 1.7.2
136
+ type: :runtime
137
+ prerelease: false
138
+ version_requirements: !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ~>
142
+ - !ruby/object:Gem::Version
143
+ version: 1.7.2
144
+ - !ruby/object:Gem::Dependency
145
+ name: virtus
146
+ requirement: !ruby/object:Gem::Requirement
147
+ none: false
148
+ requirements:
149
+ - - ~>
150
+ - !ruby/object:Gem::Version
151
+ version: 1.0.0
152
+ type: :runtime
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ none: false
156
+ requirements:
157
+ - - ~>
158
+ - !ruby/object:Gem::Version
159
+ version: 1.0.0
160
+ description: OpenAgent - SIF ADK (SIF Agent Development Kit)
161
+ email:
162
+ - hello@openzis.org
163
+ - duane@instructure.com
164
+ - eadams@instructure.com
165
+ executables: []
166
+ extensions: []
167
+ extra_rdoc_files: []
168
+ files:
169
+ - openagent.gemspec
170
+ - README.md
171
+ - lib/openagent/agent.rb
172
+ - lib/openagent/client.rb
173
+ - lib/openagent/errors.rb
174
+ - lib/openagent/message_builder.rb
175
+ - lib/openagent/ssl_config.rb
176
+ - lib/openagent/version.rb
177
+ - lib/openagent/xml_helpers.rb
178
+ - lib/openagent/zone.rb
179
+ - lib/openagent.rb
180
+ - lib/sif/infra/common/application.rb
181
+ - lib/sif/infra/common/condition.rb
182
+ - lib/sif/infra/common/condition_group.rb
183
+ - lib/sif/infra/common/data.rb
184
+ - lib/sif/infra/common/error.rb
185
+ - lib/sif/infra/common/event.rb
186
+ - lib/sif/infra/common/event_object.rb
187
+ - lib/sif/infra/common/extended_query.rb
188
+ - lib/sif/infra/common/extended_query_results.rb
189
+ - lib/sif/infra/common/header.rb
190
+ - lib/sif/infra/common/message.rb
191
+ - lib/sif/infra/common/object.rb
192
+ - lib/sif/infra/common/object_data.rb
193
+ - lib/sif/infra/common/other_id.rb
194
+ - lib/sif/infra/common/property.rb
195
+ - lib/sif/infra/common/protocol.rb
196
+ - lib/sif/infra/common/provision.rb
197
+ - lib/sif/infra/common/query.rb
198
+ - lib/sif/infra/common/query_object.rb
199
+ - lib/sif/infra/common/secure_channel.rb
200
+ - lib/sif/infra/common/security.rb
201
+ - lib/sif/infra/common/status.rb
202
+ - lib/sif/infra/common/unprovision.rb
203
+ - lib/sif/infra/common/vendor.rb
204
+ - lib/sif/infra/messages/ack.rb
205
+ - lib/sif/infra/messages/event.rb
206
+ - lib/sif/infra/messages/get_agent_acl.rb
207
+ - lib/sif/infra/messages/get_message.rb
208
+ - lib/sif/infra/messages/get_zone_status.rb
209
+ - lib/sif/infra/messages/ping.rb
210
+ - lib/sif/infra/messages/provide.rb
211
+ - lib/sif/infra/messages/provision.rb
212
+ - lib/sif/infra/messages/register.rb
213
+ - lib/sif/infra/messages/request.rb
214
+ - lib/sif/infra/messages/responder.rb
215
+ - lib/sif/infra/messages/response.rb
216
+ - lib/sif/infra/messages/sleep.rb
217
+ - lib/sif/infra/messages/subscribe.rb
218
+ - lib/sif/infra/messages/system_control.rb
219
+ - lib/sif/infra/messages/system_control_data.rb
220
+ - lib/sif/infra/messages/unprovide.rb
221
+ - lib/sif/infra/messages/unregister.rb
222
+ - lib/sif/infra/messages/unsubscribe.rb
223
+ - lib/sif/infra/messages/wakeup.rb
224
+ - lib/sif/infra/messages/zone_status_role.rb
225
+ - lib/sif/infra/objects/agent_acl.rb
226
+ - lib/sif/infra/objects/zone_status.rb
227
+ - lib/sif/models/common/address.rb
228
+ - lib/sif/models/common/alert_message.rb
229
+ - lib/sif/models/common/base_name.rb
230
+ - lib/sif/models/common/calendar_summary.rb
231
+ - lib/sif/models/common/code.rb
232
+ - lib/sif/models/common/contact_info.rb
233
+ - lib/sif/models/common/credits_attempted.rb
234
+ - lib/sif/models/common/demographics.rb
235
+ - lib/sif/models/common/dwelling_arrangement.rb
236
+ - lib/sif/models/common/earned_status.rb
237
+ - lib/sif/models/common/electronic_id.rb
238
+ - lib/sif/models/common/email.rb
239
+ - lib/sif/models/common/english_proficiency.rb
240
+ - lib/sif/models/common/exceptionality_category.rb
241
+ - lib/sif/models/common/grade_level.rb
242
+ - lib/sif/models/common/grid_location.rb
243
+ - lib/sif/models/common/identification_info.rb
244
+ - lib/sif/models/common/language.rb
245
+ - lib/sif/models/common/meal_status.rb
246
+ - lib/sif/models/common/medical_alert_message.rb
247
+ - lib/sif/models/common/meeting_time.rb
248
+ - lib/sif/models/common/name.rb
249
+ - lib/sif/models/common/other_code.rb
250
+ - lib/sif/models/common/other_id.rb
251
+ - lib/sif/models/common/phone_number.rb
252
+ - lib/sif/models/common/principal_info.rb
253
+ - lib/sif/models/common/race.rb
254
+ - lib/sif/models/common/sced_code.rb
255
+ - lib/sif/models/common/schedule_info.rb
256
+ - lib/sif/models/common/schedule_info_override.rb
257
+ - lib/sif/models/common/school_contact.rb
258
+ - lib/sif/models/common/school_course_info_override.rb
259
+ - lib/sif/models/common/street.rb
260
+ - lib/sif/models/common/subject_area.rb
261
+ - lib/sif/models/groups/data_model/term_span.rb
262
+ - lib/sif/models/groups/sis/attendance_code_info.rb
263
+ - lib/sif/models/groups/sis/calendar_date.rb
264
+ - lib/sif/models/groups/sis/discipline_incident.rb
265
+ - lib/sif/models/groups/sis/lea_info.rb
266
+ - lib/sif/models/groups/sis/personal_representer.rb
267
+ - lib/sif/models/groups/sis/school_course_info.rb
268
+ - lib/sif/models/groups/sis/school_info.rb
269
+ - lib/sif/models/groups/sis/section_info.rb
270
+ - lib/sif/models/groups/sis/sis_representer.rb
271
+ - lib/sif/models/groups/sis/staff_personal.rb
272
+ - lib/sif/models/groups/sis/student_personal.rb
273
+ - lib/sif/models/groups/sis/student_section_enrollment.rb
274
+ - lib/sif/models/groups/sis/term_info.rb
275
+ - lib/sif/representations/infra/common/application.rb
276
+ - lib/sif/representations/infra/common/condition.rb
277
+ - lib/sif/representations/infra/common/condition_group.rb
278
+ - lib/sif/representations/infra/common/data.rb
279
+ - lib/sif/representations/infra/common/error.rb
280
+ - lib/sif/representations/infra/common/event.rb
281
+ - lib/sif/representations/infra/common/event_object.rb
282
+ - lib/sif/representations/infra/common/extended_query.rb
283
+ - lib/sif/representations/infra/common/extended_query_results.rb
284
+ - lib/sif/representations/infra/common/header.rb
285
+ - lib/sif/representations/infra/common/message.rb
286
+ - lib/sif/representations/infra/common/object.rb
287
+ - lib/sif/representations/infra/common/object_data.rb
288
+ - lib/sif/representations/infra/common/other_id.rb
289
+ - lib/sif/representations/infra/common/property.rb
290
+ - lib/sif/representations/infra/common/protocol.rb
291
+ - lib/sif/representations/infra/common/provision.rb
292
+ - lib/sif/representations/infra/common/query.rb
293
+ - lib/sif/representations/infra/common/query_object.rb
294
+ - lib/sif/representations/infra/common/secure_channel.rb
295
+ - lib/sif/representations/infra/common/security.rb
296
+ - lib/sif/representations/infra/common/status.rb
297
+ - lib/sif/representations/infra/messages/ack.rb
298
+ - lib/sif/representations/infra/messages/event.rb
299
+ - lib/sif/representations/infra/messages/get_message.rb
300
+ - lib/sif/representations/infra/messages/ping.rb
301
+ - lib/sif/representations/infra/messages/provide.rb
302
+ - lib/sif/representations/infra/messages/provision.rb
303
+ - lib/sif/representations/infra/messages/register.rb
304
+ - lib/sif/representations/infra/messages/request.rb
305
+ - lib/sif/representations/infra/messages/response.rb
306
+ - lib/sif/representations/infra/messages/sleep.rb
307
+ - lib/sif/representations/infra/messages/subscribe.rb
308
+ - lib/sif/representations/infra/messages/system_control.rb
309
+ - lib/sif/representations/infra/messages/system_control_data.rb
310
+ - lib/sif/representations/infra/messages/wakeup.rb
311
+ - lib/sif/representations/models/common/address.rb
312
+ - lib/sif/representations/models/common/alert_message.rb
313
+ - lib/sif/representations/models/common/contact_info.rb
314
+ - lib/sif/representations/models/common/credits_attempted.rb
315
+ - lib/sif/representations/models/common/demographics.rb
316
+ - lib/sif/representations/models/common/dwelling_arrangement.rb
317
+ - lib/sif/representations/models/common/electronic_id.rb
318
+ - lib/sif/representations/models/common/email.rb
319
+ - lib/sif/representations/models/common/english_proficiency.rb
320
+ - lib/sif/representations/models/common/identification_info.rb
321
+ - lib/sif/representations/models/common/language.rb
322
+ - lib/sif/representations/models/common/medical_alert_message.rb
323
+ - lib/sif/representations/models/common/meeting_time.rb
324
+ - lib/sif/representations/models/common/name.rb
325
+ - lib/sif/representations/models/common/other_code.rb
326
+ - lib/sif/representations/models/common/other_id.rb
327
+ - lib/sif/representations/models/common/phone_number.rb
328
+ - lib/sif/representations/models/common/principal_info.rb
329
+ - lib/sif/representations/models/common/race.rb
330
+ - lib/sif/representations/models/common/sced_code.rb
331
+ - lib/sif/representations/models/common/schedule_info.rb
332
+ - lib/sif/representations/models/common/schedule_info_override.rb
333
+ - lib/sif/representations/models/common/school_contact.rb
334
+ - lib/sif/representations/models/common/school_course_info_override.rb
335
+ - lib/sif/representations/models/common/street.rb
336
+ - lib/sif/representations/models/common/subject_area.rb
337
+ - lib/sif/representations/models/groups/data_model/term_span.rb
338
+ - lib/sif/representations/models/groups/sis/personal_representer.rb
339
+ - lib/sif/representations/models/groups/sis/school_course_info.rb
340
+ - lib/sif/representations/models/groups/sis/school_info.rb
341
+ - lib/sif/representations/models/groups/sis/section_info.rb
342
+ - lib/sif/representations/models/groups/sis/sis_representer.rb
343
+ - lib/sif/representations/models/groups/sis/staff_personal.rb
344
+ - lib/sif/representations/models/groups/sis/student_personal.rb
345
+ - lib/sif/representations/models/groups/sis/student_section_enrollment.rb
346
+ - lib/sif/representations/models/groups/sis/term_info.rb
347
+ - lib/sif/sif.rb
348
+ - spec/agent_spec.rb
349
+ - spec/client_spec.rb
350
+ - spec/fixtures/agent.yaml
351
+ - spec/fixtures/messages/event.xml
352
+ - spec/fixtures/messages/response.xml
353
+ - spec/fixtures/sif/attendance_code_info.xml
354
+ - spec/fixtures/sif/calendar_date.xml
355
+ - spec/fixtures/sif/calendar_summary.xml
356
+ - spec/fixtures/sif/demographics.xml
357
+ - spec/fixtures/sif/discipline_incident.xml
358
+ - spec/fixtures/sif/lea_info.xml
359
+ - spec/fixtures/sif/section_info.xml
360
+ - spec/fixtures/sif/sif_header.xml
361
+ - spec/fixtures/sif/sif_message__response.xml
362
+ - spec/fixtures/sif/sif_object_data.xml
363
+ - spec/fixtures/sif/sif_protocol.xml
364
+ - spec/fixtures/sif/sif_protocol__properties.xml
365
+ - spec/fixtures/sif/sif_provide.xml
366
+ - spec/fixtures/sif/sif_provision.xml
367
+ - spec/fixtures/sif/sif_register.xml
368
+ - spec/fixtures/sif/sif_request.xml
369
+ - spec/fixtures/sif/sif_response.xml
370
+ - spec/fixtures/sif/sif_system_control.xml
371
+ - spec/fixtures/sif/stu_pers_resp.xml
372
+ - spec/fixtures/sif/student_personal.xml
373
+ - spec/fixtures/zone.yaml
374
+ - spec/message_builder_spec.rb
375
+ - spec/response_spec.rb
376
+ - spec/sif/representations/xml/header_spec.rb
377
+ - spec/sif/representations/xml/message_spec.rb
378
+ - spec/sif/representations/xml/object_data_spec.rb
379
+ - spec/sif/representations/xml/protocol_spec.rb
380
+ - spec/sif/representations/xml/provide_spec.rb
381
+ - spec/sif/representations/xml/provision_spec.rb
382
+ - spec/sif/representations/xml/register_spec.rb
383
+ - spec/sif/representations/xml/request_spec.rb
384
+ - spec/sif/representations/xml/response_spec.rb
385
+ - spec/sif/representations/xml/spec_helper.rb
386
+ - spec/sif/representations/xml/student_personal_spec.rb
387
+ - spec/spec_helper.rb
388
+ - spec/zone_spec.rb
389
+ homepage: http://github.com/cwhiteley/openagent
390
+ licenses: []
391
+ post_install_message:
392
+ rdoc_options: []
393
+ require_paths:
394
+ - lib
395
+ required_ruby_version: !ruby/object:Gem::Requirement
396
+ none: false
397
+ requirements:
398
+ - - ! '>='
399
+ - !ruby/object:Gem::Version
400
+ version: 1.9.0
401
+ required_rubygems_version: !ruby/object:Gem::Requirement
402
+ none: false
403
+ requirements:
404
+ - - ! '>='
405
+ - !ruby/object:Gem::Version
406
+ version: '0'
407
+ requirements: []
408
+ rubyforge_project:
409
+ rubygems_version: 1.8.23
410
+ signing_key:
411
+ specification_version: 3
412
+ summary: OpenAgent is a SIF Agent Development Kit
413
+ test_files:
414
+ - spec/agent_spec.rb
415
+ - spec/client_spec.rb
416
+ - spec/fixtures/agent.yaml
417
+ - spec/fixtures/messages/event.xml
418
+ - spec/fixtures/messages/response.xml
419
+ - spec/fixtures/sif/attendance_code_info.xml
420
+ - spec/fixtures/sif/calendar_date.xml
421
+ - spec/fixtures/sif/calendar_summary.xml
422
+ - spec/fixtures/sif/demographics.xml
423
+ - spec/fixtures/sif/discipline_incident.xml
424
+ - spec/fixtures/sif/lea_info.xml
425
+ - spec/fixtures/sif/section_info.xml
426
+ - spec/fixtures/sif/sif_header.xml
427
+ - spec/fixtures/sif/sif_message__response.xml
428
+ - spec/fixtures/sif/sif_object_data.xml
429
+ - spec/fixtures/sif/sif_protocol.xml
430
+ - spec/fixtures/sif/sif_protocol__properties.xml
431
+ - spec/fixtures/sif/sif_provide.xml
432
+ - spec/fixtures/sif/sif_provision.xml
433
+ - spec/fixtures/sif/sif_register.xml
434
+ - spec/fixtures/sif/sif_request.xml
435
+ - spec/fixtures/sif/sif_response.xml
436
+ - spec/fixtures/sif/sif_system_control.xml
437
+ - spec/fixtures/sif/stu_pers_resp.xml
438
+ - spec/fixtures/sif/student_personal.xml
439
+ - spec/fixtures/zone.yaml
440
+ - spec/message_builder_spec.rb
441
+ - spec/response_spec.rb
442
+ - spec/sif/representations/xml/header_spec.rb
443
+ - spec/sif/representations/xml/message_spec.rb
444
+ - spec/sif/representations/xml/object_data_spec.rb
445
+ - spec/sif/representations/xml/protocol_spec.rb
446
+ - spec/sif/representations/xml/provide_spec.rb
447
+ - spec/sif/representations/xml/provision_spec.rb
448
+ - spec/sif/representations/xml/register_spec.rb
449
+ - spec/sif/representations/xml/request_spec.rb
450
+ - spec/sif/representations/xml/response_spec.rb
451
+ - spec/sif/representations/xml/spec_helper.rb
452
+ - spec/sif/representations/xml/student_personal_spec.rb
453
+ - spec/spec_helper.rb
454
+ - spec/zone_spec.rb
455
+ has_rdoc: