active_record_api-rest 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6fa1955af8c25e2210994802eb09bdbfbdb5a38c76092ee6bcbf202b5e5ef997
4
- data.tar.gz: be2e65c8efcf3e9abf1d651f4cbd9c14dcdfca0745ff13ff8847bcc79de4e686
3
+ metadata.gz: 9c5aa165447aaf0f8949ece6962db3ef0136eb9e027cec4a16d95f5561d0c7c3
4
+ data.tar.gz: '056273771414309c4a36a13ba1832a06f79bed140db1b171cdee18e4937d4bac'
5
5
  SHA512:
6
- metadata.gz: 4092ee83c28deb1f1356124a19767539782e12ef9d9e7e734c81661d39fcef30a23e046500be7465db37ce310cd4651bd3cdcdcaf5fa207d7d6a3b9ce9e3c3e2
7
- data.tar.gz: aeb9066036e98a4fcba8ceb0d61da2d717ab030c6580ddc97457e6e9523d294e1359809ad3a17e25d88b9ff63fd2a702281088cd56bb0429bb34f6bf783d719b
6
+ metadata.gz: 441b71b2ae9b0af5874c3a916fee6c6ad55bbb7903753a416efcd55374ddaa1b565d2987b9200d31c9f40574a0316377351b6c8629375485c35b7361fe36aceb
7
+ data.tar.gz: 7981855e67a1f2cf08099938aee5cae43a2f312fe0b1b81a76d83583fb5c093de4e07f17a8c03489a5c5de47d936d67994583994446d952e17c5b2f66183f16d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- active_record_api-rest (0.1.7)
4
+ active_record_api-rest (0.1.8)
5
5
  active_attr
6
6
  active_model_serializers
7
7
  cancancan
@@ -10,162 +10,162 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- actioncable (5.2.0)
14
- actionpack (= 5.2.0)
13
+ actioncable (5.2.2)
14
+ actionpack (= 5.2.2)
15
15
  nio4r (~> 2.0)
16
16
  websocket-driver (>= 0.6.1)
17
- actionmailer (5.2.0)
18
- actionpack (= 5.2.0)
19
- actionview (= 5.2.0)
20
- activejob (= 5.2.0)
17
+ actionmailer (5.2.2)
18
+ actionpack (= 5.2.2)
19
+ actionview (= 5.2.2)
20
+ activejob (= 5.2.2)
21
21
  mail (~> 2.5, >= 2.5.4)
22
22
  rails-dom-testing (~> 2.0)
23
- actionpack (5.2.0)
24
- actionview (= 5.2.0)
25
- activesupport (= 5.2.0)
23
+ actionpack (5.2.2)
24
+ actionview (= 5.2.2)
25
+ activesupport (= 5.2.2)
26
26
  rack (~> 2.0)
27
27
  rack-test (>= 0.6.3)
28
28
  rails-dom-testing (~> 2.0)
29
29
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
30
- actionview (5.2.0)
31
- activesupport (= 5.2.0)
30
+ actionview (5.2.2)
31
+ activesupport (= 5.2.2)
32
32
  builder (~> 3.1)
33
33
  erubi (~> 1.4)
34
34
  rails-dom-testing (~> 2.0)
35
35
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
36
- active_attr (0.11.0)
36
+ active_attr (0.12.0)
37
37
  activemodel (>= 3.0.2, < 6.0)
38
38
  activesupport (>= 3.0.2, < 6.0)
39
- active_model_serializers (0.10.7)
39
+ active_model_serializers (0.10.9)
40
40
  actionpack (>= 4.1, < 6)
41
41
  activemodel (>= 4.1, < 6)
42
42
  case_transform (>= 0.2)
43
43
  jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
44
- activejob (5.2.0)
45
- activesupport (= 5.2.0)
44
+ activejob (5.2.2)
45
+ activesupport (= 5.2.2)
46
46
  globalid (>= 0.3.6)
47
- activemodel (5.2.0)
48
- activesupport (= 5.2.0)
49
- activerecord (5.2.0)
50
- activemodel (= 5.2.0)
51
- activesupport (= 5.2.0)
47
+ activemodel (5.2.2)
48
+ activesupport (= 5.2.2)
49
+ activerecord (5.2.2)
50
+ activemodel (= 5.2.2)
51
+ activesupport (= 5.2.2)
52
52
  arel (>= 9.0)
53
- activestorage (5.2.0)
54
- actionpack (= 5.2.0)
55
- activerecord (= 5.2.0)
53
+ activestorage (5.2.2)
54
+ actionpack (= 5.2.2)
55
+ activerecord (= 5.2.2)
56
56
  marcel (~> 0.3.1)
57
- activesupport (5.2.0)
57
+ activesupport (5.2.2)
58
58
  concurrent-ruby (~> 1.0, >= 1.0.2)
59
59
  i18n (>= 0.7, < 2)
