cloudally 0.2.1 → 0.2.2

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: f2f46745c7981091945d40c86bd68e6004dff4ea39ecaa436225c9d5df00a535
4
- data.tar.gz: 2bf09895b3b8df0b1741f87b41c1f8d2a16c4b5fbb53c0047b9eaa5adcc7e399
3
+ metadata.gz: 1afb93903c08a062ef900cef1ee3fecdc0c12cc8574f910bc30eb3ebe144e38a
4
+ data.tar.gz: e3725fbd2e6054b4c6325cf2968e04440fb3e11561cccc70a081dc05d502ad61
5
5
  SHA512:
6
- metadata.gz: '068f074ab511b4f91073553debfb77f96a81a0e7e82f1c3f02d02618be89c50217acb19fa18f964ee73270e9cb740654b426a159d60d84b846bed9eadceabc2e'
7
- data.tar.gz: 78b7f883e82d2e0bd2e25654d74223c3409ace9bc1f64d6f374b3ca8e5b565bfece1de7bd822e3ec6d0891ec4102939358d56e91c270380288461d120dd0735a
6
+ metadata.gz: 33d730dd7104a7d8e626255e54c3d2fc689193b26633b64b31710cb32a02a979889144adca53e2bf314427bf31f31f8f699c824b861030b660306f9307ced288
7
+ data.tar.gz: 3ddb3a4a625bdd3748f6bca581e23e2c14c4288a021f40508caa602272ca75b190e0ecacc2b776c34e5b1d6c5017dcce0e753772805010434804c9958a370ce8
data/CHANGELOG.md CHANGED
@@ -17,3 +17,7 @@
17
17
 
18
18
  ## [0.2.1] - 2024-01-30
19
19
  - use wrapi gem
20
+
21
+ ## [0.2.2] - 2024-02-08
22
+ - updated wrapi pagination
23
+
data/cloudally.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'
@@ -0,0 +1,37 @@
1
+ require 'uri'
2
+ require 'json'
3
+
4
+ module CloudAlly
5
+ # Defines HTTP request methods
6
+ # required attributes format
7
+ module RequestPagination
8
+
9
+ class Pager
10
+ def initialize(page_size)
11
+ @page = 1
12
+ @page_size = page_size
13
+ @total = @page + 1
14
+ @next_page = ''
15
+ end
16
+ def page_options
17
+ following_page = { pageSize: @page_size }
18
+ unless @next_page.empty?
19
+ following_page.merge!({ page: @page, nextPageToken: @next_page })
20
+ else
21
+ following_page
22
+ end
23
+ end
24
+ def next_page!(data)
25
+ @page += 1
26
+ @total = data['totalPages'].to_i
27
+ @next_page = data['nextPageToken']
28
+ end
29
+ def self.data(body)
30
+ body['data'] ? body['data'] : body
31
+ end
32
+ def more_pages?
33
+ @page < @total
34
+ end
35
+ end
36
+ end
37
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CloudAlly
4
- VERSION = '0.2.1'
4
+ VERSION = '0.2.2'
5
5
  end
data/lib/cloudally.rb CHANGED
@@ -3,6 +3,7 @@ require "wrapi"
3
3
  require File.expand_path('cloudally/api', __dir__)
4
4
  require File.expand_path('cloudally/client', __dir__)
5
5
  require File.expand_path('cloudally/version', __dir__)
6
+ require File.expand_path('cloudally/pagination', __dir__)
6
7
 
7
8
  module CloudAlly
8
9
  extend WrAPI::Configuration
@@ -10,6 +11,7 @@ module CloudAlly
10
11
 
11
12
  DEFAULT_ENDPOINT = 'https://api.cloudally.com/v1/'.freeze
12
13
  DEFAULT_USERAGENT = "CloudAlly Ruby API wrapper #{CloudAlly::VERSION}".freeze
14
+ DEFAULT_PAGINATION = CloudAlly::RequestPagination::Pager
13
15
 
14
16
  # Alias for CloudAlly::Client.new
15
17
  #
@@ -17,7 +19,8 @@ module CloudAlly
17
19
  def self.client(options = {})
18
20
  CloudAlly::Client.new({
19
21
  endpoint: DEFAULT_ENDPOINT,
20
- user_agent: DEFAULT_USERAGENT
22
+ user_agent: DEFAULT_USERAGENT,
23
+ pagination_class: DEFAULT_PAGINATION
21
24
  }.merge(options))
22
25
  end
23
26
 
@@ -25,5 +28,6 @@ module CloudAlly
25
28
  super
26
29
  self.endpoint = DEFAULT_ENDPOINT
27
30
  self.user_agent = DEFAULT_USERAGENT
31
+ self.pagination_class = DEFAULT_PAGINATION
28
32
  end
29
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudally
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
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-05 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
@@ -30,14 +30,14 @@ dependencies:
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
@@ -98,6 +98,7 @@ files:
98
98
  - lib/cloudally/authentication.rb
99
99
  - lib/cloudally/client.rb
100
100
  - lib/cloudally/client/partners.rb
101
+ - lib/cloudally/pagination.rb
101
102
  - lib/cloudally/version.rb
102
103
  homepage: https://rubygems.org/gems/cloudally
103
104
  licenses: