Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ Style/MultilineTernaryOperator:
Layout/MultilineMethodCallIndentation:
Enabled: false

Style/OptionalBooleanParameter:
Enabled: false

Style/KeywordParametersOrder:
Enabled: false

Expand Down
8 changes: 0 additions & 8 deletions CHANGELOG.md

This file was deleted.

53 changes: 31 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,37 @@

### Important Notes

- **Available Features:** This SDK currently contains only 3 of PayPal's API endpoints. Additional endpoints and functionality will be added in the future.
- **Available Features:** This SDK currently contains only 5 of PayPal's API endpoints. Additional endpoints and functionality will be added in the future.

### Information

The PayPal Server SDK provides integration access to the PayPal REST APIs. The API endpoints are divided into distinct controllers:

- Orders Controller: [Orders API v2](https://developer.paypal.com/docs/api/orders/v2/)
- Payments Controller: [Payments API v2](https://developer.paypal.com/docs/api/payments/v2
- Payments Controller: [Payments API v2](https://developer.paypal.com/docs/api/payments/v2)
- Vault Controller: [Payment Method Tokens API v3](https://developer.paypal.com/docs/api/payment-tokens/v3/) *Available in the US only.*
- Transaction Search Controller: [Transaction Search API v1](https://developer.paypal.com/docs/api/transaction-search/v1/)
- Subscriptions Controller: [Subscriptions API v1](https://developer.paypal.com/docs/api/subscriptions/v1/)

## Install the Package

Install the gem from the command line:

```bash
gem install paypal-server-sdk -v 1.1.0
gem install paypal-server-sdk -v 2.0.0
```

Or add the gem to your Gemfile and run `bundle`:

```ruby
gem 'paypal-server-sdk', '1.1.0'
gem 'paypal-server-sdk', '2.0.0'
```

For additional gem details, see the [RubyGems page for the paypal-server-sdk gem](https://rubygems.org/gems/paypal-server-sdk/versions/1.1.0).
For additional gem details, see the [RubyGems page for the paypal-server-sdk gem](https://rubygems.org/gems/paypal-server-sdk/versions/2.0.0).

## Initialize the API Client

**_Note:_** Documentation for the client can be found [here.](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/1.1.0/doc/client.md)
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/2.0.0/doc/client.md)

The following parameters are configurable for the API Client:

Expand All @@ -49,13 +51,17 @@ The following parameters are configurable for the API Client:
| retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
| retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
| http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
| logging_configuration | [`LoggingConfiguration`](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/1.1.0/doc/logging-configuration.md) | The SDK logging configuration for API calls |
| client_credentials_auth_credentials | [`ClientCredentialsAuthCredentials`](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/1.1.0/doc/auth/oauth-2-client-credentials-grant.md) | The credential object for OAuth 2 Client Credentials Grant |
| proxy_settings | [`ProxySettings`](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/2.0.0/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
| logging_configuration | [`LoggingConfiguration`](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/2.0.0/doc/logging-configuration.md) | The SDK logging configuration for API calls |
| client_credentials_auth_credentials | [`ClientCredentialsAuthCredentials`](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/2.0.0/doc/auth/oauth-2-client-credentials-grant.md) | The credential object for OAuth 2 Client Credentials Grant |

The API client can be initialized as follows:

```ruby
client = PaypalServerSdk::Client.new(
require 'paypal_server_sdk'
include PaypalServerSdk

client = Client.new(
client_credentials_auth_credentials: ClientCredentialsAuthCredentials.new(
o_auth_client_id: 'OAuthClientId',
o_auth_client_secret: 'OAuthClientSecret'
Expand Down Expand Up @@ -88,31 +94,34 @@ The SDK can be configured to use a different environment for making API calls. A

This API uses the following authentication schemes.

* [`Oauth2 (OAuth 2 Client Credentials Grant)`](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/1.1.0/doc/auth/oauth-2-client-credentials-grant.md)
* [`Oauth2 (OAuth 2 Client Credentials Grant)`](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/2.0.0/doc/auth/oauth-2-client-credentials-grant.md)

## List of APIs

* [Orders](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/1.1.0/doc/controllers/orders.md)
* [Payments](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/1.1.0/doc/controllers/payments.md)
* [Vault](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/1.1.0/doc/controllers/vault.md)
* [Transactionsearch](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/2.0.0/doc/controllers/transactionsearch.md)
* [Orders](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/2.0.0/doc/controllers/orders.md)
* [Payments](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/2.0.0/doc/controllers/payments.md)
* [Vault](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/2.0.0/doc/controllers/vault.md)
* [Subscriptions](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/2.0.0/doc/controllers/subscriptions.md)

## SDK Infrastructure

### Configuration

* [AbstractLogger](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/1.1.0/doc/abstract-logger.md)
* [LoggingConfiguration](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/1.1.0/doc/logging-configuration.md)
* [RequestLoggingConfiguration](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/1.1.0/doc/request-logging-configuration.md)
* [ResponseLoggingConfiguration](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/1.1.0/doc/response-logging-configuration.md)
* [ProxySettings](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/2.0.0/doc/proxy-settings.md)
* [AbstractLogger](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/2.0.0/doc/abstract-logger.md)
* [LoggingConfiguration](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/2.0.0/doc/logging-configuration.md)
* [RequestLoggingConfiguration](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/2.0.0/doc/request-logging-configuration.md)
* [ResponseLoggingConfiguration](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/2.0.0/doc/response-logging-configuration.md)

### HTTP

* [HttpResponse](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/1.1.0/doc/http-response.md)
* [HttpRequest](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/1.1.0/doc/http-request.md)
* [HttpResponse](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/2.0.0/doc/http-response.md)
* [HttpRequest](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/2.0.0/doc/http-request.md)

### Utilities

* [ApiResponse](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/1.1.0/doc/api-response.md)
* [ApiHelper](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/1.1.0/doc/api-helper.md)
* [DateTimeHelper](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/1.1.0/doc/date-time-helper.md)
* [ApiResponse](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/2.0.0/doc/api-response.md)
* [ApiHelper](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/2.0.0/doc/api-helper.md)
* [DateTimeHelper](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/2.0.0/doc/date-time-helper.md)

5 changes: 4 additions & 1 deletion doc/abstract-logger.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ end
Following is how the custom logger implementation can be injected in the SDK client.

```ruby
client = PaypalServerSdk::Client.new(
require 'paypal_server_sdk'
include PaypalServerSdk

client = Client.new(
logging_configuration: LoggingConfiguration.new(
logger: CustomLogger.new
)
Expand Down
15 changes: 12 additions & 3 deletions doc/auth/oauth-2-client-credentials-grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ Documentation for accessing and setting credentials for Oauth2.
You must initialize the client with *OAuth 2.0 Client Credentials Grant* credentials as shown in the following code snippet. This will fetch the OAuth token automatically when any of the endpoints, requiring *OAuth 2.0 Client Credentials Grant* authentication, are called.

```ruby
client = PaypalServerSdk::Client.new(
require 'paypal_server_sdk'
include PaypalServerSdk

client = Client.new(
client_credentials_auth_credentials: ClientCredentialsAuthCredentials.new(
o_auth_client_id: 'OAuthClientId',
o_auth_client_secret: 'OAuthClientSecret'
Expand All @@ -44,7 +47,10 @@ Your application can also manually provide an OAuthToken using the setter `in` o
Whenever the OAuth Token gets updated, the provided callback implementation will be executed. For instance, you may use it to store your access token whenever it gets updated.

```ruby
client = PaypalServerSdk::Client.new(
require 'paypal_server_sdk'
include PaypalServerSdk

client = Client.new(
client_credentials_auth_credentials: ClientCredentialsAuthCredentials.new(
o_auth_client_id: 'OAuthClientId',
o_auth_client_secret: 'OAuthClientSecret',
Expand All @@ -62,6 +68,9 @@ client = PaypalServerSdk::Client.new(


```ruby
require 'paypal_server_sdk'
include PaypalServerSdk

def o_auth_token_provider(last_oauth_token, auth_manager)
# Add the callback handler to provide a new OAuth token
# It will be triggered whenever the last provided o_auth_token is null or expired
Expand All @@ -75,7 +84,7 @@ _o_auth_token_provider = proc do | last_oauth_token, auth_manager |
end


client = PaypalServerSdk::Client.new(
client = Client.new(
client_credentials_auth_credentials: ClientCredentialsAuthCredentials.new(
o_auth_client_id: 'OAuthClientId',
o_auth_client_secret: 'OAuthClientSecret',
Expand Down
8 changes: 7 additions & 1 deletion doc/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ The following parameters are configurable for the API Client:
| retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
| retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
| http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
| proxy_settings | [`ProxySettings`](../doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
| logging_configuration | [`LoggingConfiguration`](../doc/logging-configuration.md) | The SDK logging configuration for API calls |
| client_credentials_auth_credentials | [`ClientCredentialsAuthCredentials`](auth/oauth-2-client-credentials-grant.md) | The credential object for OAuth 2 Client Credentials Grant |

The API client can be initialized as follows:

```ruby
client = PaypalServerSdk::Client.new(
require 'paypal_server_sdk'
include PaypalServerSdk

client = Client.new(
client_credentials_auth_credentials: ClientCredentialsAuthCredentials.new(
o_auth_client_id: 'OAuthClientId',
o_auth_client_secret: 'OAuthClientSecret'
Expand Down Expand Up @@ -50,5 +54,7 @@ The gateway for the SDK. This class acts as a factory for the Controllers and al
| orders | Gets OrdersController |
| payments | Gets PaymentsController |
| vault | Gets VaultController |
| transaction_search | Gets TransactionSearchController |
| subscriptions | Gets SubscriptionsController |
| o_auth_authorization | Gets OAuthAuthorizationController |

Loading
Loading