60
60
  minitest (~> 5.1)
61
61
  tzinfo (~> 1.1)
62
- addressable (2.5.2)
62
+ addressable (2.6.0)
63
63
  public_suffix (>= 2.0.2, < 4.0)
64
64
  arel (9.0.0)
65
65
  builder (3.2.3)
66
66
  byebug (10.0.2)
67
- cancancan (2.2.0)
67
+ cancancan (2.3.0)
68
68
  case_transform (0.2)
69
69
  activesupport
70
70
  coderay (1.1.2)
71
- concurrent-ruby (1.0.5)
71
+ concurrent-ruby (1.1.4)
72
72
  crack (0.4.3)
73
73
  safe_yaml (~> 1.0.0)
74
74
  crass (1.0.4)
75
75
  database_cleaner (1.7.0)
76
76
  diff-lcs (1.3)
77
77
  docile (1.3.1)
78
- erubi (1.7.1)
79
- factory_bot (4.10.0)
80
- activesupport (>= 3.0.0)
81
- factory_bot_rails (4.10.0)
82
- factory_bot (~> 4.10.0)
83
- railties (>= 3.0.0)
84
- faker (1.8.7)
78
+ erubi (1.8.0)
79
+ factory_bot (5.0.1)
80
+ activesupport (>= 4.2.0)
81
+ factory_bot_rails (5.0.1)
82
+ factory_bot (~> 5.0.0)
83
+ railties (>= 4.2.0)
84
+ faker (1.9.3)
85
85
  i18n (>= 0.7)
86
- globalid (0.4.1)
86
+ globalid (0.4.2)
87
87
  activesupport (>= 4.2.0)
88
- hashdiff (0.3.7)
89
- i18n (1.0.1)
88
+ hashdiff (0.3.8)
89
+ i18n (1.5.3)
90
90
  concurrent-ruby (~> 1.0)
91
91
  json (2.1.0)
92
92
  json_spec (1.1.5)
93
93
  multi_json (~> 1.0)
94
94
  rspec (>= 2.0, < 4.0)
95
95
  jsonapi-renderer (0.2.0)
96
- loofah (2.2.2)
96
+ loofah (2.2.3)
97
97
  crass (~> 1.0.2)
98
98
  nokogiri (>= 1.5.9)
99
- mail (2.7.0)
99
+ mail (2.7.1)
100
100
  mini_mime (>= 0.1.1)
101
- marcel (0.3.2)
101
+ marcel (0.3.3)
102
102
  mimemagic (~> 0.3.2)
103
- method_source (0.9.0)
104
- mimemagic (0.3.2)
105
- mini_mime (1.0.0)
106
- mini_portile2 (2.3.0)
103
+ method_source (0.9.2)
104
+ mimemagic (0.3.3)
105
+ mini_mime (1.0.1)
106
+ mini_portile2 (2.4.0)
107
107
  minitest (5.11.3)
108
108
  multi_json (1.13.1)
109
109
  nio4r (2.3.1)
110
- nokogiri (1.8.4)
111
- mini_portile2 (~> 2.3.0)
112
- pg (1.0.0)
113
- pry (0.11.3)
110
+ nokogiri (1.10.1)
111
+ mini_portile2 (~> 2.4.0)
112
+ pg (1.1.4)
113
+ pry (0.12.2)
114
114
  coderay (~> 1.1.0)
115
115
  method_source (~> 0.9.0)
116
116
  pry-byebug (3.6.0)
117
117
  byebug (~> 10.0)
118
118
  pry (~> 0.10)
119
- public_suffix (3.0.2)
120
- rack (2.0.5)
121
- rack-test (1.0.0)
119
+ public_suffix (3.0.3)
120
+ rack (2.0.6)
121
+ rack-test (1.1.0)
122
122
  rack (>= 1.0, < 3)
123
- rails (5.2.0)
124
- actioncable (= 5.2.0)
125
- actionmailer (= 5.2.0)
126
- actionpack (= 5.2.0)
127
- actionview (= 5.2.0)
128
- activejob (= 5.2.0)
129
- activemodel (= 5.2.0)
130
- activerecord (= 5.2.0)
131
- activestorage (= 5.2.0)
132
- activesupport (= 5.2.0)
123
+ rails (5.2.2)
124
+ actioncable (= 5.2.2)
125
+ actionmailer (= 5.2.2)
126
+ actionpack (= 5.2.2)
127
+ actionview (= 5.2.2)
128
+ activejob (= 5.2.2)
129
+ activemodel (= 5.2.2)
130
+ activerecord (= 5.2.2)
131
+ activestorage (= 5.2.2)
132
+ activesupport (= 5.2.2)
133
133
  bundler (>= 1.3.0)
134
- railties (= 5.2.0)
134
+ railties (= 5.2.2)
135
135
  sprockets-rails (>= 2.0.0)
