ansible_tower_client 0.13.0 → 0.14.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
  SHA256:
3
- metadata.gz: acc46f0e0cce6788bc9f2e361ded7857c9a8bb0649cfed2f0e4b1cde2fb14ffc
4
- data.tar.gz: ee33fd26e8c1ed23db73c3a0dc21ac1044a0c78c02b5a6e6b229a83070b0cedd
3
+ metadata.gz: 9705050a1615b4e5d5f20b66ae5b13be70ee899bae43dd55a5940a526b1cad18
4
+ data.tar.gz: d69d45876bc30ddf8805ecdc7b5a6f5520b13fdb6d418be444c2e2803856d8ba
5
5
  SHA512:
6
- metadata.gz: b84b2391df974c1f69f911fb0873eafcb12cccccccbb997d1ec54c96cc2717ea139f7348c84280852d248e26c3009597aa690b0796410d37270df52f1207a253
7
- data.tar.gz: 5a8a81e4e8992d4b64071219810b28ba4cf9547d3f73ba10de716473313e883ca9ee87a3f68d6a7ef9f4cd4eb1c014e2deca7ac84d215b8ca903a63281a93aae
6
+ metadata.gz: 635c25af7825cfe34fd92e8aac4a186c65fbc8ea870d79370dc55140904b43c9295a11ccb71f0b9baa9446b37226adcce4645f3fb07c6d9c157b8a4879be018b
7
+ data.tar.gz: 232730a09f72a97e6f9234a85abcef3b078e56b0e181c4a9d5a308f93a16bea45a048c8f08885cf31400823b57afd7f53ebc014ec439bcd07d63c7f10334d70a
data/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.14.0] - 2018-04-26
9
+ ### Added
10
+ - Add Project#last_update [(#102)](https://github.com/ansible/ansible_tower_client_ruby/pull/102)
11
+
12
+ ### Fixed
13
+ - Fix debug logging of non-JSON responses [(#102)](https://github.com/ansible/ansible_tower_client_ruby/pull/102)
14
+
8
15
  ## [0.13.0] - 2018-04-05
9
16
  ### Added
10
17
  - Add SystemJobTemplate and Schedules [(#99)](https://github.com/ansible/ansible_tower_client_ruby/pull/99)
@@ -67,7 +74,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
67
74
  ### Fixed
68
75
  - Adjusted project_spec to test on a Project [(#63)](https://github.com/ansible/ansible_tower_client_ruby/pull/63)
69
76
 
70
- [Unreleased]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.13.0...master
77
+ [Unreleased]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.14.0...master
78
+ [0.14.0]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.13.0...v0.14.0
71
79
  [0.13.0]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.12.2...v0.13.0
72
80
  [0.12.2]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.12.1...v0.12.2
73
81
  [0.12.1]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.12.0...v0.12.1
@@ -96,12 +96,13 @@ module AnsibleTowerClient
96
96
  end
97
97
 
98
98
  def method_missing(method_name, *args, &block)
99
+ require 'faraday'
99
100
  if instance.respond_to?(method_name)
100
101
  path = build_path_to_resource(args.shift)
101
102
  args.unshift(path)
102
103
  logger.debug { "#{self.class.name} Sending <#{method_name}> with <#{args.inspect}>" }
103
104
  instance.send(method_name, *args, &block).tap do |response|
104
- logger.debug { "#{self.class.name} Response:\n#{JSON.parse(response.body).pretty_inspect}" }
105
+ logger.debug { "#{self.class.name} Response:\n#{log_from_response(response)}" }
105
106
  end
106
107
  else
107
108
  super
@@ -17,5 +17,10 @@ module AnsibleTowerClient
17
17
 
18
18
  api.project_updates.find(update['project_update'])
19
19
  end
20
+
21
+ def last_update
22
+ return if related['last_update'].blank?
23
+ api.project_updates.find(related['last_update'])
24
+ end
20
25
  end
21
26
  end
@@ -3,5 +3,11 @@ module AnsibleTowerClient
3
3
  module Logging
4
4
  extend Forwardable
5
5
  delegate :logger => :AnsibleTowerClient
6
+
7
+ def log_from_response(response)
8
+ JSON.parse(response.body).pretty_inspect
9
+ rescue JSON::ParserError
10
+ response.body
11
+ end
6
12
  end
7
13
  end
@@ -7,9 +7,7 @@ module AnsibleTowerClient
7
7
  def on_complete(env)
8
8
  return unless CLIENT_ERROR_STATUSES.include?(env[:status])
9
9
  logger.debug { "#{self.class.name} Raw Response:\n#{env.pretty_inspect}" }
10
- message = JSON.parse(env.body).pretty_inspect rescue nil
11
- message ||= env.body
12
- logger.error("#{self.class.name} Response Body:\n#{message}")
10
+ logger.error("#{self.class.name} Response Body:\n#{log_from_response(env)}")
13
11
 
14
12
  case env[:status]
15
13
  when 402
@@ -1,3 +1,3 @@
1
1
  module AnsibleTowerClient
2
- VERSION = "0.13.0".freeze
2
+ VERSION = "0.14.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ansible_tower_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Dunne
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-04-05 00:00:00.000000000 Z
12
+ date: 2018-04-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport