cloudstack_client 1.5.9 → 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: 2a0a4ca31c3cfcee330c0f72ca9d0fa9895788cfb5718e3499181abdc7564df1
4
- data.tar.gz: 688112d58736d2ada94c993f271eda18a923308fc94bcd93bad2775d193506b1
3
+ metadata.gz: f12a44b9de9caef1d8ca803d2661fbf236b45428b00e9a9e88f222c630aee140
4
+ data.tar.gz: 90e786e18f99f3a6fcb19b94298d617f42d18d8892722e288da76891945bf9b3
5
5
  SHA512:
6
- metadata.gz: 5d2e11bbf05fa22573de42450b49015bbeabfdf29dfe2ba49701c815bc3e6f0d6f1b35fadc72dca3f3ca8ff803fbe08b37e9320b961050d1e526e1803e45b307
7
- data.tar.gz: bd6003fb8f3f82c4a07f548608d927eed95d17a051a0134c2bee061eea6562d9df94caca8c5549a01e0eeccb55ee6f0ec7076140c8d9744c4a2794e8addb3c1a
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.9)
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.24.1)
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.1)
14
+ thor (1.4.0)
15
15
 
16
16
  PLATFORMS
17
17
  x86_64-linux
@@ -24,4 +24,4 @@ DEPENDENCIES
24
24
  thor (~> 1.1)
25
25
 
26
26
  BUNDLED WITH
27
- 2.3.14
27
+ 2.5.22
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.
@@ -155,6 +170,4 @@ $ gzip data/4.15.json
155
170
 
156
171
  ## License
157
172
 
158
- Copyright (c) 2014-2021, Nik Wolfgramm
159
-
160
173
  Released under the MIT License. See the [LICENSE](https://raw.github.com/niwo/cloudstack_client/master/LICENSE.txt) file for further details.
@@ -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
@@ -5,7 +5,7 @@ module CloudstackClient
5
5
 
6
6
  def self.load(configuration)
7
7
  file = configuration[:config_file] || Configuration.locate_config_file
8
- unless File.exists?(file)
8
+ unless File.exist?(file)
9
9
  raise ConfigurationError, "Configuration file '#{file}' not found."
10
10
  end
11
11
 
@@ -37,7 +37,7 @@ module CloudstackClient
37
37
  def self.locate_config_file
38
38
  %w(.cloudstack .cloudstack-cli).each do |file|
39
39
  file = File.join(Dir.home, "#{file}.yml")
40
- return file if File.exists?(file)
40
+ return file if File.exist?(file)
41
41
  end
42
42
  nil
43
43
  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',
@@ -155,7 +155,10 @@ module CloudstackClient
155
155
  end
156
156
 
157
157
  def escape(input)
158
- CGI.escape(input.to_s).gsub('+', '%20').gsub(' ', '%20')
158
+ CGI.escape(input.to_s)
159
+ .gsub('+', '%20')
160
+ .gsub(' ', '%20')
161
+ .gsub('%2A', '*')
159
162
  end
160
163
 
161
164
  def symbolized_key(name)
@@ -1,3 +1,3 @@
1
1
  module CloudstackClient
2
- VERSION = "1.5.9"
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.9
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: 2024-07-06 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.3.7
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: