emapic_consul 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: aff0f442392842c70d331f4ccf8745e431583244
4
- data.tar.gz: c955e9c5bcd83b829811cd0af113452ab42cb6a8
3
+ metadata.gz: 7fac7c21d090de410148f5dbd32195b67bb901bd
4
+ data.tar.gz: 8ba6d152ba9f638f6de6f73522e757d146d1009c
5
5
  SHA512:
6
- metadata.gz: 66e5d04cee49c84b88c4a8cecfe748e40577ba02f838e797c54a41a749628b170c52c68662147d4dab986bda7fb1fd1a9b378d02b6929bcbbb65e7b668e1365f
7
- data.tar.gz: 75bfa5d9fc80df11f44f92df8949c889ed510cdc3333621813489a2c794a1438d4f55d81554ccf6ae3438bb6d29a2ffc48b389fbfe128a04c782b68808fd22cf
6
+ metadata.gz: 57a45fe844ef517d8ea34977a796c04ac7bb527b94b8a5e1650d99d1b8244b01190bc5b20b2dd7ebc5eb51b9671e44c41712f1340be841b7355c62dd263ba5b5
7
+ data.tar.gz: d50f16080e8c19e04dfb682e5473a0cbec8045e1e181b2a7566d5773c1f524e548356ed902af8d33c28fb6e0f6d40ca738faa1d1939ae2f038adc07e50f9133a
@@ -4,7 +4,7 @@ module EmapicConsul
4
4
  class Api
5
5
 
6
6
  def self.build_generic_request(path)
7
- EmapicConsul::Api::Request.new(
7
+ EmapicConsul::Request.new(
8
8
  host: api_host,
9
9
  path: path,
10
10
  port: api_port,
@@ -2,39 +2,35 @@ require 'net/http'
2
2
  require 'openssl'
3
3
 
4
4
  module EmapicConsul
5
- module Api
6
-
7
- class Request
8
- def initialize(options = {})
9
- uri = URI::HTTP.build(
10
- host: options[:host],
11
- path: options[:path],
12
- port: options[:port]
13
- )
14
- @http = build_http_object(uri)
15
- @request = Net::HTTP::Post.new(uri)
16
- @request.basic_auth(options[:api_key], options[:api_secret])
17
- end
18
-
19
- # usage:
20
- # request.params = { id: 1, title: 'My title', geoloc: 'xyz' }
21
- def params=(params)
22
- @request.set_form_data(params)
23
- end
24
-
25
- def send
26
- @http.request(@request)
27
- end
5
+ class Request
6
+ def initialize(options = {})
7
+ uri = URI::HTTP.build(
8
+ host: options[:host],
9
+ path: options[:path],
10
+ port: options[:port]
11
+ )
12
+ @http = build_http_object(uri)
13
+ @request = Net::HTTP::Post.new(uri)
14
+ @request.basic_auth(options[:api_key], options[:api_secret])
15
+ end
28
16
 
29
- private
17
+ # usage:
18
+ # request.params = { id: 1, title: 'My title', geoloc: 'xyz' }
19
+ def params=(params)
20
+ @request.set_form_data(params)
21
+ end
30
22
 
31
- def self.build_http_object(uri)
32
- http = Net::HTTP.new(uri.host, uri.port)
33
- http.use_ssl = true
34
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
35
- http
36
- end
23
+ def send
24
+ @http.request(@request)
37
25
  end
38
26
 
27
+ private
28
+
29
+ def self.build_http_object(uri)
30
+ http = Net::HTTP.new(uri.host, uri.port)
31
+ http.use_ssl = true
32
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
33
+ http
34
+ end
39
35
  end
40
36
  end
@@ -1,3 +1,3 @@
1
1
  module EmapicConsul
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emapic_consul
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
  - Alberto Miedes Garcés