amee 2.3.1 → 2.4.0
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/amee/collection.rb +4 -2
- data/lib/amee/data_category.rb +2 -2
- data/lib/amee/version.rb +2 -2
- metadata +5 -5
data/lib/amee/collection.rb
CHANGED
@@ -2,11 +2,12 @@ module AMEE
|
|
2
2
|
class Collection < Array
|
3
3
|
include ParseHelper
|
4
4
|
attr_reader :pager,:connection,:doc,:json,:response
|
5
|
-
def initialize(connection, options = {})
|
5
|
+
def initialize(connection, options = {}, &block)
|
6
6
|
# Load data from path
|
7
7
|
@options=options
|
8
8
|
@max=options.delete :resultMax
|
9
9
|
@connection=connection
|
10
|
+
@filter = block
|
10
11
|
# Parse data from response
|
11
12
|
each_page do
|
12
13
|
parse_page
|
@@ -29,7 +30,8 @@ module AMEE
|
|
29
30
|
REXML::XPath.each(doc, xmlcollectorpath) do |p|
|
30
31
|
obj=klass.new(parse_xml(p))
|
31
32
|
obj.connection = connection
|
32
|
-
|
33
|
+
x= @filter ? @filter.call(obj) : obj
|
34
|
+
self << x if x
|
33
35
|
break if @max&&length>=@max
|
34
36
|
end
|
35
37
|
end
|
data/lib/amee/data_category.rb
CHANGED
@@ -68,8 +68,8 @@ module AMEE
|
|
68
68
|
data[:uid] = x '@uid'
|
69
69
|
data[:created] = DateTime.parse(REXML::XPath.first(doc, "/Resources/DataCategoryResource/DataCategory/@created").to_s)
|
70
70
|
data[:modified] = DateTime.parse(REXML::XPath.first(doc, "/Resources/DataCategoryResource/DataCategory/@modified").to_s)
|
71
|
-
data[:name] = REXML::XPath.first(doc, '/Resources/DataCategoryResource/DataCategory
|
72
|
-
data[:path] = REXML::XPath.first(doc, '/Resources/DataCategoryResource
|
71
|
+
data[:name] = (REXML::XPath.first(doc, '/Resources/DataCategoryResource/DataCategory/Name') || REXML::XPath.first(doc, '/Resources/DataCategoryResource/DataCategory/name')).text
|
72
|
+
data[:path] = (REXML::XPath.first(doc, '/Resources/DataCategoryResource/Path') || REXML::XPath.first(doc, '/Resources/DataCategoryResource/DataCategory/path')).text || ""
|
73
73
|
data[:pager] = AMEE::Pager.from_xml(REXML::XPath.first(doc, '//Pager'))
|
74
74
|
itemdefattrib=REXML::XPath.first(doc, '/Resources/DataCategoryResource//ItemDefinition/@uid')
|
75
75
|
data[:itemdef] = itemdefattrib ? itemdefattrib.to_s : nil
|
data/lib/amee/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 2.
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
version: 2.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- James Smith
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-10-12 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|