cloudstack_client 1.5.10 → 1.5.11

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: 7cafadb44577a4fb75b477438b2a6e256c8715c06681dde1a8e6e815f96a47ff
4
- data.tar.gz: 24e9e5324a23c639d3e6c472c25614ecade9ed3af6eb8d450dba10d871b021d9
3
+ metadata.gz: f12a44b9de9caef1d8ca803d2661fbf236b45428b00e9a9e88f222c630aee140
4
+ data.tar.gz: 90e786e18f99f3a6fcb19b94298d617f42d18d8892722e288da76891945bf9b3
5
5
  SHA512:
6
- metadata.gz: 38b9395b2f67ad5842b554444465d1da58b3ef8173b6d4bea880bf7263d763c5114e8afdca7b6e66f21972a8790afabbb3630d8ed85044366427769f72734bc4
7
- data.tar.gz: 774377ebc139f7f79acdf146358b30a69229caf814477855a76677629178e9033685a6d5fb3aff0dd896bbc9123e5f558ba9c30b8805a269a5464c7415326720
6
+ metadata.gz: 92cd5f09d2864d21556c524262ce2187ded3a28c65c1a324bc7a8a236d98e0f44261bb0a334b879955efdc0e1065c58235bf7c6077fd1635d2bad8657ec70308
7
+ data.tar.gz: 11a672cd0b5f2dbd377a0e4684a1a71c090ddb29e4b90b1e938f87c3eac1df638bb22d49570830442af687aa197fa7bfea3fbbf7de453aaa0e008ddd5d1e6345
data/Gemfile.lock CHANGED
@@ -1,17 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cloudstack_client (1.5.10)
4
+ cloudstack_client (1.5.11)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  bond (0.5.1)
10
- minitest (5.25.4)
11
- rake (13.2.1)
10
+ minitest (5.26.1)
11
+ rake (13.3.1)
12
12
  ripl (0.7.1)
13
13
  bond (~> 0.5.1)
14
- thor (1.3.2)
14
+ thor (1.4.0)
15
15
 
16
16
  PLATFORMS
17
17
  x86_64-linux
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2013-2015 Nik Wolfgramm
3
+ Copyright (c) 2013-2025 Nik Wolfgramm
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -68,6 +68,21 @@ cs = CloudstackClient::Client.new(
68
68
  )
69
69
  ```
70
70
 
71
+ ### Pagination and Response Options
72
+
73
+ When working with paginated responses, you can include the total count in the API response:
74
+
75
+ ```ruby
76
+ # Get paginated results with count information
77
+ vms = cs.list_virtual_machines({ page: 1, pagesize: 10 }, { include_count: true })
78
+ total_count = vms[:count]
79
+ items = vms[:virtualmachine]
80
+
81
+ # Default behavior (without count)
82
+ vms = cs.list_virtual_machines(page: 1, pagesize: 10)
83
+ # Returns just the items array
84
+ ```
85
+
71
86
  ### Using the configuration module
72
87
 
73
88
  The configuration module of CloudstackClient makes it easy to load CloudStack API settings from configuration files.
@@ -34,10 +34,11 @@ module CloudstackClient
34
34
  raise ParameterError, @api.missing_params_msg(command["name"])
35
35
  end
36
36
 
37
+
37
38
  if command["isasync"] == false || options[:sync]
38
- send_request(params)
39
+ send_request(params, options)
39
40
  else
40
- send_async_request(params)
41
+ send_async_request(params, options)
41
42
  end
42
43
  end
43
44
  end
@@ -35,7 +35,7 @@ module CloudstackClient
35
35
  # Sends a synchronous request to the CloudStack API and returns the response as a Hash.
36
36
  #
37
37
 
38
- def send_request(params)
38
+ def send_request(params, opts = {})
39
39
  params['response'] = 'json'
40
40
  params['apiKey'] = @api_key
41
41
  print_debug_output JSON.pretty_generate(params) if @debug
@@ -68,12 +68,12 @@ module CloudstackClient
68
68
  if response.is_a?(Net::HTTPOK)
69
69
  return body unless body.respond_to?(:keys)
70
70
  if body.size == 2 && body.key?(k('count'))
71
- return body.reject { |key, _| key == k('count') }.values.first
71
+ return opts[:include_count] ? body : body.reject { |key, _| key == k('count') }.values.first
72
72
  elsif body.size == 1 && body.values.first.respond_to?(:keys)
73
73
  item = body.values.first
74
74
  return (item.is_a?(Array) || item.is_a?(Hash)) ? item : []
75
75
  else
76
- body.reject! { |key, _| key == k('count') } if body.key?(k('count'))
76
+ body.reject! { |key, _| key == k('count') } if body.key?(k('count')) && !opts[:include_count]
77
77
  body.size == 0 ? [] : body
78
78
  end
79
79
  else
@@ -87,8 +87,8 @@ module CloudstackClient
87
87
  #
88
88
  # The contents of the 'jobresult' element are returned upon completion of the command.
89
89
 
90
- def send_async_request(params)
91
- data = send_request(params)
90
+ def send_async_request(params, **opts)
91
+ data = send_request(params, opts)
92
92
 
93
93
  params = {
94
94
  'command' => 'queryAsyncJobResult',
@@ -1,3 +1,3 @@
1
1
  module CloudstackClient
2
- VERSION = "1.5.10"
2
+ VERSION = "1.5.11"
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstack_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.10
4
+ version: 1.5.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nik Wolfgramm
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-01-24 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rake
@@ -106,7 +105,6 @@ homepage: https://github.com/niwo/cloudstack_client
106
105
  licenses:
107
106
  - MIT
108
107
  metadata: {}
109
- post_install_message:
110
108
  rdoc_options:
111
109
  - "--line-numbers"
112
110
  - "--inline-source"
@@ -123,8 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
121
  - !ruby/object:Gem::Version
124
122
  version: '0'
125
123
  requirements: []
126
- rubygems_version: 3.5.22
127
- signing_key:
124
+ rubygems_version: 3.6.9
128
125
  specification_version: 4
129
126
  summary: CloudStack API client written in Ruby
130
127
  test_files: