skykick 0.1.0 → 0.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: eafaae81c547995fd55e21844d23699293636cd2fac1d055c921c16308f340ff
4
- data.tar.gz: e67e661fd6da88eab1204aa4680ad82be1cb67cd43e5d56512bd21419be3bba2
3
+ metadata.gz: c7eb504e67e460c967701af6aeee5480111a27080571dad031543cd2051d4aeb
4
+ data.tar.gz: 2066d5b75aa42485f0e121b2921dcd826b2103374119f9cd75155a1e9fec2b9d
5
5
  SHA512:
6
- metadata.gz: e6066c80ada508164d556034e15c5db6a060393d1363deb112583c34ef19572b0a5c8e6bd1727dd293d406f26f3ba0f8c9498be8f5264d2f77000c30b2adfee1
7
- data.tar.gz: 85e2993883ad13a33e8d5e90162a61b12e64b346d47f2ea59bb86765cbf61e0ab16e467dc9ea5d3379a384768d8a733993ebfa0ffbd7cc9c3128d363555f2212
6
+ metadata.gz: d72996b30a489b055633198d433492e6d4ecc60382b6547b4d922dd42bc52f5d676c09903d575e72f23cd902175ba52756c180c70033abd55427e572972d5eda
7
+ data.tar.gz: 75339902414d3ad99dbc346769471a1bb06d638f3f0cd0da0a0bc94080803d43573ad2595dba2b1bea1efb6c858616f57dfbd013965d41a41d61f871cb831033
data/CHANGELOG.md CHANGED
@@ -2,3 +2,6 @@
2
2
 
3
3
  ## [0.1.0] - 2024-02-05
4
4
  - Initial release
5
+
6
+ ## [0.1.1] - 2024-02-08
7
+ - Update OData support
data/README.md CHANGED
@@ -56,7 +56,7 @@ client.login
56
56
  ### Backup
57
57
  Endpoint for backup related requests
58
58
  ```
59
- licenses = client.tenant_licenses
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
- alerts = client.alerts(subscription_id)
81
+ subscriptions = client.subscriptions
82
+ alerts = client.alerts(subscriptions.first.id)
82
83
 
83
84
  ```
84
85
 
@@ -10,7 +10,7 @@ module Skykick
10
10
  # This endpoint supports the following OData query parameters: $top
11
11
  # $top - default of 25 and max of 500
12
12
  # this is not implemented
13
- get("Alerts/#{id}?$top=500")
13
+ get_paged("Alerts/#{id}")
14
14
  end
15
15
 
16
16
  # Mark an Alert as complete.
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Skykick
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
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', "~> 0.1.3"
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.0
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-06 00:00:00.000000000 Z
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.1.3
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.1.3
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