spreedly 2.0.2 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/HISTORY.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.0.3
4
+ * Readme improvements
5
+ * Smarter about timeouts - now only have long timeout for calls
6
+ that actually talk to a payment gateway. The other calls can
7
+ have shorter timeouts.
8
+
3
9
  ## 2.0.2
4
10
  * Add support for gateway options call.
5
11
 
data/README.md CHANGED
@@ -288,6 +288,14 @@ transaction.card.last_name # => "Smedry"
288
288
 
289
289
  ```
290
290
 
291
+ #### Getting meta information about the supported gateways
292
+
293
+ You can get the full list of supported gateways like so:
294
+
295
+ ``` ruby
296
+ env.gateway_options
297
+ ```
298
+
291
299
 
292
300
  ## Error Handling
293
301
 
@@ -359,6 +367,8 @@ handle the case of Spreedly itself not responding. Here's an example:
359
367
  env.purchase_on_gateway(gateway_token, payment_method_token, 802) # Raises Spreedly::TimeoutError
360
368
  ```
361
369
 
370
+ For api calls that actually talk to a payment gateway, the timout is longer since some gateways can take longer to respond when under load.
371
+
362
372
  ## Sample applications using the gem
363
373
 
364
374
  There are some sample applications with source code using this gem. You can [find them here](https://core.spreedly.com/manual/sample_applications).
@@ -99,7 +99,7 @@ module Spreedly
99
99
  end
100
100
 
101
101
  def add_credit_card(options)
102
- api_post(add_payment_method_url, add_credit_card_body(options))
102
+ api_post(add_payment_method_url, add_credit_card_body(options), false)
103
103
  end
104
104
 
105
105
  def update_credit_card(credit_card_token, options)
@@ -202,8 +202,8 @@ module Spreedly
202
202
  builder.to_xml
203
203
  end
204
204
 
205
- def api_post(url, body)
206
- xml_doc = ssl_post(url, body, headers)
205
+ def api_post(url, body, talking_to_gateway = true)
206
+ xml_doc = ssl_post(url, body, headers, talking_to_gateway)
207
207
  Transaction.new_from(xml_doc)
208
208
  end
209
209
 
@@ -2,25 +2,26 @@ module Spreedly
2
2
 
3
3
  module SslRequester
4
4
 
5
- def ssl_get(endpoint, headers = {})
6
- ssl_request(:get, endpoint, nil, headers)
5
+ def ssl_get(endpoint, headers, talking_to_gateway = false)
6
+ ssl_request(:get, endpoint, nil, headers, talking_to_gateway)
7
7
  end
8
8
 
9
- def ssl_post(endpoint, body, headers = {})
10
- ssl_request(:post, endpoint, body, headers)
9
+ def ssl_post(endpoint, body, headers, talking_to_gateway = false)
10
+ ssl_request(:post, endpoint, body, headers, talking_to_gateway)
11
11
  end
12
12
 
13
- def ssl_put(endpoint, body, headers = {})
14
- ssl_request(:put, endpoint, body, headers)
13
+ def ssl_put(endpoint, body, headers, talking_to_gateway = false)
14
+ ssl_request(:put, endpoint, body, headers, talking_to_gateway)
15
15
  end
16
16
 
17
- def ssl_options(endpoint)
18
- ssl_request(:options, endpoint, nil, {})
17
+ def ssl_options(endpoint, talking_to_gateway = false)
18
+ ssl_request(:options, endpoint, nil, {}, talking_to_gateway)
19
19
  end
20
20
 
21
21
  private
22
- def ssl_request(method, endpoint, body, headers)
23
- raw_response = Timeout::timeout(70) do
22
+ def ssl_request(method, endpoint, body, headers, talking_to_gateway)
23
+ how_long = talking_to_gateway ? 66 : 10
24
+ raw_response = Timeout::timeout(how_long) do
24
25
  raw_ssl_request(method, endpoint, body, headers)
25
26
  end
26
27
 
@@ -1,3 +1,3 @@
1
1
  module Spreedly
2
- VERSION = "2.0.2"
2
+ VERSION = "2.0.3"
3
3
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: spreedly
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.0.2
5
+ version: 2.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Spreedly
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-29 00:00:00.000000000 Z
12
+ date: 2013-09-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  prerelease: false
@@ -229,7 +229,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
229
229
  - !ruby/object:Gem::Version
230
230
  segments:
231
231
  - 0
232
- hash: -3250380428935698253
232
+ hash: -2109504524353041148
233
233
  version: '0'
234
234
  none: false
235
235
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -238,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
238
238
  - !ruby/object:Gem::Version
239
239
  segments:
240
240
  - 0
241
- hash: -3250380428935698253
241
+ hash: -2109504524353041148
242
242
  version: '0'
243
243
  none: false
244
244
  requirements: []