[ENV] Pipedrive key config

This commit is contained in:
Paul Chavard 2018-08-22 17:57:23 +02:00
parent 14f4b16fa4
commit 9abb3c7a5a
3 changed files with 11 additions and 5 deletions

View file

@ -48,7 +48,7 @@ class Pipedrive::API
params.merge!({ params.merge!({
start: 0, start: 0,
limit: 500, limit: 500,
api_token: PIPEDRIVE_TOKEN api_token: token
}) })
response = RestClient.get(url, params: params) response = RestClient.get(url, params: params)
@ -56,14 +56,18 @@ class Pipedrive::API
end end
def self.put(url, params) def self.put(url, params)
url = "#{url}?api_token=#{PIPEDRIVE_TOKEN}" url = "#{url}?api_token=#{token}"
RestClient.put(url, params.to_json, { content_type: :json }) RestClient.put(url, params.to_json, { content_type: :json })
end end
def self.post(url, params) def self.post(url, params)
url = "#{url}?api_token=#{PIPEDRIVE_TOKEN}" url = "#{url}?api_token=#{token}"
RestClient.post(url, params.to_json, { content_type: :json }) RestClient.post(url, params.to_json, { content_type: :json })
end end
def self.token
Rails.application.secrets.pipedrive[:key]
end
end end

View file

@ -32,6 +32,8 @@ defaults: &defaults
api_entreprise: api_entreprise:
key: <%= ENV['API_ENTREPRISE_KEY'] %> key: <%= ENV['API_ENTREPRISE_KEY'] %>
base_url: <%= ENV['API_ENTREPRISE_BASE_URL'] %> base_url: <%= ENV['API_ENTREPRISE_BASE_URL'] %>
pipedrive:
key: <%= ENV['PIPEDRIVE_KEY'] %>
fog: fog:
openstack_tenant: <%= ENV['FOG_OPENSTACK_TENANT'] %> openstack_tenant: <%= ENV['FOG_OPENSTACK_TENANT'] %>
openstack_api_key: <%= ENV['FOG_OPENSTACK_API_KEY'] %> openstack_api_key: <%= ENV['FOG_OPENSTACK_API_KEY'] %>
@ -59,6 +61,8 @@ test:
fog: fog:
base_url: https://storage.apientreprise.fr base_url: https://storage.apientreprise.fr
directory: tps_dev directory: tps_dev
pipedrive:
key: pipedrive_test_key
france_connect_particulier: france_connect_particulier:
identifier: france_connect_test_identifier identifier: france_connect_test_identifier
secret: france_connect_test_secret secret: france_connect_test_secret

View file

@ -81,8 +81,6 @@ DatabaseCleaner.strategy = :transaction
TPS::Application.load_tasks TPS::Application.load_tasks
PIPEDRIVE_TOKEN = :pipedrive_test_token if !defined? PIPEDRIVE_TOKEN
include Warden::Test::Helpers include Warden::Test::Helpers
include SmartListing::Helper include SmartListing::Helper