Commit 4a8bba96e8ca2ca7e96215c51869f23584934548
1 parent
dd338bea
cleanup
Showing
2 changed files
with
5 additions
and
30 deletions
Show diff stats
lib/syspro.rb
lib/syspro/syspro_client.rb
... | ... | @@ -60,19 +60,19 @@ module Syspro |
60 | 60 | |
61 | 61 | # Executes the API call within the given block. Usage looks like: |
62 | 62 | # |
63 | - # client = StripeClient.new | |
63 | + # client = SysproClient.new | |
64 | 64 | # charge, resp = client.request { Charge.create } |
65 | 65 | # |
66 | 66 | def request |
67 | 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 | 71 | begin |
72 | 72 | res = yield |
73 | 73 | [res, @last_response] |
74 | 74 | ensure |
75 | - Thread.current[:stripe_client] = old_stripe_client | |
75 | + Thread.current[:syspro_client] = old_syspro_client | |
76 | 76 | end |
77 | 77 | end |
78 | 78 | |
... | ... | @@ -264,31 +264,6 @@ module Syspro |
264 | 264 | attr_accessor :query_params |
265 | 265 | attr_accessor :request_id |
266 | 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 | 267 | end |
293 | 268 | |
294 | 269 | # SystemProfiler extracts information about the system that we're running | ... | ... |