restme 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 852b2273c90c0c2eb2673bed5fe62a28df112f2eddd55287c415afff487647db
4
- data.tar.gz: 746415d80a0fd053b9fb89e86f06116416c16c978727472475d6e22bf2c974ae
3
+ metadata.gz: cccc4f918f72719fedda5f137e14cdccf49de3931209a7adf2e9f7d7a974068c
4
+ data.tar.gz: 0e3a7821d6883250e28bb75b5f6ca50841166f6fff2a180740daf8f59dd323df
5
5
  SHA512:
6
- metadata.gz: 981cfa7a02a73c7024cab361704daf3151660abf062324ce3ad44ecf121083349272782a72df26349f58c0550d7f3b7287b71e03e2fdb8502e386267ef1b3464
7
- data.tar.gz: a5d92fa8e80b2f1ff7fceee0c0e0c5d42067b4908d07e45fcf461ebcc6528559dec7b4422ba4c8ae42ab0f7c422482c08fdbe57425d4b0efed0f115975221fc7
6
+ metadata.gz: ef683d119c129847df93624eb7f5480db6ec8bb190fe2aff432c59bb228aecec0a699ce1eb9cd91b23e73888fb1d03abe6c01accf1fe278d5ffab57ef51963f3
7
+ data.tar.gz: bcfefa780c6c4303e47b85492cd80ca51d404c83c8f68976bb0750a949236c0ccc45cd2278a4741747fa877a45b87e418cee46f6675c212e2a80f6572c6ec0bf
data/README.md CHANGED
@@ -13,7 +13,7 @@ This gem manages your controller's responsibilities for:
13
13
 
14
14
  GEMFILE:
15
15
  ```bash
16
- gem 'restme', '~> 1.0', '>= 1.0.2'
16
+ gem 'restme', '~> 1.1'
17
17
  ```
18
18
 
19
19
  INSTALL:
@@ -28,6 +28,35 @@ gem 'restme'
28
28
  - You must create a folder inside app named restfy to define controller rules for authorization, scoping, creation, updating, and field selection (see example below).
29
29
 
30
30
 
31
+ <br>
32
+
33
+ ## Optional Configuration (Available from version 1.1 or higher)
34
+
35
+ You can create a `restme.rb` file inside `config/initializers` to customize Restme's behavior:
36
+
37
+ - Define the name of the controller variable that holds the current user (default: `current_user`).
38
+ - Define the name of the user field that identifies the user's role (default: `role`).
39
+ - Set the default number of items returned per page (default: `12`).
40
+ - Set the default starting page (default: `1`).
41
+ - Define the maximum number of items allowed per page (default: `100`).
42
+
43
+ Example:
44
+
45
+ ```ruby
46
+ # config/initializers/restme.rb
47
+
48
+ Restme.configure do |config|
49
+ config.current_user_variable = :current_user
50
+ config.user_role_field = :role
51
+ config.pagination_default_per_page = 12
52
+ config.pagination_default_page = 1
53
+ config.pagination_max_per_page = 100
54
+ end
55
+ ```
56
+
57
+ <br>
58
+
59
+
31
60
  ### Usage examples
32
61
 
33
62
  Rails API project example here: https://github.com/everson-ever/restme-example/pull/1
@@ -64,8 +64,8 @@ module Restme
64
64
  def pagination
65
65
  {
66
66
  page: page_no,
67
- pages: pages(model_scope),
68
- total_items: total_items(model_scope)
67
+ pages: pages(filtered_scope),
68
+ total_items: total_items(filtered_scope)
69
69
  }
70
70
  end
71
71
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Restme
4
- VERSION = "1.1.0"
4
+ VERSION = "1.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restme
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - everson-ever