module FHIR::BundleExtras

Public Instance Methods

each(&block) click to toggle source
# File lib/fhir_client/ext/bundle.rb, line 30
def each(&block)
  iterator = @entry.map(&:resource).each(&block)
  if next_bundle
    next_iterator = next_bundle.each(&block)
    Enumerator.new do |y|
      iterator.each { |r| y << r }
      next_iterator.each { |r| y << r }
    end
  else
    iterator
  end
end
get_by_id(id) click to toggle source
# File lib/fhir_client/ext/bundle.rb, line 23
def get_by_id(id)
  entry.each do |item|
    return item.resource if item.id == id || item.resource.id == id
  end
  nil
end
next_bundle() click to toggle source
# File lib/fhir_client/ext/bundle.rb, line 43
def next_bundle
  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