Module: PagSeguro::Request
Instance Method Summary collapse
-
#execute(request_method, path, api_version, data, headers) ⇒ Object
Perform the specified HTTP request.
-
#get(path, api_version, data = {}, headers = {}) ⇒ Object
Perform a GET request.
-
#post(path, api_version, data = {}, headers = {}) ⇒ Object
Perform a POST request.
Instance Method Details
#execute(request_method, path, api_version, data, headers) ⇒ Object
Perform the specified HTTP request. It will include the API credentials, api_version, encoding and additional headers.
34 35 36 37 38 39 40 41 |
# File 'lib/pagseguro/request.rb', line 34 def execute(request_method, path, api_version, data, headers) # :nodoc: request.public_send( request_method, PagSeguro.api_url("#{api_version}/#{path}"), extended_data(data), extended_headers(request_method, headers) ) end |
#get(path, api_version, data = {}, headers = {}) ⇒ Object
Perform a GET request.
# path
: the path that will be requested. Must be something like "transactions/code/739D69-79C052C05280-55542D9FBB33-CAB2B1"
. # api_version
: the current PagSeguro API version of the requested service # data
: the data that will be sent as query string. Must be a Hash. # headers
: any additional header that will be sent through the request.
17 18 19 |
# File 'lib/pagseguro/request.rb', line 17 def get(path, api_version, data = {}, headers = {}) execute :get, path, api_version, data, headers end |
#post(path, api_version, data = {}, headers = {}) ⇒ Object
Perform a POST request.
# path
: the path that will be requested. Must be something like "checkout"
. # api_version
: the current PagSeguro API version of the requested service # data
: the data that will be sent as body data. Must be a Hash. # headers
: any additional header that will be sent through the request.
28 29 30 |
# File 'lib/pagseguro/request.rb', line 28 def post(path, api_version, data = {}, headers = {}) execute :post, path, api_version, data, headers end |