Commit 4a8bba96e8ca2ca7e96215c51869f23584934548

Authored by Isaac Lewis
1 parent dd338bea

cleanup

Showing 2 changed files with 5 additions and 30 deletions   Show diff stats
@@ -94,5 +94,5 @@ module Syspro @@ -94,5 +94,5 @@ module Syspro
94 @max_network_retries = val.to_i 94 @max_network_retries = val.to_i
95 end 95 end
96 96
97 - Stripe.log_level = ENV["STRIPE_LOG"] unless ENV["STRIPE_LOG"].nil? 97 + Syspro.log_level = ENV["SYSPRO_LOG"] unless ENV["SYSPRO_LOG"].nil?
98 end 98 end
lib/syspro/syspro_client.rb
@@ -60,19 +60,19 @@ module Syspro @@ -60,19 +60,19 @@ module Syspro
60 60
61 # Executes the API call within the given block. Usage looks like: 61 # Executes the API call within the given block. Usage looks like:
62 # 62 #
63 - # client = StripeClient.new 63 + # client = SysproClient.new
64 # charge, resp = client.request { Charge.create } 64 # charge, resp = client.request { Charge.create }
65 # 65 #
66 def request 66 def request
67 @last_response = nil 67 @last_response = nil
68 - old_stripe_client = Thread.current[:stripe_client]  
69 - Thread.current[:stripe_client] = self 68 + old_syspro_client = Thread.current[:syspro_client]
  69 + Thread.current[:syspro_client] = self
70 70
71 begin 71 begin
72 res = yield 72 res = yield
73 [res, @last_response] 73 [res, @last_response]
74 ensure 74 ensure
75 - Thread.current[:stripe_client] = old_stripe_client 75 + Thread.current[:syspro_client] = old_syspro_client
76 end 76 end
77 end 77 end
78 78
@@ -264,31 +264,6 @@ module Syspro @@ -264,31 +264,6 @@ module Syspro
264 attr_accessor :query_params 264 attr_accessor :query_params
265 attr_accessor :request_id 265 attr_accessor :request_id
266 attr_accessor :user_id 266 attr_accessor :user_id
267 -  
268 - # The idea with this method is that we might want to update some of  
269 - # context information because a response that we've received from the API  
270 - # contains information that's more authoritative than what we started  
271 - # with for a request. For example, we should trust whatever came back in  
272 - # a `Stripe-Version` header beyond what configuration information that we  
273 - # might have had available.  
274 - def dup_from_response(resp)  
275 - return self if resp.nil?  
276 -  
277 - # Faraday's API is a little unusual. Normally it'll produce a response  
278 - # object with a `headers` method, but on error what it puts into  
279 - # `e.response` is an untyped `Hash`.  
280 - headers = if resp.is_a?(Faraday::Response)  
281 - resp.headers  
282 - else  
283 - resp[:headers]  
284 - end  
285 -  
286 - context = dup  
287 - context.account = headers["Stripe-Account"]  
288 - context.api_version = headers["Stripe-Version"]  
289 - context.request_id = headers["Request-Id"]  
290 - context  
291 - end  
292 end 267 end
293 268
294 # SystemProfiler extracts information about the system that we're running 269 # SystemProfiler extracts information about the system that we're running