Class: PR::Pin::Repositories::Charges
- Inherits:
-
Object
- Object
- PR::Pin::Repositories::Charges
- Defined in:
- lib/pr/pin/repositories/charges.rb
Instance Method Summary collapse
- #create(*args) ⇒ Object
- #find(token) ⇒ Object
- #for_customer(customer_token, page: 1, per_page: nil) ⇒ Object
- #list(page: 1, per_page: nil) ⇒ Object
- #search(**params) ⇒ Object
Instance Method Details
#create(*args) ⇒ Object
7 8 9 10 11 |
# File 'lib/pr/pin/repositories/charges.rb', line 7 def create(*args) API::Result.wrap(root) do root.command(:create).call(*args) end end |
#find(token) ⇒ Object
13 14 15 16 17 |
# File 'lib/pr/pin/repositories/charges.rb', line 13 def find(token) relation = root.with_path(token) API::Result.wrap(relation) { relation.one } end |
#for_customer(customer_token, page: 1, per_page: nil) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/pr/pin/repositories/charges.rb', line 36 def for_customer(customer_token, page: 1, per_page: nil) relation = root.for_customer(customer_token).with_params( page: page, per_page: per_page ) API::PaginatedResult.wrap(relation) { relation.paginate } end |
#list(page: 1, per_page: nil) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/pr/pin/repositories/charges.rb', line 19 def list(page: 1, per_page: nil) relation = root.with_params( page: page, per_page: per_page ) API::PaginatedResult.wrap(relation) { relation.paginate } end |
#search(**params) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/pr/pin/repositories/charges.rb', line 28 def search(**params) relation = root.append_path('search').with_params(params) API::PaginatedResult.wrap(relation) do relation.paginate end end |