openagent 0.7.7 → 0.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  module OpenAgent
2
- VERSION = '0.7.7' unless defined?(OpenAgent::VERSION)
2
+ VERSION = '0.7.8' unless defined?(OpenAgent::VERSION)
3
3
  end
@@ -0,0 +1,12 @@
1
+ module SIF
2
+ module Model
3
+ module Common
4
+ class ExtendedElement
5
+ include Virtus.model
6
+
7
+ attribute :name, String
8
+ attribute :value
9
+ end
10
+ end
11
+ end
12
+ end
@@ -19,6 +19,9 @@ module SIF
19
19
  def first_email
20
20
  emails.map{ |email| email.value.split(/[,;\s]\s?/) }.flatten.first
21
21
  end
22
+ def email
23
+ first_email
24
+ end
22
25
  end
23
26
  end
24
27
  end
@@ -5,9 +5,21 @@ module SIF
5
5
  module SISRepresenter
6
6
  include Virtus.model
7
7
 
8
- attribute :extended_elements, String
8
+ attribute :extended_elements, Array[MODEL_COMMON::ExtendedElement]
9
9
  attribute :metadata, String
10
10
  attribute :ref_id, String
11
+
12
+ def find_element(name)
13
+ el = extended_elements.find{ |e| e.name == name }
14
+ el ? el.value : nil
15
+ end
16
+
17
+ def username
18
+ find_element("USERNAME")
19
+ end
20
+ def password
21
+ find_element("PASSWORD")
22
+ end
11
23
  end
12
24
  end
13
25
  end
@@ -30,6 +30,13 @@ module SIF
30
30
 
31
31
  attribute :alert_messages, Array[Common::AlertMessage]
32
32
  attribute :medical_alert_messages, Array[Common::MedicalAlertMessage]
33
+
34
+ def student_email
35
+ find_element("STUDENT_EMAIL")
36
+ end
37
+ def email
38
+ student_email || first_email
39
+ end
33
40
  end
34
41
  end
35
42
  end
@@ -16,7 +16,9 @@ module SIF
16
16
  property :state_province, :as => 'StateProvince'
17
17
  property :country, :as => 'Country'
18
18
  property :postal_code, :as => 'PostalCode'
19
- property :grid_location, :as => 'GridLocation'
19
+ property :grid_location, :as => 'GridLocation',
20
+ :class => MODEL_COMMON::GridLocation,
21
+ :decorator => REPR_COMMON::GridLocation
20
22
  end
21
23
  end
22
24
  end
@@ -0,0 +1,17 @@
1
+ module SIF
2
+ module Representation
3
+ module Model
4
+ module Common
5
+ module ExtendedElement
6
+ include Representable::XML
7
+
8
+ self.representation_wrap = 'SIF_ExtendedElement'
9
+
10
+ property :name, :as => 'Name', :attribute => true
11
+ property :value, :content => true
12
+
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,16 @@
1
+ module SIF
2
+ module Representation
3
+ module Model
4
+ module Common
5
+ class GridLocation < SIF::Represent
6
+
7
+ self.representation_wrap = 'GridLocation'
8
+
9
+ property :latitude, :as => 'Latitude'
10
+ property :longitude, :as => 'Longitude'
11
+
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -8,7 +8,9 @@ module SIF
8
8
 
9
9
  property :ref_id, :attribute => true, :as => 'RefId'
10
10
  property :metadata, :as => 'SIF_Metadata'
11
- property :extended_elements, :as => 'SIF_ExtendedElements'
11
+ collection :extended_elements, :as => 'SIF_ExtendedElement', :wrap => 'SIF_ExtendedElements',
12
+ :class => MODEL_COMMON::ExtendedElement,
13
+ :decorator => REPR_COMMON::ExtendedElement
12
14
  end
13
15
  end
14
16
  end
data/lib/sif/sif.rb CHANGED
@@ -77,6 +77,7 @@ module SIF
77
77
  autoload :EnglishProficiency, 'sif/models/common/english_proficiency'
78
78
  autoload :Email, 'sif/models/common/email'
79
79
  autoload :ExceptionalityCategory, 'sif/models/common/exceptionality_category'
80
+ autoload :ExtendedElement, 'sif/models/common/extended_element'
80
81
  autoload :GradeLevel, 'sif/models/common/grade_level'
81
82
  autoload :GridLocation, 'sif/models/common/grid_location'
82
83
  autoload :IdentificationInfo, 'sif/models/common/identification_info'
@@ -194,6 +195,7 @@ module SIF
194
195
  autoload :EnglishProficiency, 'sif/representations/models/common/english_proficiency'
195
196
  autoload :Email, 'sif/representations/models/common/email'
196
197
  autoload :ExceptionalityCategory, 'sif/representations/models/common/exceptionality_category'
198
+ autoload :ExtendedElement, 'sif/representations/models/common/extended_element'
197
199
  autoload :GradeLevel, 'sif/representations/models/common/grade_level'
198
200
  autoload :GridLocation, 'sif/representations/models/common/grid_location'
199
201
  autoload :IdentificationInfo, 'sif/representations/models/common/identification_info'
@@ -28,6 +28,10 @@
28
28
  <StateProvince>IL</StateProvince>
29
29
  <Country>US</Country>
30
30
  <PostalCode>60660</PostalCode>
31
+ <GridLocation>
32
+ <Latitude>39.00522</Latitude>
33
+ <Longitude>-95.645111</Longitude>
34
+ </GridLocation>
31
35
  </Address>
32
36
  </AddressList>
33
37
  <PhoneNumberList>
@@ -39,4 +43,9 @@
39
43
  <Email Type="Primary">Joe.Student@anyschool.com</Email>
40
44
  </EmailList>
41
45
  <OnTimeGraduationYear>2007</OnTimeGraduationYear>
46
+ <SIF_ExtendedElements>
47
+ <SIF_ExtendedElement Name="STUDENT_EMAIL">email@anyschool.net</SIF_ExtendedElement>
48
+ <SIF_ExtendedElement Name="PASSWORD">some_P@ssw0rd</SIF_ExtendedElement>
49
+ <SIF_ExtendedElement Name="USERNAME">some_username</SIF_ExtendedElement>
50
+ </SIF_ExtendedElements>
42
51
  </StudentPersonal>
@@ -83,8 +83,12 @@ describe SIF::Representation::Model::Group::SIS::StudentPersonal do
83
83
  :city => 'Chicago',
84
84
  :state_province => 'IL',
85
85
  :country => 'US',
86
- :postal_code => '60660'
87
- )
86
+ :postal_code => '60660',
87
+ :grid_location => SIF::Model::Common::GridLocation.new(
88
+ :latitude => 39.00522,
89
+ :longitude => -95.645111
90
+ ),
91
+ ),
88
92
  ],
89
93
  :phone_numbers => [
90
94
  SIF::Model::Common::PhoneNumber.new(
@@ -96,9 +100,22 @@ describe SIF::Representation::Model::Group::SIS::StudentPersonal do
96
100
  :type => 'Primary',
97
101
  :value => 'Joe.Student@anyschool.com'
98
102
  ],
99
- :on_time_graduation_year => 2007
103
+ :on_time_graduation_year => 2007,
104
+ :extended_elements => [
105
+ SIF::Model::Common::ExtendedElement.new(
106
+ :name => 'STUDENT_EMAIL',
107
+ :value => 'email@anyschool.net'
108
+ ),
109
+ SIF::Model::Common::ExtendedElement.new(
110
+ :name => 'PASSWORD',
111
+ :value => 'some_P@ssw0rd'
112
+ ),
113
+ SIF::Model::Common::ExtendedElement.new(
114
+ :name => 'USERNAME',
115
+ :value => 'some_username'
116
+ ),
117
+ ],
100
118
  )
101
-
102
119
  orig_xml = SIF::Representation::Model::Group::SIS::StudentPersonal.new(student).to_xml
103
120
  new_xml = SIF::Representation::Model::Group::SIS::StudentPersonal.new(new_student).to_xml
104
121
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openagent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.7
4
+ version: 0.7.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-11-27 00:00:00.000000000 Z
14
+ date: 2013-12-04 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
@@ -239,6 +239,7 @@ files:
239
239
  - lib/sif/models/common/email.rb
240
240
  - lib/sif/models/common/english_proficiency.rb
241
241
  - lib/sif/models/common/exceptionality_category.rb
242
+ - lib/sif/models/common/extended_element.rb
242
243
  - lib/sif/models/common/grade_level.rb
243
244
  - lib/sif/models/common/grid_location.rb
244
245
  - lib/sif/models/common/identification_info.rb
@@ -318,6 +319,8 @@ files:
318
319
  - lib/sif/representations/models/common/electronic_id.rb
319
320
  - lib/sif/representations/models/common/email.rb
320
321
  - lib/sif/representations/models/common/english_proficiency.rb
322
+ - lib/sif/representations/models/common/extended_element.rb
323
+ - lib/sif/representations/models/common/grid_location.rb
321
324
  - lib/sif/representations/models/common/identification_info.rb
322
325
  - lib/sif/representations/models/common/language.rb
323
326
  - lib/sif/representations/models/common/medical_alert_message.rb