Class: OpenFdaApi::Food

Inherits:
Endpoint show all
Defined in:
lib/open_fda_api/food.rb

Overview

Interact with the Food API Endpoint:

- Adverse Events
- Recall Enforcement Reports

Instance Attribute Summary

Attributes inherited from Endpoint

#client

Instance Method Summary collapse

Methods inherited from Endpoint

#build_inputs, #build_query, #initialize, #make_request

Constructor Details

This class inherits a constructor from OpenFdaApi::Endpoint

Instance Method Details

#adverse_events(search: [], sort: [], count: [], skip: 0, limit: 1) ⇒ Object

Returns Response from the API parsed as JSON.

Parameters:

Returns:

  • Response from the API parsed as JSON



14
15
16
17
18
19
# File 'lib/open_fda_api/food.rb', line 14

def adverse_events(search: [], sort: [], count: [], skip: 0, limit: 1)
  endpoint = "event.json"
  inputs   = build_inputs(search: search, sort: sort, count: count, skip: skip, limit: limit)
  query    = build_query(inputs, {}) # TODO: Upload valid fields
  make_request(endpoint, query)
end

#recall_enforcement_reports(search: [], sort: [], count: [], skip: 0, limit: 1) ⇒ Object

Returns Response from the API parsed as JSON.

Parameters:

Returns:

  • Response from the API parsed as JSON



27
28
29
30
31
32
# File 'lib/open_fda_api/food.rb', line 27

def recall_enforcement_reports(search: [], sort: [], count: [], skip: 0, limit: 1)
  endpoint = "enforcement.json"
  inputs   = build_inputs(search: search, sort: sort, count: count, skip: skip, limit: limit)
  query    = build_query(inputs, {}) # TODO: Upload valid fields
  make_request(endpoint, query)
end