assaydepot 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -4
- data/lib/assaydepot/client.rb +4 -4
- data/lib/assaydepot/configurable.rb +1 -1
- data/lib/assaydepot/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
-
#
|
1
|
+
# Assay Depot
|
2
2
|
|
3
3
|
Ruby interface for Assay Depot's online laboratory (http://www.assaydepot.com).
|
4
4
|
|
5
|
+
## Assay Depot Developer Program
|
6
|
+
|
7
|
+
An authentication token is required for the API to function. If you would like access to the API, please email cpetersen@assaydepot.com.
|
8
|
+
|
5
9
|
## Installation
|
6
10
|
|
7
11
|
Add this line to your application's Gemfile:
|
@@ -21,8 +25,8 @@ Or install it yourself as:
|
|
21
25
|
```ruby
|
22
26
|
require 'assaydepot'
|
23
27
|
AssayDepot.configure do |config|
|
24
|
-
config.
|
25
|
-
config.url = "
|
28
|
+
config.access_token = "1234567890"
|
29
|
+
config.url = "https://www.assaydepot.com/api"
|
26
30
|
end
|
27
31
|
wares = AssayDepot::Ware.find("Antibody")
|
28
32
|
wares.total
|
@@ -45,7 +49,7 @@ wares.first["name"]
|
|
45
49
|
## Providers
|
46
50
|
|
47
51
|
```ruby
|
48
|
-
providers = AssayDepot::Provider.where(:starts_with => "a").per_page(
|
52
|
+
providers = AssayDepot::Provider.where(:starts_with => "a").per_page(50)
|
49
53
|
providers.count
|
50
54
|
```
|
51
55
|
|
data/lib/assaydepot/client.rb
CHANGED
@@ -7,7 +7,7 @@ module AssayDepot
|
|
7
7
|
@search_type = options[:search_type] || "wares"
|
8
8
|
end
|
9
9
|
|
10
|
-
def search_url(
|
10
|
+
def search_url(params={})
|
11
11
|
"#{AssayDepot.url}/#{@search_type}.json?#{params.collect { |k,v| "#{k}=#{v.to_s.gsub(" ","+")}"}.join("&")}"
|
12
12
|
end
|
13
13
|
|
@@ -16,16 +16,16 @@ module AssayDepot
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def search(query, facets, params={})
|
19
|
-
params["
|
19
|
+
params["access_token"] = AssayDepot.access_token
|
20
20
|
params["q"] = query
|
21
21
|
facets.map do |name,value|
|
22
22
|
params["facets[#{name}][]"] = value
|
23
23
|
end
|
24
|
-
JSON.parse(open(search_url(
|
24
|
+
JSON.parse(open(search_url(params)).read)
|
25
25
|
end
|
26
26
|
|
27
27
|
def get(id, params={})
|
28
|
-
params["
|
28
|
+
params["access_token"] = AssayDepot.access_token
|
29
29
|
JSON.parse(open(get_url(id, params)).read)
|
30
30
|
end
|
31
31
|
end
|
data/lib/assaydepot/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assaydepot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|