Class: PR::Pin::Repositories::Refunds

Inherits:
Object
  • Object
show all
Defined in:
lib/pr/pin/repositories/refunds.rb

Instance Method Summary collapse

Instance Method Details

#create_for_charge(charge_token, *args) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/pr/pin/repositories/refunds.rb', line 22

def create_for_charge(charge_token, *args)
  relation = root.for_charge(charge_token)

  API::Result.wrap(relation) do
    relation.command(:create).call(*args)
  end
end

#find(token) ⇒ Object



16
17
18
19
20
# File 'lib/pr/pin/repositories/refunds.rb', line 16

def find(token)
  relation = root.with_path(token)

  API::Result.wrap(relation) { relation.one }
end

#for_charge(charge_token, page: 1, per_page: nil) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/pr/pin/repositories/refunds.rb', line 30

def for_charge(charge_token, page: 1, per_page: nil)
  relation = root.for_charge(charge_token).with_params(
    page: page,
    per_page: per_page
  )

  API::PaginatedResult.wrap(relation) { relation.paginate }
end

#list(page: 1, per_page: nil) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/pr/pin/repositories/refunds.rb', line 7

def list(page: 1, per_page: nil)
  relation = root.with_params(
    page: page,
    per_page: per_page
  )

  API::PaginatedResult.wrap(relation) { relation.paginate }
end