runcible 1.12.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8df7ccd9f3b8a9e1d484476d6d890d4e8497c7ae
4
- data.tar.gz: c70c80e4f15a8d196c7c6cc3a418e760e0304650
3
+ metadata.gz: 44d9bd96294cd3ccccf96e313e19c8c19274593e
4
+ data.tar.gz: 572787511b74aaeffd569d6f9f56d3af33a1cc5d
5
5
  SHA512:
6
- metadata.gz: a450cbac839e4806f6b912504a19b5120f0f927701600f6d8571c315ad4cb78115bb1e335a62beaf9d7827a7adac79695eeb3e4a611b9a1e6c161b9d47a5ae96
7
- data.tar.gz: b77ab50466149dc00abaeef7c12acc391239ea9e1205af7d32fb268885ed614ec392a310038d76afcf80401e7c301db334ce9ef7757824df611a2c036dcddd82
6
+ metadata.gz: 6541e2fd3e0971306d45b5e2ece1a6cb31076effc60e48fda2616d58531fb6069cf87a0025c6693facdbee167c6e238cf7bc5f64c3df663d1a040fcb8a1399d7
7
+ data.tar.gz: fc21049edee2622efc80b522e3b635b9ca099f5439421d81c4cd554adcff1ac0f956041819effc74d92d1ca57f77c16a30d78959d74c503f28a169d80e895369
data/lib/runcible.rb CHANGED
@@ -5,6 +5,7 @@ resources = Dir[File.dirname(__FILE__) + '/runcible/version.rb']
5
5
  resources += Dir[File.dirname(__FILE__) + '/runcible/base.rb']
6
6
  resources += Dir[File.dirname(__FILE__) + '/runcible/instance.rb']
7
7
  resources += Dir[File.dirname(__FILE__) + '/runcible/resources/*.rb']
8
+ resources += Dir[File.dirname(__FILE__) + '/runcible/response.rb']
8
9
 
9
10
  resources += Dir[File.dirname(__FILE__) + '/runcible/extensions/unit.rb']
10
11
  resources += Dir[File.dirname(__FILE__) + '/runcible/extensions/*.rb']
data/lib/runcible/base.rb CHANGED
@@ -75,8 +75,8 @@ module Runcible
75
75
  end
76
76
 
77
77
  def get_response(client, path, *args)
78
- client[path].send(*args) do |response, request, result, &_block|
79
- resp = response.return!(request, result)
78
+ client[path].send(*args) do |response, _request, _result, &_block|
79
+ resp = response.return!
80
80
  log_debug
81
81
  return resp
82
82
  end
@@ -132,7 +132,7 @@ module Runcible
132
132
  i.respond_to?(:with_indifferent_access) ? i.with_indifferent_access : i
133
133
  end
134
134
  end
135
- response = rest_client_response(body, response.net_http_res, response.args)
135
+ response = Runcible::Response.new(body, response)
136
136
  rescue JSON::ParserError
137
137
  log_exception
138
138
  end
@@ -140,14 +140,6 @@ module Runcible
140
140
  return response
141
141
  end
142
142
 
143
- def rest_client_response(body, net_http_res, args)
144
- if Gem.loaded_specs['rest-client'].version < Gem::Version.create('1.8.0')
145
- RestClient::Response.create(body, net_http_res, args)
146
- else
147
- RestClient::Response.create(body, net_http_res, args, nil)
148
- end
149
- end
150
-
151
143
  def required_params(local_names, binding, keys_to_remove = [])
152
144
  local_names = local_names.each_with_object({}) do |v, acc|
153
145
  value = binding.eval(v.to_s) unless v == :_
@@ -32,13 +32,6 @@ module Runcible
32
32
  end
33
33
  sum == summary_report["total"]
34
34
  end
35
-
36
- # cancel a task group
37
- # @param [String] id the id of the task
38
- # @return [RestClient::Response]
39
- def cancel(id)
40
- call(:delete, path(id))
41
- end
42
35
  end
43
36
  end
44
37
  end
@@ -0,0 +1,36 @@
1
+ module Runcible
2
+ class Response
3
+ attr_accessor :rest_client_response, :parsed_body
4
+
5
+ def initialize(parsed_body, rest_client_response)
6
+ @rest_client_response = rest_client_response
7
+ @parsed_body = parsed_body
8
+ end
9
+
10
+ def respond_to?(name)
11
+ @parsed_body.respond_to?(name) || @rest_client_response.respond_to?(name)
12
+ end
13
+
14
+ def ==(other)
15
+ self.parsed_body == other
16
+ end
17
+
18
+ def is_a?(clazz)
19
+ self.parsed_body.is_a?(clazz)
20
+ end
21
+
22
+ def body
23
+ @parsed_body
24
+ end
25
+
26
+ def method_missing(name, *args, &block)
27
+ if @parsed_body.respond_to?(name)
28
+ @parsed_body.send(name, *args, &block)
29
+ elsif @rest_client_response.respond_to?(name)
30
+ @rest_client_response.send(name, *args, &block)
31
+ else
32
+ super
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,3 +1,3 @@
1
1
  module Runcible
2
- VERSION = '1.12.0'.freeze
2
+ VERSION = '2.0.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runcible
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric D Helms, Justin Sherrill
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-28 00:00:00.000000000 Z
11
+ date: 2017-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: 1.6.1
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
- version: 2.0.0
36
+ version: 3.0.0
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 1.6.1
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
- version: 2.0.0
46
+ version: 3.0.0
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: oauth
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -177,6 +177,7 @@ files:
177
177
  - lib/runcible/resources/task_group.rb
178
178
  - lib/runcible/resources/unit.rb
179
179
  - lib/runcible/resources/user.rb
180
+ - lib/runcible/response.rb
180
181
  - lib/runcible/version.rb
181
182
  homepage: https://github.com/Katello/runcible
182
183
  licenses: []
@@ -197,9 +198,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
198
  version: '0'
198
199
  requirements: []
199
200
  rubyforge_project:
200
- rubygems_version: 2.4.8
201
+ rubygems_version: 2.6.8
201
202
  signing_key:
202
203
  specification_version: 4
203
204
  summary: ''
204
205
  test_files: []
205
- has_rdoc: