Commit 98c0a948 authored by Chantal's avatar Chantal

make url env dependant

parent deca87c0
...@@ -12,14 +12,24 @@ module Wedoops ...@@ -12,14 +12,24 @@ module Wedoops
include HTTParty include HTTParty
debug_output $stdout debug_output $stdout
base_uri 'https://zoho-adaptor-uat.adamo.es/' #base_uri 'https://zoho-adaptor-uat.adamo.es/'
#base_uri 'https://zoho-adaptor-staging.adamo.es/' #base_uri 'https://zoho-adaptor-staging.adamo.es/'
#base_uri 'https://zoho-adaptor.adamo.es' base_uri 'https://zoho-adaptor.adamo.es'
http_proxy "prx.wedoops.io", "443", "adamo" , "fSJxGqibztyvGPb9" http_proxy "prx.wedoops.io", "443", "adamo" , "fSJxGqibztyvGPb9"
attr_reader :subdomain, :uri attr_reader :subdomain, :uri
def initialize def initialize(options={})
if options.has_key?(:environment) && options[:environment] == "development"
self.class.base_uri 'https://zoho-adaptor-uat.adamo.es/'
@password = '7KqI8FWVVfPayhcvYo9wxoUHZf3U0HWxYIuouyLizyF2N'
elsif options.has_key?(:environment) && options[:environment] == "production"
self.class.base_uri 'https://zoho-adaptor.adamo.es'
@password = '7KqI8FWVVfPayhcvYo9wxoUHZf3U0HWxYIuouyLizyF2N'
else
self.class.base_uri 'https://zoho-adaptor-staging.adamo.es/'
@password = 'ZnsVmfSZwxq7KH1FquCIG8P9UrKDixHRAhci4UuYpRdzZ'
end
@logger = ::Logger.new(STDOUT) @logger = ::Logger.new(STDOUT)
set_key set_key
end end
...@@ -31,6 +41,7 @@ module Wedoops ...@@ -31,6 +41,7 @@ module Wedoops
def search_by_id(id) def search_by_id(id)
resultado = self.class.get("/v1/leads/#{id}",headers:{'Content-Type' => 'application/json','x-apikey' => "#{@key}"}) resultado = self.class.get("/v1/leads/#{id}",headers:{'Content-Type' => 'application/json','x-apikey' => "#{@key}"})
pp resultado
if resultado.key?("message") if resultado.key?("message")
return resultado["message"] return resultado["message"]
else else
...@@ -69,7 +80,7 @@ module Wedoops ...@@ -69,7 +80,7 @@ module Wedoops
def set_key def set_key
#@password = 'ZnsVmfSZwxq7KH1FquCIG8P9UrKDixHRAhci4UuYpRdzZ' ##Staging password #@password = 'ZnsVmfSZwxq7KH1FquCIG8P9UrKDixHRAhci4UuYpRdzZ' ##Staging password
@password = '7KqI8FWVVfPayhcvYo9wxoUHZf3U0HWxYIuouyLizyF2N' ##Production (uat) password #@password = '7KqI8FWVVfPayhcvYo9wxoUHZf3U0HWxYIuouyLizyF2N' ##Production (uat) password
@salt = (DateTime.now.strftime("%s").to_i / 86400).to_s @salt = (DateTime.now.strftime("%s").to_i / 86400).to_s
@key = Digest::SHA1.hexdigest(@password + @salt) @key = Digest::SHA1.hexdigest(@password + @salt)
end end
......
# frozen_string_literal: true # frozen_string_literal: true
module Wedoops module Wedoops
module Zoholib module Zoholib
VERSION = '0.4.2' VERSION = '0.5.0'
end end
end end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment