@@ -77,7 +77,7 @@ def self.get(path, params = {}, options = {})
7777 req . headers [ :invalidate_cache ] = invalidate_cache
7878 end
7979 end
80- puts "Getting: #{ path } with #{ params } (t: #{ time } s - cache: #{ response . headers [ "X-Rack-Cache" ] } )" if $DEBUG_API_CLIENT
80+ log "Getting: #{ path } with #{ params } (t: #{ time } s - cache: #{ response . headers [ "X-Rack-Cache" ] } )" if $DEBUG_API_CLIENT
8181 rescue Exception => e
8282 params = Faraday ::Utils . build_query ( params )
8383 path << "?" unless params . empty? || path . include? ( "?" )
@@ -95,7 +95,7 @@ def self.get(path, params = {}, options = {})
9595 obj = recursive_struct ( load_json ( response . body ) )
9696 end
9797 rescue StandardError => e
98- puts "Problem getting #{ path } " if $DEBUG_API_CLIENT
98+ log "Problem getting #{ path } "
9999 raise e
100100 end
101101 obj
@@ -151,7 +151,7 @@ def self.patch(path, obj)
151151 end
152152
153153 def self . delete ( id )
154- puts "Deleting #{ id } " if $DEBUG_API_CLIENT
154+ log "Deleting #{ id } " if $DEBUG_API_CLIENT
155155 response = conn . delete id
156156 raise StandardError , response . body if response . status >= 500
157157
@@ -162,6 +162,9 @@ def self.object_from_json(json)
162162 recursive_struct ( load_json ( json ) )
163163 end
164164
165+ def self . log ( message )
166+ puts message if $DEBUG_API_CLIENT
167+ end
165168 private
166169
167170 def self . custom_req ( obj , file , file_attribute , req )
0 commit comments