material_service_client 0.1.4 → 0.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 058a488365308f2daf888301521e96b9326a8e0c
4
- data.tar.gz: d7319d968f9359a0103d7c143677972bff5f6013
3
+ metadata.gz: 44bad29d4efa965ad9c46ec48687ff6e85432e89
4
+ data.tar.gz: d42917da79265a2c3f847e568de577169c915887
5
5
  SHA512:
6
- metadata.gz: 53e912a71dd160d266b9071c06983771f700ea30cf9f8fc8592bdf912efb580e1f56219103bd20e9bc53f72d1f91c0ed0eb075466d7c7560d8cdd76e03b2a557
7
- data.tar.gz: 36815dcda2fb9f221faa784c333700200ff1b83b947173f753264843b88f9475dfaea81530a3a5cb2a467c7a9a57c164b03e934b9a1410398c75f4f0120ca661
6
+ metadata.gz: 2e7f265ecb7f35e4ad107f8937a0be6cccc74fd6e09c75db4b6e5990c90dfdcc53f57ebf3e1134d811cd5720857d57afb65e8a96ee2538b109a673af88fb554b
7
+ data.tar.gz: d39dcde81a04bc01582b738f4f394240d2a23d8acdd8bae6f84d1d2260cb0af8e9b6756bd8e0b160ac393b50cfa9d1473c337c3b334f7ab32f1c94733e30e130
@@ -1,3 +1,3 @@
1
1
  module MaterialServiceClient
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -1,38 +1,38 @@
1
1
  require_relative "material_service_client/version"
2
2
 
3
3
  module MaterialServiceClient
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
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'] = "TODO: Set to 'http://mygemserver.com'"
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
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: []