Class: Unit::Resource::StopPaymentResource

Inherits:
BaseResource show all
Defined in:
lib/unit/api_resources/stop_payment_resource.rb

Class Method Summary collapse

Methods inherited from BaseResource

file_response_handler, response_handler

Class Method Details

.create_payment(request) ⇒ UnitResponse, UnitError

Create a stop payment by calling Unit’s API

Parameters:

  • request (CreateStopPaymentRequest)

Returns:



16
17
18
19
20
# File 'lib/unit/api_resources/stop_payment_resource.rb', line 16

def create_payment(request)
  payload = request.to_json_api
  response = HttpHelper.post("#{api_url}/stop-payments", body: payload, headers: headers)
  response_handler(response)
end

.disable_payment(payment_id) ⇒ UnitResponse, UnitError

Disable a stop payment by calling Unit’s API

Parameters:

  • payment_id (String)

Returns:



41
42
43
44
# File 'lib/unit/api_resources/stop_payment_resource.rb', line 41

def disable_payment(payment_id)
  response = HttpHelper.post("#{api_url}/stop-payments/#{payment_id}/disable", headers: headers)
  response_handler(response)
end

.get(payment_id) ⇒ UnitResponse, UnitError

Get a stop payment by calling Unit’s API

Parameters:

  • payment_id (String)

Returns:



25
26
27
28
# File 'lib/unit/api_resources/stop_payment_resource.rb', line 25

def get(payment_id)
  response = HttpHelper.get("#{api_url}/stop-payments/#{payment_id}", headers: headers)
  response_handler(response)
end

.list(params = nil) ⇒ UnitResponse, UnitError

Get a list of stop payments by calling Unit’s API

Parameters:

  • params (ListStopPaymentParams) (defaults to: nil)

Returns:



33
34
35
36
# File 'lib/unit/api_resources/stop_payment_resource.rb', line 33

def list(params = nil)
  response = HttpHelper.get("#{api_url}/stop-payments", params: params.to_hash, headers: headers)
  response_handler(response)
end