material_service_client 0.1.6 → 0.1.8
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 +4 -4
- data/lib/material_service_client/version.rb +1 -1
- data/lib/material_service_client.rb +8 -9
- data/material_service_client.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80b0ba57df3b9d7ccd7e9c89fc6b2becc22811b2
|
4
|
+
data.tar.gz: 2a4b6c527ee212a08d28986005c34b22e6decb46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0087e5f87290ac2256900a55253c6ab2680f8c98fa820cf93ba327a9076974d1342ee45e80c2a26ec77f5d27ccb3aa86b5605c164efe95fe397fd92299c36a2a
|
7
|
+
data.tar.gz: 8161cb6b5d452481a17446e0a2ccd592e43f2c95f88092e64c62cc5390cde704f4e5b6cd14582d67a1a273b71269d42515a1af1cd2d25d6c221e7f9a1cc2b6d9
|
@@ -1,14 +1,13 @@
|
|
1
|
-
|
1
|
+
require "material_service_client/version"
|
2
2
|
|
3
3
|
module MaterialServiceClient
|
4
4
|
class BiomaterialClient
|
5
|
-
|
6
|
-
def self.post(data)
|
5
|
+
def post(data)
|
7
6
|
conn = get_connection
|
8
7
|
JSON.parse(conn.post('/materials', data.to_json).body)
|
9
8
|
end
|
10
9
|
|
11
|
-
def
|
10
|
+
def put(data)
|
12
11
|
uuid = data[:uuid]
|
13
12
|
data_to_send = data.reject{|k,v| k.to_sym == :uuid}
|
14
13
|
|
@@ -16,7 +15,7 @@ module MaterialServiceClient
|
|
16
15
|
JSON.parse(conn.put('/materials/'+uuid, data_to_send.to_json).body)
|
17
16
|
end
|
18
17
|
|
19
|
-
def
|
18
|
+
def get(uuid)
|
20
19
|
return nil if uuid.nil?
|
21
20
|
conn = get_connection
|
22
21
|
JSON.parse(conn.get('/materials/'+uuid).body)
|
@@ -24,16 +23,16 @@ module MaterialServiceClient
|
|
24
23
|
|
25
24
|
private
|
26
25
|
|
27
|
-
def
|
26
|
+
def get_connection
|
28
27
|
conn = Faraday.new(:url => Rails.application.config.material_url) do |faraday|
|
29
28
|
# faraday.use ZipkinTracer::FaradayHandler, 'eve'
|
30
29
|
faraday.proxy Rails.application.config.material_url
|
31
30
|
faraday.request :url_encoded
|
32
31
|
faraday.response :logger
|
33
|
-
faraday.adapter Faraday.default_adapter
|
32
|
+
faraday.adapter Faraday.default_adapter
|
34
33
|
end
|
35
|
-
conn.headers = {'Content-Type' => 'application/json'}
|
34
|
+
conn.headers = {'Content-Type' => 'application/json'}
|
36
35
|
conn
|
37
36
|
end
|
38
37
|
end
|
39
|
-
end
|
38
|
+
end
|
@@ -10,15 +10,15 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["hc6@sanger.ac.uk"]
|
11
11
|
|
12
12
|
spec.summary = %q{Gem to access the material service API}
|
13
|
-
spec.description = %q{Gem to access the material service API
|
13
|
+
spec.description = %q{Gem to access the material service API.}
|
14
14
|
spec.homepage = "https://rubygems.org/gems/material_service_client"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
18
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
-
|
19
|
+
|
20
20
|
# if spec.respond_to?(:metadata)
|
21
|
-
# spec.metadata['allowed_push_host'] = 'http://mygemserver.com'
|
21
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
22
22
|
# else
|
23
23
|
# raise "RubyGems 2.0 or newer is required to protect against " \
|
24
24
|
# "public gem pushes."
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: material_service_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harriet Craven
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
-
description:
|
55
|
+
description: Gem to access the material service API.
|
56
56
|
email:
|
57
57
|
- hc6@sanger.ac.uk
|
58
58
|
executables: []
|