emapic_consul 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -4
- data/emapic_consul.gemspec +0 -2
- data/lib/emapic_consul/api.rb +12 -17
- data/lib/emapic_consul/version.rb +1 -1
- data/lib/emapic_consul.rb +1 -0
- metadata +1 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aff0f442392842c70d331f4ccf8745e431583244
|
4
|
+
data.tar.gz: c955e9c5bcd83b829811cd0af113452ab42cb6a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66e5d04cee49c84b88c4a8cecfe748e40577ba02f838e797c54a41a749628b170c52c68662147d4dab986bda7fb1fd1a9b378d02b6929bcbbb65e7b668e1365f
|
7
|
+
data.tar.gz: 75bfa5d9fc80df11f44f92df8949c889ed510cdc3333621813489a2c794a1438d4f55d81554ccf6ae3438bb6d29a2ffc48b389fbfe128a04c782b68808fd22cf
|
data/README.md
CHANGED
@@ -30,10 +30,11 @@ you are in *macOS*). An example setup might look like the following:
|
|
30
30
|
|
31
31
|
```bash
|
32
32
|
# ~/.bash_profile
|
33
|
-
export EMAPIC_HOST="
|
34
|
-
export EMAPIC_PORT="
|
35
|
-
export
|
36
|
-
export
|
33
|
+
export EMAPIC_HOST="192.168.1.199"
|
34
|
+
export EMAPIC_PORT="3000"
|
35
|
+
export EMAPIC_LOGIN="amiedes2"
|
36
|
+
export EMAPIC_KEY="12"
|
37
|
+
export EMAPIC_SECRET="12"
|
37
38
|
```
|
38
39
|
|
39
40
|
## Usage
|
data/emapic_consul.gemspec
CHANGED
@@ -30,8 +30,6 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
31
|
spec.require_paths = ["lib"]
|
32
32
|
|
33
|
-
spec.add_dependency 'activesupport'
|
34
|
-
|
35
33
|
spec.add_development_dependency "bundler", "~> 1.13"
|
36
34
|
spec.add_development_dependency "rake", "~> 10.0"
|
37
35
|
spec.add_development_dependency "rspec", "~> 3.0"
|
data/lib/emapic_consul/api.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
|
-
|
2
|
-
require 'active_support/inflector'
|
1
|
+
#require_relative 'request'
|
3
2
|
|
4
3
|
module EmapicConsul
|
5
4
|
class Api
|
6
|
-
FAKE_LOCATIONS = true
|
7
5
|
|
8
6
|
def self.build_generic_request(path)
|
9
7
|
EmapicConsul::Api::Request.new(
|
@@ -15,31 +13,24 @@ module EmapicConsul
|
|
15
13
|
)
|
16
14
|
end
|
17
15
|
|
18
|
-
#
|
19
|
-
|
20
|
-
def self.notify_group_creation(group)
|
16
|
+
# create_location_group(proposal_instance)
|
17
|
+
def self.create_location_group(group)
|
21
18
|
print_debug_start("to notify #{type} creation")
|
22
19
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
request = build_generic_request("/api/#{group_type.pluralize}")
|
27
|
-
request.params = { type: group_type, id: group.id, geolocation: geolocation }
|
20
|
+
request = build_generic_request("/api/locationgroup/#{emapic_login}")
|
21
|
+
request.params = { id: group.id, title: group.title }
|
28
22
|
response = request.send
|
29
23
|
|
30
24
|
puts "Response body: #{response.body}"
|
31
25
|
print_debug_end(response.code)
|
32
26
|
end
|
33
27
|
|
34
|
-
#
|
35
|
-
# notify_vote_creation(vote_instance)
|
28
|
+
# notify_vote(vote_instance)
|
36
29
|
def self.notify_vote(vote)
|
37
30
|
print_debug_start("to notify vote creation")
|
38
31
|
|
39
|
-
|
40
|
-
|
41
|
-
request = build_generic_request("/api/votes/")
|
42
|
-
request.params = { votable: vote.votable_id, votable_type: vote.votable_type, geolocation: geolocation }
|
32
|
+
request = build_generic_request("/api/locationgroup/#{emapic_login}/#{vote.votable_id}")
|
33
|
+
request.params = { user_id: vote.voter_id, address: get_random_address }
|
43
34
|
response = request.send
|
44
35
|
|
45
36
|
puts "Response body: #{response.body}"
|
@@ -95,6 +86,10 @@ module EmapicConsul
|
|
95
86
|
ENV['EMAPIC_PORT']
|
96
87
|
end
|
97
88
|
|
89
|
+
def self.emapic_login
|
90
|
+
ENV['EMAPIC_LOGIN']
|
91
|
+
end
|
92
|
+
|
98
93
|
def self.api_key
|
99
94
|
ENV['EMAPIC_KEY']
|
100
95
|
end
|
data/lib/emapic_consul.rb
CHANGED
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
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alberto Miedes Garcés
|
@@ -10,20 +10,6 @@ bindir: exe
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2016-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: activesupport
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: bundler
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|