manageiq-api-client 0.1.0 → 0.2.0
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 +4 -4
- data/CHANGELOG.md +27 -0
- data/Gemfile +1 -0
- data/README.md +2 -2
- data/lib/manageiq/api/client/client.rb +2 -2
- data/lib/manageiq/api/client/connection.rb +2 -0
- data/lib/manageiq/api/client/error.rb +7 -3
- data/lib/manageiq/api/client/version.rb +1 -1
- data/manageiq-api-client.gemspec +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3537abcdd5d9a79fa4e54c352dc010a541c4ce87
|
|
4
|
+
data.tar.gz: f2756d0fe7d77fa904f6862d0299c96dea29bd0e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0fc3127e3de0055f0c7b34a729877cf80c74a752939485d9ab0b344cb6c2de22754a0171de7b8db47bdb67ea8e3c3a0841aefe2228c512b1afe5cf673bea305e
|
|
7
|
+
data.tar.gz: a5b0d7472fc865e6fe80569a3358ac419302b455ad1278949459a1b301c26069305fd96babebc87c62fa424eac9f87580c8f237b8ba2336067ab67d3bb8849fc
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
|
|
4
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
5
|
+
and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.2.0] - 2017-02-24
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- **BREAKING** Client's `settings` is renamed to `user_settings` to avoid collision with API's `settings` collection [[#57](https://github.com/ManageIQ/manageiq-api-client/pull/57)]
|
|
13
|
+
- Loosen ActiveSupport dependency [[#64](https://github.com/ManageIQ/manageiq-api-client/pull/64)]
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- Fix Client::Error to support Rails errors (routing, etc) [[#58](https://github.com/ManageIQ/manageiq-api-client/pull/58)]
|
|
17
|
+
- When fetching the entrypoint a / is appended to the URL [[#59](https://github.com/ManageIQ/manageiq-api-client/pull/59)]
|
|
18
|
+
|
|
19
|
+
## [0.1.1]
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
- Add CHANGELOG.md
|
|
23
|
+
- Update README with simple instructions reflecting the query interface.
|
|
24
|
+
|
|
25
|
+
[Unreleased]: https://github.com/ManageIQ/manageiq-api-client/compare/v0.1.1...HEAD
|
|
26
|
+
[0.1.1]: https://github.com/ManageIQ/manageiq-api-client/compare/v0.1.0...v0.1.1
|
|
27
|
+
[0.2.0]: https://github.com/ManageIQ/manageiq-api-client/compare/v0.1.1...v0.2.0
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -35,9 +35,9 @@ miq = ManageIQ::API::Client.new(
|
|
|
35
35
|
:password => "password"
|
|
36
36
|
)
|
|
37
37
|
|
|
38
|
-
miq.vms.
|
|
38
|
+
miq.vms.where(:id => 320).first.start
|
|
39
39
|
|
|
40
|
-
miq.vms.
|
|
40
|
+
miq.vms.limit(5).each do |vm|
|
|
41
41
|
vm.suspend if vm.hardware.memory_mb >= 8192
|
|
42
42
|
end
|
|
43
43
|
```
|
|
@@ -8,7 +8,7 @@ module ManageIQ
|
|
|
8
8
|
attr_reader :connection
|
|
9
9
|
|
|
10
10
|
attr_reader :api
|
|
11
|
-
attr_reader :
|
|
11
|
+
attr_reader :user_settings
|
|
12
12
|
attr_reader :identity
|
|
13
13
|
attr_reader :authorization
|
|
14
14
|
attr_reader :server_info
|
|
@@ -36,7 +36,7 @@ module ManageIQ
|
|
|
36
36
|
def load_definitions
|
|
37
37
|
entrypoint = connection.get("", :attributes => "authorization")
|
|
38
38
|
@api = ManageIQ::API::Client::API.new(entrypoint)
|
|
39
|
-
@
|
|
39
|
+
@user_settings = Hash(entrypoint["settings"]).dup
|
|
40
40
|
@identity = ManageIQ::API::Client::Identity.new(Hash(entrypoint["identity"]))
|
|
41
41
|
@authorization = Hash(entrypoint["authorization"]).dup
|
|
42
42
|
@server_info = ServerInfo.new(Hash(entrypoint["server_info"]))
|
|
@@ -60,6 +60,8 @@ module ManageIQ
|
|
|
60
60
|
def api_path(path)
|
|
61
61
|
if path.to_s.starts_with?(url.to_s)
|
|
62
62
|
path.to_s
|
|
63
|
+
elsif path.to_s.blank?
|
|
64
|
+
URI.join(url, API_PREFIX).to_s
|
|
63
65
|
else
|
|
64
66
|
URI.join(url, path.to_s.starts_with?(API_PREFIX) ? path.to_s : "#{API_PREFIX}/#{path}").to_s
|
|
65
67
|
end
|
|
@@ -18,9 +18,13 @@ module ManageIQ
|
|
|
18
18
|
def update(status, json_response = {})
|
|
19
19
|
@status = status
|
|
20
20
|
@kind, @message, @klass = nil
|
|
21
|
-
|
|
22
|
-
if status >= 400 &&
|
|
23
|
-
|
|
21
|
+
error = json_response["error"]
|
|
22
|
+
if status >= 400 && error.present?
|
|
23
|
+
if error.kind_of?(Hash)
|
|
24
|
+
@kind, @message, @klass = error.values_at("kind", "message", "klass")
|
|
25
|
+
else
|
|
26
|
+
@message = error
|
|
27
|
+
end
|
|
24
28
|
end
|
|
25
29
|
end
|
|
26
30
|
end
|
data/manageiq-api-client.gemspec
CHANGED
|
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
|
27
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
|
28
28
|
spec.add_development_dependency "rspec", "~> 3.0"
|
|
29
29
|
|
|
30
|
-
spec.add_dependency "activesupport", "~> 5.0
|
|
30
|
+
spec.add_dependency "activesupport", "~> 5.0"
|
|
31
31
|
spec.add_dependency "faraday", "~> 0.9.2"
|
|
32
32
|
spec.add_dependency "faraday_middleware", "~> 0.10.0"
|
|
33
33
|
spec.add_dependency "json", "~> 2.0.1"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: manageiq-api-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alberto Bellotti
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2017-02-24 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|
|
@@ -59,14 +59,14 @@ dependencies:
|
|
|
59
59
|
requirements:
|
|
60
60
|
- - "~>"
|
|
61
61
|
- !ruby/object:Gem::Version
|
|
62
|
-
version: 5.0
|
|
62
|
+
version: '5.0'
|
|
63
63
|
type: :runtime
|
|
64
64
|
prerelease: false
|
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
|
66
66
|
requirements:
|
|
67
67
|
- - "~>"
|
|
68
68
|
- !ruby/object:Gem::Version
|
|
69
|
-
version: 5.0
|
|
69
|
+
version: '5.0'
|
|
70
70
|
- !ruby/object:Gem::Dependency
|
|
71
71
|
name: faraday
|
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -150,6 +150,7 @@ files:
|
|
|
150
150
|
- ".gitignore"
|
|
151
151
|
- ".rspec"
|
|
152
152
|
- ".travis.yml"
|
|
153
|
+
- CHANGELOG.md
|
|
153
154
|
- Gemfile
|
|
154
155
|
- LICENSE.txt
|
|
155
156
|
- README.md
|
|
@@ -198,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
198
199
|
version: '0'
|
|
199
200
|
requirements: []
|
|
200
201
|
rubyforge_project:
|
|
201
|
-
rubygems_version: 2.5.
|
|
202
|
+
rubygems_version: 2.5.2
|
|
202
203
|
signing_key:
|
|
203
204
|
specification_version: 4
|
|
204
205
|
summary: ManageIQ API Client
|