amee 2.3.1 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- self << obj
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
@@ -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/?ame').text
72
- data[:path] = REXML::XPath.first(doc, '/Resources/DataCategoryResource//?ath').text || ""
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
@@ -2,8 +2,8 @@ module AMEE
2
2
 
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = 2
5
- MINOR = 3
6
- TINY = 1
5
+ MINOR = 4
6
+ TINY = 0
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
9
9
 
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: 1
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
- - 3
9
- - 1
10
- version: 2.3.1
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-09-24 00:00:00 +01:00
18
+ date: 2010-10-12 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency