
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
TPaga Service gem provides the functionality to call the multiple services of the TPaga platform.
To install as a gem in your environment type in your console:
gem install tpaga_service
If you want to use in your rails application, add to your Gemfile:
gem 'tpaga_service'
And run from your application directory:
bundle install
If you are going to run tpaga in a rails environment add to the environment file (ex: environments/development.rb
) the following lines:
config.schema = 'https'
config.host = 'sandbox.tpaga.co'
config.base_path = '/api'
config.private_api_key = 'd13fr8n7vhvkuch3lq2ds5qhjnd2pddw2'
config.public_api_key = 'e8tbtu6bdi1jts34h2ktdipschq9heq0a'
using the respective api key for your TPaga user account.
Next add the the file tpaga_service.rb
to the rails initializers (ex: initializers/tpaga_service.rb
) with he following lines:
require 'tpaga_service'
TpagaService::Swagger.configure do |config|
config.scheme = Rails.application.config.tpaga_schema
config.host = Rails.application.config.tpaga_host
config.base_path = Rails.application.config.tpaga_base_path
config.private_api_key = Rails.application.config.tpaga_private_api_key
config.public_api_key = Rails.application.config.tpaga_public_api_key
config.inject_format = false
end
if you are not using rails, just simply initialize the service with the lines in the tpaga initializer before you call any service of the api.
You can create a customer:
# if outside from rails
require 'tpaga_service'
# creating a tpaga_service customer object
customer = {
firstName: 'foo',
lastName: 'bar',
email: 'foo@bar.com',
phone: '0000000000',
gender: 'M'
}
# call of the api to create the customer in the TPaga account
customer = TpagaService::CustomerApi.create_customer customer
customer.id # The unique identifier of the customer in the TPaga account
# if the request cannot be completed, raise a generic error
Get a customer by it's id:
customer = TpagaService::CustomerApi.get_customer_by_id 'id'
# returns a TpagaService::Customer object, raise error if not
Delete a customer by it's id:
response = TpagaService::CustomerApi.delete_customer_by_id 'customer_id'
# return nil if success, raise an error if not
You can add a credit card to existing customers:
# build the credit card object to create
credit_card_create = {
primaryAccountNumber: '4111111111111111',
expirationMonth: '08',
expirationYear: '2023',
cardVerificationCode: '789',
cardHolderName: 'Jon Snow'
}
credit_card = TpagaService::CreditCardApi.add_credit_card credit_card_create, 'customer_id'
# returns a TpagaService::CreditCard object, raise error if not
you can get the credit card of customers (NOT AVAILABLE):
credit_card = TpagaService::CreditCardApi.get_credit_card_by_id 'customer_id', 'credit_card_id'
# return a TpagaService::CreditCard object, raise error if not
You can delete the credit card of customers:
TpagaService::CreditCardApi.delete_credit_card_by_id 'customer_id', 'credit_card_id'
# return nil if success, raise error if not
You can charge a credit card:
# build the charge object
charge = {
amount: 10000,
taxAmount: 10000 * 0.1,
currency: 'COP',
orderId: 'Your identifier for the order',
installments: 1,
description: 'A new leash for ghost',
creditCard: 'credit_card_id'
}
charge = TpagaService::CreditCardApi.add_credit_card_charge charge
# return a TpagaService::CreditCardCharge object, raise error if not
Retrieve a charge by it's id (NOT AVAILABLE):
charge = TpagaService::CreditCardApi.get_credit_card_charge_by_id 'charge_id'
# return a TpagaService::CreditCardCharge object, raise error if not
FAQs
Unknown package
We found that tpaga_service demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.