From ad564ee4ef7af3ff2af3848599e8dbd4b6679838 Mon Sep 17 00:00:00 2001 From: Wlojtek Date: Thu, 21 Jun 2018 14:18:21 +0200 Subject: [PATCH] allow passing client UID to faraday configuration --- lib/avatax/configuration.rb | 5 ++++- lib/avatax/connection.rb | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/avatax/configuration.rb b/lib/avatax/configuration.rb index bee09f3..ea807bb 100644 --- a/lib/avatax/configuration.rb +++ b/lib/avatax/configuration.rb @@ -19,7 +19,8 @@ module Configuration :custom_logger_options, :proxy, :faraday_response, - :response_big_decimal_conversion + :response_big_decimal_conversion, + :client_uid ].freeze DEFAULT_APP_NAME = nil @@ -36,6 +37,7 @@ module Configuration DEFAULT_PROXY = nil DEFAULT_FARADAY_RESPONSE = false DEFAULT_RESPONSE_BIG_DECIMAL_CONVERSION = false + DEFAULT_CLIENT_UID = nil attr_accessor *VALID_OPTIONS_KEYS @@ -70,6 +72,7 @@ def reset self.proxy = DEFAULT_PROXY self.faraday_response = DEFAULT_FARADAY_RESPONSE self.response_big_decimal_conversion = DEFAULT_RESPONSE_BIG_DECIMAL_CONVERSION + self.client_uid = DEFAULT_CLIENT_UID end end diff --git a/lib/avatax/connection.rb b/lib/avatax/connection.rb index 4a50ef0..c33d267 100644 --- a/lib/avatax/connection.rb +++ b/lib/avatax/connection.rb @@ -14,7 +14,8 @@ def connection { 'Accept' => "application/json; charset=utf-8", 'User-Agent' => user_agent, - 'X-Avalara-Client' => client_id + 'X-Avalara-Client' => client_id, + 'X-Avalara-UID' => client_uid }, :url => endpoint, :proxy => proxy