Class: Zspay::Client
Overview
The Client class is responsible for handling client-related actions within the Zspay platform. It allows for creating clients and their associated cards by extending the Zspay::Resource class.
Class Method Summary collapse
-
.create(client) ⇒ OpenStruct
Creates a new client on the Zspay platform.
-
.create_card(client_id, card) ⇒ OpenStruct
Adds a new card for an existing client on the Zspay platform.
Methods inherited from Resource
delete, endpoint, get, headers, parse_body, parse_json, patch, post, put, req, req_form, req_json, success_request?
Class Method Details
.create(client) ⇒ OpenStruct
Creates a new client on the Zspay platform.
This method sends a POST request to the Zspay API to create a new client record. The client’s information should be provided in the form of a hash.
15 16 17 |
# File 'lib/zspay/resources/client.rb', line 15 def create(client) post("/clientes", client) end |
.create_card(client_id, card) ⇒ OpenStruct
Adds a new card for an existing client on the Zspay platform.
This method sends a POST request to add a new card to the specified client’s account. The card information, including number, expiry date, and CVV, should be provided in the form of a hash.
27 28 29 |
# File 'lib/zspay/resources/client.rb', line 27 def create_card(client_id, card) post("/clientes/#{client_id}/cartoes", card) end |