Module: FHIR::Sections::Search
- Included in:
- Client
- Defined in:
- lib/fhir_client/sections/search.rb
Instance Method Summary collapse
-
#search(klass, options = {}, format = @default_format) ⇒ Object
Search a set of resources of a given type.
- #search_all(options = {}, format = @default_format) ⇒ Object
- #search_existing(klass, id, options = {}, format = @default_format) ⇒ Object
Instance Method Details
#search(klass, options = {}, format = @default_format) ⇒ Object
Search a set of resources of a given type.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fhir_client/sections/search.rb', line 11 def search(klass, = {}, format = @default_format) [:resource] = klass [:format] = format reply = if [:search] && [:search][:flag] post resource_url(), nil, fhir_headers({content_type: 'application/x-www-form-urlencoded'}) else get resource_url(), fhir_headers end # reply = get resource_url(options), fhir_headers(options) reply.resource = parse_reply(klass, format, reply) reply.resource_class = klass reply end |
#search_all(options = {}, format = @default_format) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/fhir_client/sections/search.rb', line 39 def search_all( = {}, format = @default_format) [:format] = format reply = if [:search] && [:search][:flag] post resource_url(), nil, fhir_headers({content_type: 'application/x-www-form-urlencoded'}) else get resource_url(), fhir_headers end reply.resource = parse_reply(nil, format, reply) reply.resource_class = nil reply end |
#search_existing(klass, id, options = {}, format = @default_format) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/fhir_client/sections/search.rb', line 26 def search_existing(klass, id, = {}, format = @default_format) .merge!(resource: klass, id: id, format: format) # if options[:search][:flag] reply = if [:search] && [:search][:flag] post resource_url(), nil, fhir_headers({content_type: 'application/x-www-form-urlencoded'}) else get resource_url(), fhir_headers end reply.resource = parse_reply(klass, format, reply) reply.resource_class = klass reply end |