knockapi 0.4.8 → 0.4.9
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/Gemfile.lock +1 -1
- data/lib/knock/client.rb +3 -2
- data/lib/knock/objects.rb +44 -0
- data/lib/knock/users.rb +37 -0
- data/lib/knock/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fe65a30d36b287d6c125fa1a2dab2cc5203b46ed782c80f4b8c794a131d746d
|
4
|
+
data.tar.gz: 2af32dacf68a984235ae45d9bb2cf7e67c22849cbf2e063d8e56ec56aae1fb22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a6ba784cd2ab7ff11d2d0412522703a19a8f49ffe623589e50262d4eed97f80b423afb5cb9338d57ad8c6959daf12abb3bc58a95451741742f01966576d51f1
|
7
|
+
data.tar.gz: 7e47f4c8bfdf1ca6192f4d35cefe57bbd08746147099b802bd66caefb1e48ffeee5d16f0256fb274907e8636685a25b1049dfb7d4f156c1bcad8c252cad1685f
|
data/Gemfile.lock
CHANGED
data/lib/knock/client.rb
CHANGED
@@ -8,8 +8,9 @@ module Knock
|
|
8
8
|
def client
|
9
9
|
return @client if defined?(@client)
|
10
10
|
|
11
|
-
@client = Net::HTTP.new(Knock::API_HOSTNAME,
|
12
|
-
@client
|
11
|
+
@client = Net::HTTP.new(Knock::API_HOSTNAME, 4001)
|
12
|
+
# @client = Net::HTTP.new(Knock::API_HOSTNAME, 443)
|
13
|
+
# @client.use_ssl = true
|
13
14
|
|
14
15
|
@client
|
15
16
|
end
|
data/lib/knock/objects.rb
CHANGED
@@ -29,6 +29,23 @@ module Knock
|
|
29
29
|
execute_request(request: request)
|
30
30
|
end
|
31
31
|
|
32
|
+
# Retrieves paginated objects in a collection for the provided environment
|
33
|
+
#
|
34
|
+
# @param [Hash] options Options to pass to the paginated users endpoint query.
|
35
|
+
# These include:
|
36
|
+
# - page_size: size of page to be returned (max: 50)
|
37
|
+
# - after: after cursor for pagination
|
38
|
+
# - before: before cursor for pagination
|
39
|
+
def list(collection:, options: {})
|
40
|
+
request = get_request(
|
41
|
+
auth: true,
|
42
|
+
path: "/v1/objects/#{collection}",
|
43
|
+
params: options
|
44
|
+
)
|
45
|
+
|
46
|
+
execute_request(request: request)
|
47
|
+
end
|
48
|
+
|
32
49
|
# Upserts an Object in a collection
|
33
50
|
#
|
34
51
|
# @param [String] collection The collection the object is in
|
@@ -312,6 +329,10 @@ module Knock
|
|
312
329
|
# @param [String] collection The collection the object is in
|
313
330
|
# @param [String] id The object id
|
314
331
|
# @param [Hash] options Options to pass to the subscriptions endpoint
|
332
|
+
# These include:
|
333
|
+
# - page_size: size of page to be returned (max: 50)
|
334
|
+
# - after: after cursor for pagination
|
335
|
+
# - before: before cursor for pagination
|
315
336
|
#
|
316
337
|
# @return [Hash] Paginated subscriptions response
|
317
338
|
def list_subscriptions(collection:, id:, options: {})
|
@@ -375,6 +396,29 @@ module Knock
|
|
375
396
|
|
376
397
|
execute_request(request: request)
|
377
398
|
end
|
399
|
+
|
400
|
+
# Get object's subscriptions as recipient
|
401
|
+
#
|
402
|
+
# @param [String] collection The collection the object is in
|
403
|
+
# @param [String] id The object id
|
404
|
+
# @param [Hash] options Options to pass to the subscriptions endpoint query
|
405
|
+
# These include:
|
406
|
+
# - page_size: size of page to be returned (max: 50)
|
407
|
+
# - after: after cursor for pagination
|
408
|
+
# - before: before cursor for pagination
|
409
|
+
#
|
410
|
+
# @return [Hash] Paginated subscriptions response
|
411
|
+
def get_subscriptions(collection:, id:, options: {})
|
412
|
+
options[:mode] = 'recipient'
|
413
|
+
|
414
|
+
request = get_request(
|
415
|
+
auth: true,
|
416
|
+
path: "/v1/objects/#{collection}/#{id}/subscriptions",
|
417
|
+
params: options
|
418
|
+
)
|
419
|
+
|
420
|
+
execute_request(request: request)
|
421
|
+
end
|
378
422
|
end
|
379
423
|
end
|
380
424
|
# rubocop:enable Metrics/ModuleLength
|
data/lib/knock/users.rb
CHANGED
@@ -45,6 +45,23 @@ module Knock
|
|
45
45
|
execute_request(request: request)
|
46
46
|
end
|
47
47
|
|
48
|
+
# Retrieves paginated users for the provided environment
|
49
|
+
#
|
50
|
+
# @param [Hash] options Options to pass to the paginated users endpoint query.
|
51
|
+
# These include:
|
52
|
+
# - page_size: size of page to be returned (max: 50)
|
53
|
+
# - after: after cursor for pagination
|
54
|
+
# - before: before cursor for pagination
|
55
|
+
def list(options: {})
|
56
|
+
request = get_request(
|
57
|
+
auth: true,
|
58
|
+
path: '/v1/users',
|
59
|
+
params: options
|
60
|
+
)
|
61
|
+
|
62
|
+
execute_request(request: request)
|
63
|
+
end
|
64
|
+
|
48
65
|
# Retrieves the given user
|
49
66
|
#
|
50
67
|
# @param [String] id The user ID
|
@@ -378,6 +395,26 @@ module Knock
|
|
378
395
|
|
379
396
|
execute_request(request: request)
|
380
397
|
end
|
398
|
+
|
399
|
+
##
|
400
|
+
# Subscriptions
|
401
|
+
##
|
402
|
+
|
403
|
+
# Get user's subscriptions
|
404
|
+
#
|
405
|
+
# @param [String] id the user ID
|
406
|
+
# @param [Hash] options Options to pass to the subscriptions endpoint query
|
407
|
+
#
|
408
|
+
# @return [Hash] Paginated subscriptions response
|
409
|
+
def get_subscriptions(id:, options: {})
|
410
|
+
request = get_request(
|
411
|
+
auth: true,
|
412
|
+
path: "/v1/users/#{id}/subscriptions",
|
413
|
+
params: options
|
414
|
+
)
|
415
|
+
|
416
|
+
execute_request(request: request)
|
417
|
+
end
|
381
418
|
end
|
382
419
|
end
|
383
420
|
# rubocop:enable Metrics/ModuleLength
|
data/lib/knock/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knockapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Knock Labs, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|