Class: PR::Pin::Repositories::Plans

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

Instance Method Summary collapse

Instance Method Details

#create(*args) ⇒ Object



7
8
9
10
11
# File 'lib/pr/pin/repositories/plans.rb', line 7

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

#find(token) ⇒ Object



19
20
21
22
23
# File 'lib/pr/pin/repositories/plans.rb', line 19

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

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

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



25
26
27
28
29
30
31
32
# File 'lib/pr/pin/repositories/plans.rb', line 25

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

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

#update(token, *args) ⇒ Object



13
14
15
16
17
# File 'lib/pr/pin/repositories/plans.rb', line 13

def update(token, *args)
  API::Result.wrap(root) do
    root.append_path(token).command(:update).call(*args)
  end
end