material_service_client 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/material_service_client/version.rb +1 -1
- data/lib/material_service_client.rb +33 -33
- data/material_service_client.gemspec +3 -2
- 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: 44bad29d4efa965ad9c46ec48687ff6e85432e89
|
4
|
+
data.tar.gz: d42917da79265a2c3f847e568de577169c915887
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e7f265ecb7f35e4ad107f8937a0be6cccc74fd6e09c75db4b6e5990c90dfdcc53f57ebf3e1134d811cd5720857d57afb65e8a96ee2538b109a673af88fb554b
|
7
|
+
data.tar.gz: d39dcde81a04bc01582b738f4f394240d2a23d8acdd8bae6f84d1d2260cb0af8e9b6756bd8e0b160ac393b50cfa9d1473c337c3b334f7ab32f1c94733e30e130
|
@@ -1,38 +1,38 @@
|
|
1
1
|
require_relative "material_service_client/version"
|
2
2
|
|
3
3
|
module MaterialServiceClient
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
4
|
+
|
5
|
+
def self.post(data)
|
6
|
+
conn = get_connection
|
7
|
+
JSON.parse(conn.post('/materials', data.to_json).body)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.put(data)
|
11
|
+
uuid = data[:uuid]
|
12
|
+
data_to_send = data.reject{|k,v| k.to_sym == :uuid}
|
13
|
+
|
14
|
+
conn = get_connection
|
15
|
+
JSON.parse(conn.put('/materials/'+uuid, data_to_send.to_json).body)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.get(uuid)
|
19
|
+
return nil if uuid.nil?
|
20
|
+
conn = get_connection
|
21
|
+
JSON.parse(conn.get('/materials/'+uuid).body)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def self.get_connection
|
27
|
+
conn = Faraday.new(:url => Rails.application.config.material_url) do |faraday|
|
28
|
+
# faraday.use ZipkinTracer::FaradayHandler, 'eve'
|
29
|
+
faraday.proxy Rails.application.config.material_url
|
30
|
+
faraday.request :url_encoded
|
31
|
+
faraday.response :logger
|
32
|
+
faraday.adapter Faraday.default_adapter
|
33
|
+
end
|
34
|
+
conn.headers = {'Content-Type' => 'application/json'}
|
35
|
+
conn
|
36
|
+
end
|
37
37
|
|
38
38
|
end
|
@@ -10,7 +10,7 @@ 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
|
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
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'] =
|
21
|
+
# spec.metadata['allowed_push_host'] = 'http://mygemserver.com'
|
22
22
|
# else
|
23
23
|
# raise "RubyGems 2.0 or newer is required to protect against " \
|
24
24
|
# "public gem pushes."
|
@@ -34,4 +34,5 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_development_dependency "bundler", "~> 1.13"
|
35
35
|
spec.add_development_dependency "rake", "~> 10.0"
|
36
36
|
spec.add_development_dependency "rspec", "~> 3.0"
|
37
|
+
|
37
38
|
end
|
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.5
|
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: Gem to access the material service API
|
55
|
+
description: 'Gem to access the material service API '
|
56
56
|
email:
|
57
57
|
- hc6@sanger.ac.uk
|
58
58
|
executables: []
|