Sha256: 202799bde5a30ff5ccbe2a71feec22e4bd7b44f49b9a96b42dee4c1d93a7dc6c
Contents?: true
Size: 999 Bytes
Versions: 7
Compression:
Stored size: 999 Bytes
Contents
module FHIR class Bundle def self_link link.select { |n| n.relation == 'self' }.first end def first_link link.select { |n| n.relation == 'first' }.first end def last_link link.select { |n| n.relation == 'last' }.first end def next_link link.select { |n| n.relation == 'next' }.first end def previous_link link.select { |n| n.relation == 'previous' || n.relation == 'prev' }.first end def get_by_id(id) entry.each do |item| return item.resource if item.id == id || item.resource.id == id end nil end def each(&block) iteration = @entry.map(&:resource).each(&block) iteration += next_bundle.each(&block) if next_bundle iteration end def next_bundle # TODO: test this return nil unless client && next_link.try(:url) @next_bundle ||= client.parse_reply(self.class, client.default_format, client.raw_read_url(next_link.url)) end end end
Version data entries
7 entries across 7 versions & 1 rubygems