suggestgrid 0.5.0 → 0.6.0.rc2
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 +4 -4
- data/lib/suggestgrid/controllers/action_controller.rb +33 -7
- data/spec/swagger.yaml +29 -7
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ae22a4953d6727fc05aba2fcf64342fa189d8cd
|
4
|
+
data.tar.gz: c1afcaac1d0fe302293619eeda07a16a6a2b28eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a457874f08d75980efce240affb0e5ca966e4bcac183b204f5e82ec17767642c1819d57870b6c17eb21de182a5ddaf7e98ac90e8f8d53add3168540181c8ea0
|
7
|
+
data.tar.gz: a3ad2b56df368fa90beeb8f0c2a17a0f4fcf18b7150d9c5c6d03a11edb1dc6476ddc7d27eae18aaea948f4fbd94c7382e1300c82f146007a5c3c4e22f8d4c609
|
@@ -138,14 +138,17 @@ module SuggestGrid
|
|
138
138
|
end
|
139
139
|
|
140
140
|
# Get actions. Defaut responses will be paged by 10 actios each.
|
141
|
-
# Type, user id, item id, or older than parameters could be
|
141
|
+
# Type, user id, item id, timestamp, or older than parameters could be
|
142
|
+
# provided.
|
142
143
|
# The intersection of the provided parameters will be returned.
|
143
144
|
# @param [String] type Optional parameter: Get actions of a type.
|
144
145
|
# @param [String] user_id Optional parameter: Get actions of a user id.
|
145
146
|
# @param [String] item_id Optional parameter: Get actions of an item id.
|
147
|
+
# @param [Long] timestamp Optional parameter: Get actions of a timestamp. At
|
148
|
+
# most one of timestamp or older than could be provided.
|
146
149
|
# @param [String] older_than Optional parameter: Get actions older than the
|
147
150
|
# given duration, or the given time number. Could be a ISO 8601 duration, or
|
148
|
-
# a Unix
|
151
|
+
# a Unix timestamp. Specifications are available at
|
149
152
|
# https://en.wikipedia.org/wiki/ISO_8601#Durations, or
|
150
153
|
# https://en.wikipedia.org/wiki/Unix_time.
|
151
154
|
# @param [Long] size Optional parameter: The number of the users response.
|
@@ -158,6 +161,7 @@ module SuggestGrid
|
|
158
161
|
def get_actions(type = nil,
|
159
162
|
user_id = nil,
|
160
163
|
item_id = nil,
|
164
|
+
timestamp = nil,
|
161
165
|
older_than = nil,
|
162
166
|
size = nil,
|
163
167
|
from = nil)
|
@@ -170,6 +174,7 @@ module SuggestGrid
|
|
170
174
|
'type' => type,
|
171
175
|
'user_id' => user_id,
|
172
176
|
'item_id' => item_id,
|
177
|
+
'timestamp' => timestamp,
|
173
178
|
'older_than' => older_than,
|
174
179
|
'size' => size,
|
175
180
|
'from' => from
|
@@ -192,6 +197,19 @@ module SuggestGrid
|
|
192
197
|
_context = execute_request(_request)
|
193
198
|
|
194
199
|
# Validate response against endpoint and global error codes.
|
200
|
+
if _context.response.status_code == 400
|
201
|
+
raise ErrorResponse.new(
|
202
|
+
'Query error.',
|
203
|
+
_context
|
204
|
+
)
|
205
|
+
elsif _context.response.status_code == 422
|
206
|
+
raise ErrorResponse.new(
|
207
|
+
'No query parameter (user id, item id, timestamp, or older than)' \
|
208
|
+
' is given. In order to delete all actions, delete the' \
|
209
|
+
' type.',
|
210
|
+
_context
|
211
|
+
)
|
212
|
+
end
|
195
213
|
unless _context.response.status_code.between?(200, 208)
|
196
214
|
raise ErrorResponse.new(
|
197
215
|
'Unexpected internal error.',
|
@@ -210,26 +228,32 @@ module SuggestGrid
|
|
210
228
|
# * Type must be provided.
|
211
229
|
# * If user id is provided, all actions of the user will be deleted.
|
212
230
|
# * If item id is provided, all actions on the item will be deleted.
|
231
|
+
# * If timestamp is provided, all actions with that timestamp will be
|
232
|
+
# deleted.
|
213
233
|
# * If older than is provided, all actions older than the timestamp or the
|
214
234
|
# duration will be deleted.
|
215
235
|
# * If a number of these parameters are provided, the intersection of these
|
216
236
|
# parameters will be deleted.
|
217
237
|
# * In addition to a type, at least one of these parameters must be
|
218
|
-
# provided.
|
238
|
+
# provided.
|
239
|
+
# * In order to delete all the actions of a type, delete the type.
|
219
240
|
# @param [String] type Required parameter: Delete actions of a type. This
|
220
241
|
# parameter and at least one other parameter is required.
|
221
242
|
# @param [String] user_id Optional parameter: Delete actions of a user id.
|
222
243
|
# @param [String] item_id Optional parameter: Delete actions of an item
|
223
244
|
# id.
|
245
|
+
# @param [Long] timestamp Optional parameter: Get actions of a timestamp. At
|
246
|
+
# most one of timestamp or older than could be provided.
|
224
247
|
# @param [String] older_than Optional parameter: Delete actions older than
|
225
248
|
# the given duration, or the given time number. Could be a ISO 8601
|
226
|
-
# duration, or a Unix
|
249
|
+
# duration, or a Unix timestamp. Specifications are available at
|
227
250
|
# https://en.wikipedia.org/wiki/ISO_8601#Durations, or
|
228
251
|
# https://en.wikipedia.org/wiki/Unix_time.
|
229
252
|
# @return MessageResponse response from the API call
|
230
253
|
def delete_actions(type,
|
231
254
|
user_id = nil,
|
232
255
|
item_id = nil,
|
256
|
+
timestamp = nil,
|
233
257
|
older_than = nil)
|
234
258
|
# Prepare query url.
|
235
259
|
_query_builder = Configuration.base_uri.dup
|
@@ -240,6 +264,7 @@ module SuggestGrid
|
|
240
264
|
'type' => type,
|
241
265
|
'user_id' => user_id,
|
242
266
|
'item_id' => item_id,
|
267
|
+
'timestamp' => timestamp,
|
243
268
|
'older_than' => older_than
|
244
269
|
},
|
245
270
|
array_serialization: Configuration.array_serialization
|
@@ -262,13 +287,14 @@ module SuggestGrid
|
|
262
287
|
# Validate response against endpoint and global error codes.
|
263
288
|
if _context.response.status_code == 400
|
264
289
|
raise ErrorResponse.new(
|
265
|
-
'
|
290
|
+
'Query error.',
|
266
291
|
_context
|
267
292
|
)
|
268
293
|
elsif _context.response.status_code == 422
|
269
294
|
raise ErrorResponse.new(
|
270
|
-
'No query parameter (user id, item id, or older than)
|
271
|
-
'
|
295
|
+
'No query parameter (user id, item id, timestamp, or older than)' \
|
296
|
+
' is given. In order to delete all actions, delete the' \
|
297
|
+
' type.',
|
272
298
|
_context
|
273
299
|
)
|
274
300
|
end
|
data/spec/swagger.yaml
CHANGED
@@ -2,7 +2,7 @@ swagger: '2.0'
|
|
2
2
|
|
3
3
|
info:
|
4
4
|
title: SuggestGrid
|
5
|
-
version: 0.
|
5
|
+
version: 0.6.0-rc.2
|
6
6
|
description: Personalization made Simple
|
7
7
|
x-codegen-settings:
|
8
8
|
appendContentHeaders: true
|
@@ -652,7 +652,7 @@ paths:
|
|
652
652
|
summary: Gets Actions
|
653
653
|
description: |
|
654
654
|
Get actions. Defaut responses will be paged by 10 actios each.
|
655
|
-
Type, user id, item id, or older than parameters could be provided.
|
655
|
+
Type, user id, item id, timestamp, or older than parameters could be provided.
|
656
656
|
The intersection of the provided parameters will be returned.
|
657
657
|
parameters:
|
658
658
|
- name: type
|
@@ -673,11 +673,17 @@ paths:
|
|
673
673
|
required: false
|
674
674
|
type: string
|
675
675
|
format: id
|
676
|
+
- name: timestamp
|
677
|
+
in: query
|
678
|
+
description: Get actions of a timestamp. At most one of timestamp or older than could be provided.
|
679
|
+
required: false
|
680
|
+
type: integer
|
681
|
+
format: int64
|
676
682
|
- name: older_than
|
677
683
|
in: query
|
678
684
|
description: |
|
679
685
|
Get actions older than the given duration, or the given time number.
|
680
|
-
Could be a ISO 8601 duration, or a Unix
|
686
|
+
Could be a ISO 8601 duration, or a Unix timestamp.
|
681
687
|
Specifications are available at https://en.wikipedia.org/wiki/ISO_8601#Durations, or https://en.wikipedia.org/wiki/Unix_time.
|
682
688
|
required: false
|
683
689
|
type: string
|
@@ -704,6 +710,14 @@ paths:
|
|
704
710
|
description: Paged actions response.
|
705
711
|
schema:
|
706
712
|
$ref: '#/definitions/ActionsResponse'
|
713
|
+
400:
|
714
|
+
description: Query error.
|
715
|
+
schema:
|
716
|
+
$ref: '#/definitions/ErrorResponse'
|
717
|
+
422:
|
718
|
+
description: No query parameter (user id, item id, timestamp, or older than) is given. In order to delete all actions, delete the type.
|
719
|
+
schema:
|
720
|
+
$ref: '#/definitions/ErrorResponse'
|
707
721
|
default:
|
708
722
|
description: Unexpected internal error.
|
709
723
|
schema:
|
@@ -719,9 +733,11 @@ paths:
|
|
719
733
|
* Type must be provided.
|
720
734
|
* If user id is provided, all actions of the user will be deleted.
|
721
735
|
* If item id is provided, all actions on the item will be deleted.
|
736
|
+
* If timestamp is provided, all actions with that timestamp will be deleted.
|
722
737
|
* If older than is provided, all actions older than the timestamp or the duration will be deleted.
|
723
738
|
* If a number of these parameters are provided, the intersection of these parameters will be deleted.
|
724
|
-
* In addition to a type, at least one of these parameters must be provided.
|
739
|
+
* In addition to a type, at least one of these parameters must be provided.
|
740
|
+
* In order to delete all the actions of a type, delete the type.
|
725
741
|
parameters:
|
726
742
|
- name: type
|
727
743
|
in: query
|
@@ -741,11 +757,17 @@ paths:
|
|
741
757
|
required: false
|
742
758
|
type: string
|
743
759
|
format: id
|
760
|
+
- name: timestamp
|
761
|
+
in: query
|
762
|
+
description: Get actions of a timestamp. At most one of timestamp or older than could be provided.
|
763
|
+
required: false
|
764
|
+
type: integer
|
765
|
+
format: int64
|
744
766
|
- name: older_than
|
745
767
|
in: query
|
746
768
|
description: |
|
747
769
|
Delete actions older than the given duration, or the given time number.
|
748
|
-
Could be a ISO 8601 duration, or a Unix
|
770
|
+
Could be a ISO 8601 duration, or a Unix timestamp.
|
749
771
|
Specifications are available at https://en.wikipedia.org/wiki/ISO_8601#Durations, or https://en.wikipedia.org/wiki/Unix_time.
|
750
772
|
required: false
|
751
773
|
type: string
|
@@ -755,11 +777,11 @@ paths:
|
|
755
777
|
schema:
|
756
778
|
$ref: '#/definitions/MessageResponse'
|
757
779
|
400:
|
758
|
-
description:
|
780
|
+
description: Query error.
|
759
781
|
schema:
|
760
782
|
$ref: '#/definitions/ErrorResponse'
|
761
783
|
422:
|
762
|
-
description: No query parameter (user id, item id, or older than) is given.
|
784
|
+
description: No query parameter (user id, item id, timestamp, or older than) is given. In order to delete all actions, delete the type.
|
763
785
|
schema:
|
764
786
|
$ref: '#/definitions/ErrorResponse'
|
765
787
|
default:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: suggestgrid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SuggestGrid
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logging
|
@@ -154,9 +154,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
154
154
|
version: '2.0'
|
155
155
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- - "
|
157
|
+
- - ">"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
159
|
+
version: 1.3.1
|
160
160
|
requirements: []
|
161
161
|
rubyforge_project:
|
162
162
|
rubygems_version: 2.6.14
|