README.md in paypal-rest-api-0.1.1 vs README.md in paypal-rest-api-0.2.0
- old
+ new
@@ -33,11 +33,15 @@
client_secret: ENV['PAYPAL_CLIENT_SECRET'],
live: false
)
# in your business logic
-response = PaypalAPI::Orders.show(order_id)
+PaypalAPI.live? # => false
+PaypalAPI.api_url # => "https://api-m.sandbox.paypal.com"
+PaypalAPI.web_url # => "https://sandbox.paypal.com"
+
+response = between redeploys::Orders.show(order_id)
response = PaypalAPI::Orders.create(body: body)
```
### Setting local client
@@ -47,10 +51,14 @@
client_id: ENV['PAYPAL_CLIENT_ID'],
client_secret: ENV['PAYPAL_CLIENT_SECRET'],
live: false
)
+client.live? # => false
+client.api_url # => "https://api-m.sandbox.paypal.com"
+client.web_url # => "https://sandbox.paypal.com"
+
response = client.orders.show(order_id)
response = client.orders.create(body: body)
```
### Client REST methods
@@ -89,11 +97,11 @@
response.request # Request that generates this response
```
## Configuration options
-PaypalAPI client accepts this additional options: `:live`, `:retries`, `:http_opts`
+PaypalAPI client accepts this additional options: `:live`, `:retries`, `:http_opts`, `:cache`
### Option `:live`
PaypalAPI client can be defined with `live` option which is `false` by default.
When `live` is `false` all requests will be send to the sandbox endpoints.
@@ -106,12 +114,12 @@
```
### Option `:retries`
This is a Hash with retries configuration.
-By default retries are enabled, 3 retries with 0.25, 0.75, 1.5 seconds delay.
-Default config: `{enabled: true, count: 3, sleep: [0.25, 0.75, 1.5]}`.
+By default retries are enabled, 4 retries with 0, 0.25, 0.75, 1.5 seconds delay.
+Default config: `{enabled: true, count: 4, sleep: [0, 0.25, 0.75, 1.5]}`.
New options are merged with defaults.
Please keep `sleep` array same size as `count`.
Retries happen on any network error, on 409, 429, 5xx response status code.
@@ -133,9 +141,25 @@
By default it is an empty hash.
```ruby
client = PaypalAPI::Client.new(
http_opts: {read_timeout: 30, write_timeout: 30, open_timeout: 30}
+ # ...
+)
+```
+
+### Option `:cache`
+
+This option can be added to save certificates to between redeploys to validate
+webhooks offline. By default this gem has only in-memory caching.
+Cache object must response to standard caching `#fetch(key, &block)` method.
+
+By default it is `nil`, so downloaded certificates will be downloaded again after
+redeploys.
+
+```ruby
+client = PaypalAPI::Client.new(
+ cache: Rails.cache
# ...
)
```
## Webhoooks verification