lolcation_client 0.2.2 → 0.2.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8ed3b3cf03f08a0c02dee0f835b096fb4892ef4
|
4
|
+
data.tar.gz: 393779c29c70e6f853b4a05522436657e1d5cc91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdc77e1c89d819dc8e63834b951aaa910147de592fd0fca6433ecb515ef92eb902875619c266cdef5cbb9bb4b6a4d5663175dd5f44291df428e886fa8c7087d3
|
7
|
+
data.tar.gz: 82bbc906ac688466b03f3753052edda79b6feb731696a59d0b7253a494aea1da3229d9e65a8b9916ec706ee57724fb76c1d5982869a5c9d9749e34a94911f440
|
@@ -1,8 +1,11 @@
|
|
1
1
|
development:
|
2
|
+
servie_url: 'https://lolcation-service.loldesign.com.br'
|
2
3
|
token: 'Insert your token here'
|
3
4
|
sandbox: true
|
4
5
|
staging:
|
6
|
+
servie_url: 'https://lolcation-service.loldesign.com.br'
|
5
7
|
token: 'Insert your token here'
|
6
8
|
sandbox: true
|
7
9
|
production:
|
10
|
+
servie_url: 'https://lolcation-service.loldesign.com.br'
|
8
11
|
token: 'Insert your token here'
|
@@ -1,12 +1,13 @@
|
|
1
1
|
module LolcationClient
|
2
2
|
module Configurations
|
3
|
-
API = "/api/v1/localizations"
|
4
|
-
URL = Rails.env.development? ? "http://localhost:8000#{API}" : "https://lolcation-service.loldesign.com.br#{API}"
|
5
|
-
|
6
3
|
def configs
|
7
4
|
Rails.application.config_for(:lolcation)
|
8
5
|
end
|
9
6
|
|
7
|
+
def service_url
|
8
|
+
"#{configs['servie_url']}/api/v1/localizations"
|
9
|
+
end
|
10
|
+
|
10
11
|
def token
|
11
12
|
configs["token"]
|
12
13
|
end
|
@@ -65,8 +65,7 @@ module LolcationClient
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def create_on_lolcation_server
|
68
|
-
|
69
|
-
conn = Faraday.new(url: url)
|
68
|
+
conn = Faraday.new(url: service_url)
|
70
69
|
conn.post do |r|
|
71
70
|
r.headers["X-Token"] = token
|
72
71
|
r.headers["Content-Type"] = "application/json"
|
@@ -75,8 +74,7 @@ module LolcationClient
|
|
75
74
|
end
|
76
75
|
|
77
76
|
def update_on_lolcation_server
|
78
|
-
|
79
|
-
conn = Faraday.new(url: "#{url}/#{self.lolcation_id}")
|
77
|
+
conn = Faraday.new(url: "#{service_url}/#{self.lolcation_id}")
|
80
78
|
conn.put do |r|
|
81
79
|
r.headers["X-Token"] = token
|
82
80
|
r.headers["Content-Type"] = "application/json"
|
@@ -24,8 +24,7 @@ module LolcationClient
|
|
24
24
|
private
|
25
25
|
|
26
26
|
def do_post(options = {})
|
27
|
-
|
28
|
-
conn = Faraday.new(url: "#{url}/near-me")
|
27
|
+
conn = Faraday.new(url: "#{service_url}/near-me")
|
29
28
|
conn.post do |r|
|
30
29
|
r.headers["X-Token"] = token
|
31
30
|
r.headers["Content-Type"] = "application/json"
|