lib/convert_api/client.rb in convert_api-1.4.0 vs lib/convert_api/client.rb in convert_api-2.0.0

- old
+ new

@@ -99,14 +99,14 @@ # http.set_debug_output $stderr http end def request_uri(path, params = {}) - raise(SecretError, 'API secret not configured') if config.api_secret.nil? + raise(AuthenticationError, 'API secret or Token not configured') if authentication.nil? - params_with_secret = params.merge(Secret: config.api_secret) - query = URI.encode_www_form(params_with_secret) + params_with_authentication = params.merge(authentication) + query = URI.encode_www_form(params_with_authentication) base_uri.path + path + '?' + query end def build_form_data(params) @@ -119,9 +119,16 @@ data[key] = value end end data + end + + def authentication + return { Secret: config.api_secret } unless config.api_secret.nil? + return { Token: config.token } unless config.token.nil? + + nil end def base_uri config.base_uri end