Class: Secuconnect::Payment::Contract

Inherits:
Client
  • Object
show all
Defined in:
lib/secuconnect/payment/contract.rb

Constant Summary

Constants included from Authenticated

Authenticated::API_PATH_PREFIX

Class Method Summary collapse

Methods included from Connection

#connection

Class Method Details

.create(account_id:, body:) ⇒ Object



20
21
22
23
24
25
# File 'lib/secuconnect/payment/contract.rb', line 20

def create(account_id:, body:)
  path = "#{base_path}/#{}/RequestID"
  response = connection.post(path, body.to_json)

  handle_response(__method__, response)
end

.indexObject



7
8
9
10
11
# File 'lib/secuconnect/payment/contract.rb', line 7

def index
  response = connection.get(base_path)

  handle_response(__method__, response)
end

.show(account_id:) ⇒ Object



13
14
15
16
17
18
# File 'lib/secuconnect/payment/contract.rb', line 13

def show(account_id:)
  path = "#{base_path}/#{}"
  response = connection.get(path)

  handle_response(__method__, response)
end

.validate(account_id:) ⇒ Object

Raises:



27
28
29
30
31
32
33
34
# File 'lib/secuconnect/payment/contract.rb', line 27

def validate(account_id:)
  path = "#{base_path}/#{}"
  response = connection.get(path)

  raise ResponseError.new(response), "#{action.capitalize} response error" unless response.success?

  response.success?
end