skykick 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +3 -2
- data/lib/skykick/client/alerts.rb +1 -1
- data/lib/skykick/pagination.rb +44 -0
- data/lib/skykick/version.rb +1 -1
- data/lib/skykick.rb +5 -2
- data/skykick.gemspec +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7eb504e67e460c967701af6aeee5480111a27080571dad031543cd2051d4aeb
|
4
|
+
data.tar.gz: 2066d5b75aa42485f0e121b2921dcd826b2103374119f9cd75155a1e9fec2b9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d72996b30a489b055633198d433492e6d4ecc60382b6547b4d922dd42bc52f5d676c09903d575e72f23cd902175ba52756c180c70033abd55427e572972d5eda
|
7
|
+
data.tar.gz: 75339902414d3ad99dbc346769471a1bb06d638f3f0cd0da0a0bc94080803d43573ad2595dba2b1bea1efb6c858616f57dfbd013965d41a41d61f871cb831033
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -56,7 +56,7 @@ client.login
|
|
56
56
|
### Backup
|
57
57
|
Endpoint for backup related requests
|
58
58
|
```
|
59
|
-
|
59
|
+
subscriptions = client.subscriptions
|
60
60
|
```
|
61
61
|
|
62
62
|
|Resource|API endpoint|
|
@@ -78,7 +78,8 @@ licenses = client.tenant_licenses
|
|
78
78
|
### Alerts
|
79
79
|
Returns Alerts for a provided Email Migration Order ID or Backup service ID.
|
80
80
|
```
|
81
|
-
|
81
|
+
subscriptions = client.subscriptions
|
82
|
+
alerts = client.alerts(subscriptions.first.id)
|
82
83
|
|
83
84
|
```
|
84
85
|
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Skykick
|
5
|
+
# Defines HTTP request methods
|
6
|
+
# required attributes format
|
7
|
+
module RequestPagination
|
8
|
+
|
9
|
+
# Skykick uses Odata pagination but unfortunately does not support skipping pages.
|
10
|
+
# Using skip responds with "The query specified in the URI is not valid. Query option
|
11
|
+
# 'Skip' is not allowed. To allow it, set the 'AllowedQueryOptions' property on
|
12
|
+
# EnableQueryAttribute or QueryValidationSettings."
|
13
|
+
class ODataPagination
|
14
|
+
attr_reader :offset, :limit, :total
|
15
|
+
def initialize(page_size)
|
16
|
+
@offset = 0
|
17
|
+
@limit = page_size
|
18
|
+
# we always have a first page
|
19
|
+
@total = @limit
|
20
|
+
end
|
21
|
+
def page_options
|
22
|
+
{ '$top': @limit, '$skip': @offset }
|
23
|
+
{ '$top': @limit }
|
24
|
+
end
|
25
|
+
def next_page!(data)
|
26
|
+
# assume array
|
27
|
+
if data.count
|
28
|
+
@total = data.count
|
29
|
+
else
|
30
|
+
@total = 1
|
31
|
+
end
|
32
|
+
@offset += @limit
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.data(body)
|
36
|
+
body
|
37
|
+
end
|
38
|
+
# only single page available
|
39
|
+
def more_pages?
|
40
|
+
@offset == 0
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/skykick/version.rb
CHANGED
data/lib/skykick.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "wrapi"
|
2
2
|
require File.expand_path('skykick/api', __dir__)
|
3
3
|
require File.expand_path('skykick/client', __dir__)
|
4
|
+
require File.expand_path('skykick/pagination', __dir__)
|
4
5
|
require File.expand_path('skykick/version', __dir__)
|
5
6
|
|
6
7
|
module Skykick
|
@@ -9,14 +10,15 @@ module Skykick
|
|
9
10
|
|
10
11
|
DEFAULT_ENDPOINT = 'https://apis.skykick.com'.freeze
|
11
12
|
DEFAULT_UA = "Skykick Ruby API wrapper #{Skykick::VERSION}".freeze
|
13
|
+
DEFAULT_PAGINATION = Skykick::RequestPagination::ODataPagination
|
12
14
|
|
13
|
-
# Alias for Skykick::Client.new
|
14
15
|
#
|
15
16
|
# @return [Skykick::Client]
|
16
17
|
def self.client(options = {})
|
17
18
|
Skykick::Client.new({
|
18
19
|
endpoint: DEFAULT_ENDPOINT,
|
19
|
-
user_agent: DEFAULT_UA
|
20
|
+
user_agent: DEFAULT_UA,
|
21
|
+
pagination_class: DEFAULT_PAGINATION
|
20
22
|
}.merge(options))
|
21
23
|
end
|
22
24
|
|
@@ -24,5 +26,6 @@ module Skykick
|
|
24
26
|
super
|
25
27
|
self.endpoint = DEFAULT_ENDPOINT
|
26
28
|
self.user_agent = DEFAULT_UA
|
29
|
+
self.pagination_class = DEFAULT_PAGINATION
|
27
30
|
end
|
28
31
|
end
|
data/skykick.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
30
30
|
s.platform = Gem::Platform::RUBY
|
31
31
|
s.add_runtime_dependency 'faraday'
|
32
|
-
s.add_runtime_dependency 'wrapi', "
|
32
|
+
s.add_runtime_dependency 'wrapi', ">= 0.2.0"
|
33
33
|
s.add_development_dependency 'dotenv'
|
34
34
|
s.add_development_dependency 'minitest'
|
35
35
|
s.add_development_dependency 'rubocop'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skykick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janco Tanis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: wrapi
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: dotenv
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- lib/skykick/client/alerts.rb
|
100
100
|
- lib/skykick/client/backup.rb
|
101
101
|
- lib/skykick/connection.rb
|
102
|
+
- lib/skykick/pagination.rb
|
102
103
|
- lib/skykick/version.rb
|
103
104
|
- skykick.gemspec
|
104
105
|
homepage: https://rubygems.org/gems/skykick
|