Class: Ponto::Payment

Inherits:
BaseResource show all
Defined in:
lib/ponto/api/payment.rb

Class Method Summary collapse

Methods inherited from BaseResource

create_by_uri, destroy_by_uri, find_by_uri, find_raw_by_uri, #initialize, list_by_uri, #reload!, update_by_uri

Constructor Details

This class inherits a constructor from Ponto::BaseResource

Class Method Details

.create(account_id:, access_token: nil, **attributes) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/ponto/api/payment.rb', line 3

def self.create(account_id:, access_token: nil, **attributes)
  path = Ponto.api_schema["account"]["payments"]
    .gsub("{accountId}", )
    .gsub("{paymentId}", "")
  uri = Ponto.client.build_uri(path)
  create_by_uri(
    uri: uri,
    resource_type: "payment",
    attributes: attributes,
    access_token: access_token
  )
end

.delete(id:, account_id:, access_token:) ⇒ Object



23
24
25
26
27
28
# File 'lib/ponto/api/payment.rb', line 23

def self.delete(id:, account_id:, access_token:)
  uri = Ponto.api_schema["account"]["payments"]
    .gsub("{accountId}", )
    .sub("{paymentId}", id)
  destroy_by_uri(uri: uri, access_token: access_token)
end

.find(id:, account_id:, access_token:) ⇒ Object



16
17
18
19
20
21
# File 'lib/ponto/api/payment.rb', line 16

def self.find(id:, account_id:, access_token:)
  uri = Ponto.api_schema["account"]["payments"]
    .gsub("{accountId}", )
    .sub("{paymentId}", id)
  find_by_uri(uri: uri, access_token: access_token)
end