lib/cts/mpx/driver/page.rb in cts-mpx-1.0.1 vs lib/cts/mpx/driver/page.rb in cts-mpx-1.0.2
- old
+ new
@@ -5,18 +5,28 @@
# @attribute entries
# @return [Array] array of deserialized entries
# @attribute xmlns
# @return [Hash] active namespace received for this page
class Page
- extend Creatable
+ include Creatable
include Enumerable
attribute name: 'entries', kind_of: Array
attribute name: 'xmlns', kind_of: Hash
def initialize
@entries = []
@xmlns = {}
+ end
+
+ def to_mpx_entries
+ c = @entries.map do |e|
+ r = Entry.new
+ r.fields = Fields.create_from_data(data: e, xmlns: xmlns)
+ end
+
+ e = Entries.create collection: c
+ e
end
# return a json copy of the object, useful for later interpreation
# @param [Object] indent_depth sets indent depth to 2 if not nil
# @return [String] json serialized copy of the page