README.md in open_fda_api-0.0.12 vs README.md in open_fda_api-0.0.13
- old
+ new
@@ -17,11 +17,13 @@
```
## Usage
```ruby
-client = OpenFdaApi.client
+client = OpenFdaApi::Client.new
+# or if you have registered an API key
+client = OpenFdaApi::Client.new(api_key: ENV['OPEN_FDA_API_KEY'])
# First 20 results where (fieldA=foo AND fieldB=bar) OR (fieldC=baz AND fieldA exists)
# Sorted by (fieldD) in descending order
# Skip the first 8 results
args = {
@@ -40,11 +42,11 @@
client.drugs.ndc_directory(args)
client.drugs.recall_enforcement_reports(args)
client.drugs.drugs_at_fda(args)
# Device API
-client.device.premarket_501ks(args)
+client.device.premarket_510ks(args)
client.device.classification(args)
client.device.recall_enforcement_reports(args)
client.device.adverse_events(args)
client.device.premarket_approval(args)
client.device.recalls(args)
@@ -70,12 +72,38 @@
`search`, `sort`, and `count` have the same format. They are arrays of hashes. Each hash has a set of fields and values
that are ANDed together and all the elements in the array are ORed together. Here are some examples to illustrate:
```ruby
-search = [{"patient.drug.openfda.pharm_class_epc" => "nonsteroidal+anti-inflammatory+drug" }]
+# Default arguments
+args = {
+ search: [],
+ sort: [],
+ count: [],
+ skip: 0,
+ limit: 1,
+}
-# patient.drug.openfda.pharm_class_epc:"nonsteroidal+anti-inflammatory+drug"&count=patient.reaction.reactionmeddrapt.exact
+# Search for a single field
+args = {
+ search: [{ fieldA: "value" }]
+}
+
+# Search for field A AND field B
+args = {
+ search: [{ fieldA: "value", fieldB: "other value" }]
+}
+
+# Search for field A OR field B
+args = {
+ search: [{ fieldA: "value"}, { fieldB: "other value" }]
+}
+
+# Search for field A or field B, and skip the first 10 results
+args = {
+ search: [{ fieldA: "value"}, { fieldB: "other value" }],
+ skip: 10
+}
```
## Development
After checking out the repo, run `bin/setup` to install dependencies.