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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3a81c9088b00cdd045a20cfe360c9f2d4598e13
4
- data.tar.gz: e0d9da3b3fccc42413d9acb5bb837f8daca356de
3
+ metadata.gz: 3537abcdd5d9a79fa4e54c352dc010a541c4ce87
4
+ data.tar.gz: f2756d0fe7d77fa904f6862d0299c96dea29bd0e
5
5
  SHA512:
6
- metadata.gz: d4cc5fbbb32de429d43890c91f1784cd5605fc84554581cfa0026a788305ed5c01cddeaecb0e84a3def08e9ce1c9fc2de323e77897f133e11e18f020810f158f
7
- data.tar.gz: 4dfcce61faa98895d736d5abcd9873090e3bab119ec4e3ad31774c9c71e2c68c6a3463bb9ccdd5aa18186815c33c2e0d3414243cdd6894d2e70bf667f7d17aad
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
@@ -4,6 +4,7 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  group :test do
7
+ gem "webmock"
7
8
  gem "simplecov", :require => false
8
9
  gem "codeclimate-test-reporter", "~> 1.0.0", :require => false
9
10
  end
data/README.md CHANGED
@@ -35,9 +35,9 @@ miq = ManageIQ::API::Client.new(
35
35
  :password => "password"
36
36
  )
37
37
 
38
- miq.vms.search(:filter => "id=320").first.start
38
+ miq.vms.where(:id => 320).first.start
39
39
 
40
- miq.vms.search(:filter => "name='test_*'").each do |vm|
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 :settings
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
- @settings = Hash(entrypoint["settings"]).dup
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
- error_hash = json_response["error"]
22
- if status >= 400 && error_hash.present?
23
- @kind, @message, @klass = error_hash.values_at("kind", "message", "klass")
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
@@ -1,7 +1,7 @@
1
1
  module ManageIQ
2
2
  module API
3
3
  class Client
4
- VERSION = "0.1.0".freeze
4
+ VERSION = "0.2.0".freeze
5
5
  end
6
6
  end
7
7
  end
@@ -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.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.1.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: 2016-11-14 00:00:00.000000000 Z
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.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.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.1
202
+ rubygems_version: 2.5.2
202
203
  signing_key:
203
204
  specification_version: 4
204
205
  summary: ManageIQ API Client