drugfyi 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/drugfyi.rb +170 -0
- metadata +46 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8ab4cac25a6ddad3b509d9d0be41cb4259156dc6d329dd3e87fe738fbadfd239
|
|
4
|
+
data.tar.gz: 6e0e45e6de5d50d397ec8fb11392fd3d7c0c0a3e3031de158839f4751e84deeb
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 4bfdce2512529c296042eb28e72e9e4d0934be90af031e0d45f12ef48982acca5732168898c3044fedfc004858dee5ff60393ae93b6121bb33b30808cc736f19
|
|
7
|
+
data.tar.gz: 47ddf8212faa3a8efa5863a4c75345c444dc949351e7eb26ca4cac23890ece93591565f0106add3f13888f5a0753c4d8c77e396b240593041f3ee5b53b1f0a1f
|
data/lib/drugfyi.rb
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "net/http"
|
|
4
|
+
require "json"
|
|
5
|
+
require "uri"
|
|
6
|
+
|
|
7
|
+
# Ruby client for DrugFYI REST API (drugfyi.com).
|
|
8
|
+
#
|
|
9
|
+
# client = DrugFYI::Client.new
|
|
10
|
+
# result = client.search("query")
|
|
11
|
+
#
|
|
12
|
+
module DrugFYI
|
|
13
|
+
class Client
|
|
14
|
+
BASE_URL = "https://drugfyi.com"
|
|
15
|
+
|
|
16
|
+
def initialize(base_url: BASE_URL)
|
|
17
|
+
@base_url = base_url
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def search(query)
|
|
21
|
+
get("/api/v1/search/", q: query)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# List all comparisons.
|
|
25
|
+
def list_comparisons
|
|
26
|
+
get("/api/v1/comparisons/")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Get comparison by slug.
|
|
30
|
+
def get_comparison(slug)
|
|
31
|
+
get("/api/v1/comparisons/#{slug}/")
|
|
32
|
+
end
|
|
33
|
+
# List all drug classes.
|
|
34
|
+
def list_drug_classes
|
|
35
|
+
get("/api/v1/drug-classes/")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Get drug classe by slug.
|
|
39
|
+
def get_drug_classe(slug)
|
|
40
|
+
get("/api/v1/drug-classes/#{slug}/")
|
|
41
|
+
end
|
|
42
|
+
# List all drug targets.
|
|
43
|
+
def list_drug_targets
|
|
44
|
+
get("/api/v1/drug-targets/")
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Get drug target by slug.
|
|
48
|
+
def get_drug_target(slug)
|
|
49
|
+
get("/api/v1/drug-targets/#{slug}/")
|
|
50
|
+
end
|
|
51
|
+
# List all drugs.
|
|
52
|
+
def list_drugs
|
|
53
|
+
get("/api/v1/drugs/")
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Get drug by slug.
|
|
57
|
+
def get_drug(slug)
|
|
58
|
+
get("/api/v1/drugs/#{slug}/")
|
|
59
|
+
end
|
|
60
|
+
# List all families.
|
|
61
|
+
def list_families
|
|
62
|
+
get("/api/v1/families/")
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Get family by slug.
|
|
66
|
+
def get_family(slug)
|
|
67
|
+
get("/api/v1/families/#{slug}/")
|
|
68
|
+
end
|
|
69
|
+
# List all faqs.
|
|
70
|
+
def list_faqs
|
|
71
|
+
get("/api/v1/faqs/")
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Get faq by slug.
|
|
75
|
+
def get_faq(slug)
|
|
76
|
+
get("/api/v1/faqs/#{slug}/")
|
|
77
|
+
end
|
|
78
|
+
# List all glossary.
|
|
79
|
+
def list_glossary
|
|
80
|
+
get("/api/v1/glossary/")
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Get term by slug.
|
|
84
|
+
def get_term(slug)
|
|
85
|
+
get("/api/v1/glossary/#{slug}/")
|
|
86
|
+
end
|
|
87
|
+
# List all guides.
|
|
88
|
+
def list_guides
|
|
89
|
+
get("/api/v1/guides/")
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Get guide by slug.
|
|
93
|
+
def get_guide(slug)
|
|
94
|
+
get("/api/v1/guides/#{slug}/")
|
|
95
|
+
end
|
|
96
|
+
# List all interactions.
|
|
97
|
+
def list_interactions
|
|
98
|
+
get("/api/v1/interactions/")
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Get interaction by slug.
|
|
102
|
+
def get_interaction(slug)
|
|
103
|
+
get("/api/v1/interactions/#{slug}/")
|
|
104
|
+
end
|
|
105
|
+
# List all journeys.
|
|
106
|
+
def list_journeys
|
|
107
|
+
get("/api/v1/journeys/")
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Get journey by slug.
|
|
111
|
+
def get_journey(slug)
|
|
112
|
+
get("/api/v1/journeys/#{slug}/")
|
|
113
|
+
end
|
|
114
|
+
# List all milestones.
|
|
115
|
+
def list_milestones
|
|
116
|
+
get("/api/v1/milestones/")
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Get milestone by slug.
|
|
120
|
+
def get_milestone(slug)
|
|
121
|
+
get("/api/v1/milestones/#{slug}/")
|
|
122
|
+
end
|
|
123
|
+
# List all side effects.
|
|
124
|
+
def list_side_effects
|
|
125
|
+
get("/api/v1/side-effects/")
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Get side effect by slug.
|
|
129
|
+
def get_side_effect(slug)
|
|
130
|
+
get("/api/v1/side-effects/#{slug}/")
|
|
131
|
+
end
|
|
132
|
+
# List all target interactions.
|
|
133
|
+
def list_target_interactions
|
|
134
|
+
get("/api/v1/target-interactions/")
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Get target interaction by slug.
|
|
138
|
+
def get_target_interaction(slug)
|
|
139
|
+
get("/api/v1/target-interactions/#{slug}/")
|
|
140
|
+
end
|
|
141
|
+
# List all therapeutic areas.
|
|
142
|
+
def list_therapeutic_areas
|
|
143
|
+
get("/api/v1/therapeutic-areas/")
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Get therapeutic area by slug.
|
|
147
|
+
def get_therapeutic_area(slug)
|
|
148
|
+
get("/api/v1/therapeutic-areas/#{slug}/")
|
|
149
|
+
end
|
|
150
|
+
# List all tools.
|
|
151
|
+
def list_tools
|
|
152
|
+
get("/api/v1/tools/")
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Get tool by slug.
|
|
156
|
+
def get_tool(slug)
|
|
157
|
+
get("/api/v1/tools/#{slug}/")
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
private
|
|
161
|
+
|
|
162
|
+
def get(path, **params)
|
|
163
|
+
uri = URI.join(@base_url, path)
|
|
164
|
+
uri.query = URI.encode_www_form(params) unless params.empty?
|
|
165
|
+
response = Net::HTTP.get_response(uri)
|
|
166
|
+
raise "HTTP #{response.code}" unless response.is_a?(Net::HTTPSuccess)
|
|
167
|
+
JSON.parse(response.body)
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: drugfyi
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- FYIPedia
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-03-21 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Ruby client for the DrugFYI REST API at drugfyi.com. Zero external dependencies.
|
|
14
|
+
email: dev@fyipedia.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- lib/drugfyi.rb
|
|
20
|
+
homepage: https://drugfyi.com
|
|
21
|
+
licenses:
|
|
22
|
+
- MIT
|
|
23
|
+
metadata:
|
|
24
|
+
source_code_uri: https://github.com/fyipedia/drugfyi-rb
|
|
25
|
+
documentation_uri: https://drugfyi.com/api/v1/schema/
|
|
26
|
+
homepage_uri: https://drugfyi.com
|
|
27
|
+
post_install_message:
|
|
28
|
+
rdoc_options: []
|
|
29
|
+
require_paths:
|
|
30
|
+
- lib
|
|
31
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
32
|
+
requirements:
|
|
33
|
+
- - ">="
|
|
34
|
+
- !ruby/object:Gem::Version
|
|
35
|
+
version: '3.0'
|
|
36
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
requirements: []
|
|
42
|
+
rubygems_version: 3.0.3.1
|
|
43
|
+
signing_key:
|
|
44
|
+
specification_version: 4
|
|
45
|
+
summary: Ruby client for DrugFYI API
|
|
46
|
+
test_files: []
|