openagent 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 => cond['element'],
30
- :value => cond['value'],
30
+ :element => cond['element'],
31
+ :value => cond['value'],
31
32
  :operator => cond['operator']
32
33
  )
33
34
  end
34
35
 
35
- def conditions(condition_arr={})
36
- return false if condition_arr.count == 0
37
- condition_arr.map do |c|
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 => c['cond_type'],
40
+ :type => c['cond_type'],
41
41
  :condition => condition(c)
42
42
  )
43
43
  end
44
44
  end
45
- def conditions_group(condition_arr={})
46
- return false if condition_arr.nil? || condition_arr['conditions'].count == 0
47
- if condition_arr['conditions'].count == 1
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 => 'None',
50
- :conditions => conditions(condition_arr['conditions'])
54
+ :type => 'None',
55
+ :conditions => conditions(conds['conditions'])
51
56
  )
52
57
  else
53
58
  SIF::Infra::Common::ConditionGroup.new(
54
- :type => condition_arr['group_type'],
55
- :conditions => conditions(condition_arr['conditions'])
59
+ :type => conds['group_type'],
60
+ :conditions => conditions(conds['conditions'])
56
61
  )
57
62
  end
58
63
  end
59
- #Condition_hash should = {:type=>"None", :conditions=>[{:type=>"None", :element=>"@SchoolYear", :value=>"2014", :operator=>"EQ"}]}
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(
@@ -1,3 +1,3 @@
1
1
  module OpenAgent
2
- VERSION = '0.9.4' unless defined?(OpenAgent::VERSION)
2
+ VERSION = '0.9.5' unless defined?(OpenAgent::VERSION)
3
3
  end
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('./spec/fixtures/sif/grading_assignment.xml')}
9
- let(:grading_assignment_score_xml) {File.read('./spec/fixtures/sif/grading_assignment_score.xml')}
10
- let(:grading_category_xml) {File.read('./spec/fixtures/sif/grading_category.xml')}
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
 
@@ -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('./spec/fixtures/sif/stu_pers_resp.xml')}
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
@@ -13,9 +13,4 @@ describe SIF::Representation::Infra::Common::Message do
13
13
  message.version.should == "2.0r1"
14
14
  end
15
15
 
16
- it "converts to json" do
17
- rep
18
- rep.to_json
19
- end
20
-
21
16
  end
@@ -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
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 00:00:00.000000000 Z
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: '0'
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: '0'
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