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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: adbc36db24fea405a236a58dcb9a86c0b13cc458
4
- data.tar.gz: a429d5d3cf4cc7d5eb129e66b1adfb951f7cb1d2
3
+ metadata.gz: aff0f442392842c70d331f4ccf8745e431583244
4
+ data.tar.gz: c955e9c5bcd83b829811cd0af113452ab42cb6a8
5
5
  SHA512:
6
- metadata.gz: b88863dfa006159d487a8577641140c824344787d122a3a02093390e7e81d0f3cecfde334ce407c6baf9b8513b663d36f5cdf2a99a2a3245e5a1c384b7c71557
7
- data.tar.gz: b79ec5118663ae3fcd22f16cf92572a86584625be4c8499b2eefaab1ff095d0f5b2d377061190df24966eea59833091c90944cea615b89add8ce6eddfb4cb2e5
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="1.2.3.4"
34
- export EMAPIC_PORT="666"
35
- export EMAPIC_KEY="1234"
36
- export EMAPIC_SECRET="4321"
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
@@ -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"
@@ -1,9 +1,7 @@
1
- require 'request'
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
- # Usage:
19
- # notify_group_creation(proposal_instance)
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
- group_type = group.class.name.downcase
24
- geolocation = (FAKE_LOCATIONS ? get_random_address : group.district.name)
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
- # Usage:
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
- geolocation = (FAKE_LOCATIONS ? get_random_address : vote.voter.district.name)
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
@@ -1,3 +1,3 @@
1
1
  module EmapicConsul
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/lib/emapic_consul.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'emapic_consul/version'
2
2
  require 'emapic_consul/api'
3
+ require 'emapic_consul/request'
3
4
 
4
5
  module EmapicConsul
5
6
  # Your code goes here...
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.3
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