# pnap_payments_api PaymentsApi - the Ruby gem for the Payments API Payments API are currently designed to fetch Transactions only. This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: 0.1 For more information, please visit [https://phoenixnap.com/](https://phoenixnap.com/) ## Installation ### Build a gem To build the Ruby code into a gem: ```shell gem build pnap_payments_api.gemspec ``` Then either install the gem locally, replacing `` with the actual version: ```shell gem install ./pnap_payments_api-.gem ``` (for development, run `gem install --dev ./pnap_payments_api-.gem` to install the development dependencies) or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). Finally add this to the Gemfile: gem 'pnap_payments_api', '~> ' ### Install from Git To install this Gem from this repository, you'll need to get Bundler by doing `gem install bundler`. Add the following line in your Gemfile: gem 'pnap_payments_api', git: 'https://github.com/phoenixnap/ruby-sdk-bmc-poc', glob: 'PaymentsApi/*.gemspec' If you'd like the development version: gem 'pnap_payments_api', git: 'https://github.com/phoenixnap/ruby-sdk-bmc-poc', glob: 'PaymentsApi/*.gemspec', branch: 'develop' Then run `bundle install`. ### Include the Ruby code directly Include the Ruby code directly using `-I` as follows: ```shell ruby -Ilib script.rb ``` ## Getting Started Please follow the [installation](#installation) procedure and then run the following code: ```ruby # Load the gem require 'pnap_payments_api' # Setup authorization PaymentsApi.configure do |config| # Configure OAuth2 access token for authorization: OAuth2 config.access_token = 'YOUR ACCESS TOKEN' # Configure a proc to get access tokens in lieu of the static access_token configuration config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } end api_instance = PaymentsApi::TransactionsApi.new transaction_id = '0a1b2c3d4f5g6h7i8j9k' # String | The transaction identifier. begin #Get Transaction. result = api_instance.transaction_id_get(transaction_id) p result rescue PaymentsApi::ApiError => e puts "Exception when calling TransactionsApi->transaction_id_get: #{e}" end ``` Authorization can also be setup by using the [`oauth`](https://github.com/oauth-xx/oauth2) library: ```ruby # Load the gem require 'pnap_payments_api' require 'oauth2' # Setup variables for getting a token. client_id = 'YOUR_CLIENT_ID' client_secret = 'YOUR_CLIENT_SECRET' auth_url = 'https://auth.phoenixnap.com/auth/realms/BMC/protocol/openid-connect/token' # Setup authorization PaymentsApi.configure do |config| # Retrieve the token using OAuth2. client = OAuth2::Client.new(client_id, client_secret, token_url: auth_url) token = client.client_credentials.get_token # Configure OAuth2 access token for authorization: OAuth2 config.access_token = token.token end ``` ## Documentation for API Endpoints All URIs are relative to *https://api.phoenixnap.com/payments/v1* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *PaymentsApi::TransactionsApi* | [**transaction_id_get**](docs/TransactionsApi.md#transaction_id_get) | **GET** /transactions/{transactionId} | Get Transaction. *PaymentsApi::TransactionsApi* | [**transactions_get**](docs/TransactionsApi.md#transactions_get) | **GET** /transactions | Get Transactions. ## Documentation for Models - [PaymentsApi::CardPaymentMethodDetails](docs/CardPaymentMethodDetails.md) - [PaymentsApi::Error](docs/Error.md) - [PaymentsApi::PaginatedResponse](docs/PaginatedResponse.md) - [PaymentsApi::PaginatedTransactions](docs/PaginatedTransactions.md) - [PaymentsApi::Transaction](docs/Transaction.md) - [PaymentsApi::TransactionMetadata](docs/TransactionMetadata.md) ## Documentation for Authorization Authentication schemes defined for the API: ### OAuth2 - **Type**: OAuth - **Flow**: application - **Authorization URL**: - **Scopes**: - transactions: Grants full access to transactions. - transactions.read: Grants read only access to transactions.