136
136
  rails-dom-testing (2.0.3)
137
137
  activesupport (>= 4.2.0)
138
138
  nokogiri (>= 1.6)
139
139
  rails-html-sanitizer (1.0.4)
140
140
  loofah (~> 2.2, >= 2.2.2)
141
- railties (5.2.0)
142
- actionpack (= 5.2.0)
143
- activesupport (= 5.2.0)
141
+ railties (5.2.2)
142
+ actionpack (= 5.2.2)
143
+ activesupport (= 5.2.2)
144
144
  method_source
145
145
  rake (>= 0.8.7)
146
- thor (>= 0.18.1, < 2.0)
146
+ thor (>= 0.19.0, < 2.0)
147
147
  rake (10.5.0)
148
- rspec (3.7.0)
149
- rspec-core (~> 3.7.0)
150
- rspec-expectations (~> 3.7.0)
151
- rspec-mocks (~> 3.7.0)
152
- rspec-core (3.7.1)
153
- rspec-support (~> 3.7.0)
154
- rspec-expectations (3.7.0)
148
+ rspec (3.8.0)
149
+ rspec-core (~> 3.8.0)
150
+ rspec-expectations (~> 3.8.0)
151
+ rspec-mocks (~> 3.8.0)
152
+ rspec-core (3.8.0)
153
+ rspec-support (~> 3.8.0)
154
+ rspec-expectations (3.8.2)
155
155
  diff-lcs (>= 1.2.0, < 2.0)
156
- rspec-support (~> 3.7.0)
157
- rspec-mocks (3.7.0)
156
+ rspec-support (~> 3.8.0)
157
+ rspec-mocks (3.8.0)
158
158
  diff-lcs (>= 1.2.0, < 2.0)
159
- rspec-support (~> 3.7.0)
160
- rspec-rails (3.7.2)
159
+ rspec-support (~> 3.8.0)
160
+ rspec-rails (3.8.2)
161
161
  actionpack (>= 3.0)
162
162
  activesupport (>= 3.0)
163
163
  railties (>= 3.0)
164
- rspec-core (~> 3.7.0)
165
- rspec-expectations (~> 3.7.0)
166
- rspec-mocks (~> 3.7.0)
167
- rspec-support (~> 3.7.0)
168
- rspec-support (3.7.1)
164
+ rspec-core (~> 3.8.0)
165
+ rspec-expectations (~> 3.8.0)
166
+ rspec-mocks (~> 3.8.0)
167
+ rspec-support (~> 3.8.0)
168
+ rspec-support (3.8.0)
169
169
  safe_yaml (1.0.4)
170
170
  simplecov (0.16.1)
171
171
  docile (~> 1.1)
@@ -179,11 +179,11 @@ GEM
179
179
  actionpack (>= 4.0)
180
180
  activesupport (>= 4.0)
181
181
  sprockets (>= 3.0.0)
182
- thor (0.20.0)
182
+ thor (0.20.3)
183
183
  thread_safe (0.3.6)
184
184
  tzinfo (1.2.5)
185
185
  thread_safe (~> 0.1)
186
- webmock (3.4.2)
186
+ webmock (3.5.1)
187
187
  addressable (>= 2.3.6)
188
188
  crack (>= 0.3.2)
189
189
  hashdiff
@@ -30,9 +30,10 @@ module ActiveRecordApi
30
30
  end
31
31
 
32
32
  def allowed_params
33
- @allowed_params ||= model_klass.column_names.map do |column_name|
34
- column_name.to_s.gsub('encrypted_', '')
35
- end.map(&:to_sym)
33
+ @allowed_params ||= model_klass.column_names.flat_map do |column_name|
34
+ col = column_name.to_s.gsub('encrypted_', '').to_sym
35
+ [col, col => []]
36
+ end
36
37
  end
37
38
 
38
39
  def filtered_params
@@ -55,7 +56,9 @@ module ActiveRecordApi
55
56
 
56
57
  def page_models
57
58
  id_field = model_klass.arel_table[:id]
58
- models models.order(:id).where(id_field.gt previous_id)
59
+ updated_models = models.order(:id)
60
+ updated_models = updated_models.where(id_field.gt previous_id) if previous_id.present?
61
+ models updated_models
59
62
  @remaining_count = models.count
60
63
  models models.limit(limit)
61
64
  end
@@ -77,7 +80,7 @@ module ActiveRecordApi
77
80
  end
78
81
 
79
82
  def previous_id
80
- @previous_id ||= params[:previous_id] || 0
83
+ @previous_id ||= params[:previous_id]
81
84
  end
82
85
  end
83
86
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecordApi
4
4
  module Rest
5
- VERSION = '0.1.8'.freeze
5
+ VERSION = '0.1.9'.freeze
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_api-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Full Measure Education
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-10 00:00:00.000000000 Z
11
+ date: 2019-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler