openagent 0.9.4 → 0.9.5
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.
- data/lib/openagent/message_builder.rb +20 -15
- data/lib/openagent/version.rb +1 -1
- data/openagent.gemspec +2 -1
- data/spec/event_spec.rb +3 -3
- data/spec/response_spec.rb +1 -1
- data/spec/sif/representations/xml/message_spec.rb +0 -5
- data/spec/sif/representations/xml/request_spec.rb +0 -1
- metadata +22 -6
@@ -24,39 +24,44 @@ module OpenAgent
|
|
24
24
|
)
|
25
25
|
)
|
26
26
|
end
|
27
|
+
|
27
28
|
def condition(cond={})
|
28
29
|
SIF::Infra::Common::Condition.new(
|
29
|
-
:element
|
30
|
-
:value
|
30
|
+
:element => cond['element'],
|
31
|
+
:value => cond['value'],
|
31
32
|
:operator => cond['operator']
|
32
33
|
)
|
33
34
|
end
|
34
35
|
|
35
|
-
def conditions(
|
36
|
-
return false if
|
37
|
-
|
38
|
-
# require 'pry' ; binding.pry
|
36
|
+
def conditions(conds={})
|
37
|
+
return false if conds.empty?
|
38
|
+
conds.map do |c|
|
39
39
|
SIF::Infra::Common::Conditions.new(
|
40
|
-
:type
|
40
|
+
:type => c['cond_type'],
|
41
41
|
:condition => condition(c)
|
42
42
|
)
|
43
43
|
end
|
44
44
|
end
|
45
|
-
|
46
|
-
|
47
|
-
if
|
45
|
+
|
46
|
+
def conditions_group(conds={})
|
47
|
+
return false if conds.nil? || conds['conditions'].nil?
|
48
|
+
|
49
|
+
case conds['conditions'].size
|
50
|
+
when 0
|
51
|
+
return false
|
52
|
+
when 1
|
48
53
|
SIF::Infra::Common::ConditionGroup.new(
|
49
|
-
:type
|
50
|
-
:conditions => conditions(
|
54
|
+
:type => 'None',
|
55
|
+
:conditions => conditions(conds['conditions'])
|
51
56
|
)
|
52
57
|
else
|
53
58
|
SIF::Infra::Common::ConditionGroup.new(
|
54
|
-
:type
|
55
|
-
:conditions => conditions(
|
59
|
+
:type => conds['group_type'],
|
60
|
+
:conditions => conditions(conds['conditions'])
|
56
61
|
)
|
57
62
|
end
|
58
63
|
end
|
59
|
-
#
|
64
|
+
# conds should = {:type=>"None", :conditions=>[{:type=>"None", :element=>"@SchoolYear", :value=>"2014", :operator=>"EQ"}]}
|
60
65
|
|
61
66
|
def request(object_name, condition_arr={})
|
62
67
|
SIF::Infra::Common::Message.new(
|
data/lib/openagent/version.rb
CHANGED
data/openagent.gemspec
CHANGED
@@ -29,7 +29,8 @@ Gem::Specification.new do |gem|
|
|
29
29
|
gem.add_development_dependency "debugger"
|
30
30
|
gem.add_development_dependency "pry"
|
31
31
|
|
32
|
-
gem.add_dependency "uuid"
|
32
|
+
gem.add_dependency "uuid", "2.3.7"
|
33
|
+
gem.add_dependency "macaddr", "1.6.1"
|
33
34
|
gem.add_dependency "representable", "~> 1.7.3"
|
34
35
|
gem.add_dependency "virtus", "~> 1.0.0"
|
35
36
|
gem.add_dependency "activesupport"
|
data/spec/event_spec.rb
CHANGED
@@ -5,9 +5,9 @@ require "openagent"
|
|
5
5
|
|
6
6
|
describe OpenAgent::Client do
|
7
7
|
let(:message) { SIF::Infra::Common::Message.new }
|
8
|
-
let(:grading_assignment_xml) {File.read('
|
9
|
-
let(:grading_assignment_score_xml) {File.read('
|
10
|
-
let(:grading_category_xml) {File.read('
|
8
|
+
let(:grading_assignment_xml) {File.read(fixture('sif/grading_assignment.xml'))}
|
9
|
+
let(:grading_assignment_score_xml) {File.read(fixture('sif/grading_assignment_score.xml'))}
|
10
|
+
let(:grading_category_xml) {File.read(fixture('sif/grading_category.xml'))}
|
11
11
|
let(:agent) { OpenAgent::Agent.new(YAML::load(File.read(fixture("agent.yaml")))) }
|
12
12
|
let(:zone) { OpenAgent::Zone.new(YAML::load(File.read(fixture("zone.yaml")))) }
|
13
13
|
|
data/spec/response_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require "openagent/client"
|
|
3
3
|
|
4
4
|
describe OpenAgent::Client do
|
5
5
|
let(:response) { SIF::Infra::Common::Message.new }
|
6
|
-
let(:xml) {File.read('
|
6
|
+
let(:xml) { File.read(fixture('sif/stu_pers_resp.xml')) }
|
7
7
|
|
8
8
|
before do
|
9
9
|
representer = SIF::Representation::Infra::Common::Message
|
@@ -12,6 +12,5 @@ describe SIF::Representation::Infra::Message::Request do
|
|
12
12
|
request.version.should == "2.*"
|
13
13
|
request.max_buffer_size.should == 1048576
|
14
14
|
request.query.query_object.object_name.should == "LibraryPatronStatus"
|
15
|
-
request.query.condition_group.conditions.size.should == 1
|
16
15
|
end
|
17
16
|
end
|
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.9.
|
4
|
+
version: 0.9.5
|
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: 2014-02-
|
14
|
+
date: 2014-02-19 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rake
|
@@ -114,17 +114,33 @@ dependencies:
|
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
115
115
|
none: false
|
116
116
|
requirements:
|
117
|
-
- -
|
117
|
+
- - '='
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version:
|
119
|
+
version: 2.3.7
|
120
120
|
type: :runtime
|
121
121
|
prerelease: false
|
122
122
|
version_requirements: !ruby/object:Gem::Requirement
|
123
123
|
none: false
|
124
124
|
requirements:
|
125
|
-
- -
|
125
|
+
- - '='
|
126
126
|
- !ruby/object:Gem::Version
|
127
|
-
version:
|
127
|
+
version: 2.3.7
|
128
|
+
- !ruby/object:Gem::Dependency
|
129
|
+
name: macaddr
|
130
|
+
requirement: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
132
|
+
requirements:
|
133
|
+
- - '='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: 1.6.1
|
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.6.1
|
128
144
|
- !ruby/object:Gem::Dependency
|
129
145
|
name: representable
|
130
146
|
requirement: !ruby/object:Gem::Requirement
|