runcible 1.2.0 → 1.3.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.
Files changed (43) hide show
  1. data/Gemfile +2 -1
  2. data/README.md +1 -1
  3. data/Rakefile +16 -10
  4. data/lib/runcible.rb +1 -1
  5. data/lib/runcible/base.rb +24 -29
  6. data/lib/runcible/extensions/consumer.rb +25 -26
  7. data/lib/runcible/extensions/consumer_group.rb +10 -13
  8. data/lib/runcible/extensions/distribution.rb +0 -2
  9. data/lib/runcible/extensions/docker_image.rb +0 -1
  10. data/lib/runcible/extensions/errata.rb +0 -3
  11. data/lib/runcible/extensions/package_category.rb +0 -3
  12. data/lib/runcible/extensions/package_group.rb +0 -2
  13. data/lib/runcible/extensions/puppet_module.rb +0 -3
  14. data/lib/runcible/extensions/repository.rb +88 -72
  15. data/lib/runcible/extensions/rpm.rb +3 -5
  16. data/lib/runcible/extensions/unit.rb +10 -13
  17. data/lib/runcible/extensions/yum_repo_metadata_file.rb +0 -3
  18. data/lib/runcible/instance.rb +22 -28
  19. data/lib/runcible/models/distributor.rb +4 -5
  20. data/lib/runcible/models/docker_distributor.rb +4 -4
  21. data/lib/runcible/models/docker_importer.rb +2 -2
  22. data/lib/runcible/models/export_distributor.rb +1 -1
  23. data/lib/runcible/models/importer.rb +3 -6
  24. data/lib/runcible/models/iso_distributor.rb +3 -3
  25. data/lib/runcible/models/iso_importer.rb +1 -1
  26. data/lib/runcible/models/nodes_http_distributor.rb +0 -1
  27. data/lib/runcible/models/puppet_distributor.rb +2 -2
  28. data/lib/runcible/models/yum_clone_distributor.rb +3 -4
  29. data/lib/runcible/models/yum_distributor.rb +7 -7
  30. data/lib/runcible/models/yum_importer.rb +17 -17
  31. data/lib/runcible/resources/consumer.rb +17 -20
  32. data/lib/runcible/resources/consumer_group.rb +13 -15
  33. data/lib/runcible/resources/content.rb +10 -10
  34. data/lib/runcible/resources/event_notifier.rb +5 -9
  35. data/lib/runcible/resources/repository.rb +23 -23
  36. data/lib/runcible/resources/repository_group.rb +5 -7
  37. data/lib/runcible/resources/repository_schedule.rb +5 -7
  38. data/lib/runcible/resources/role.rb +5 -8
  39. data/lib/runcible/resources/task.rb +10 -13
  40. data/lib/runcible/resources/unit.rb +3 -6
  41. data/lib/runcible/resources/user.rb +7 -10
  42. data/lib/runcible/version.rb +1 -1
  43. metadata +2 -2
@@ -21,24 +21,22 @@
21
21
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
22
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
23
 
24
-
25
24
  module Runcible
26
25
  module Resources
27
26
  # @see https://pulp-dev-guide.readthedocs.org/en/latest/rest-api/dispatch/index.html
28
27
  class Task < Runcible::Base
29
-
30
28
  # Generates the API path for Tasks
31
29
  #
32
30
  # @param [String] id the id of the task
33
- # @return [String] the task path, may contain the id if passed
34
- def self.path(id=nil)
35
- (id == nil) ? "tasks/" : "tasks/#{id}/"
31
+ # @return [String] the task path, may contain the id if passed
32
+ def self.path(id = nil)
33
+ (id.nil?) ? 'tasks/' : "tasks/#{id}/"
36
34
  end
37
35
 
38
36
  # Polls for the status of a task
39
37
  #
40
38
  # @param [String] id the id of the task
41
- # @return [RestClient::Response]
39
+ # @return [RestClient::Response]
42
40
  def poll(id)
43
41
  call(:get, path(id))
44
42
  end
@@ -46,7 +44,7 @@ module Runcible
46
44
  # Cancels a task
47
45
  #
48
46
  # @param [String] id the id of the task
49
- # @return [RestClient::Response]
47
+ # @return [RestClient::Response]
50
48
  def cancel(id)
51
49
  #cancelling a task may require cancelling some higher level
52
50
  # task, so query the tasks _href field to make sure
@@ -56,20 +54,19 @@ module Runcible
56
54
  # List all tasks based on a set of tags
57
55
  #
58
56
  # @param [Array] tags array of tags to scope the list on
59
- # @return [RestClient::Response]
60
- def list(tags=[])
61
- call(:get, path, :params=>{:tag=>tags})
57
+ # @return [RestClient::Response]
58
+ def list(tags = [])
59
+ call(:get, path, :params => {:tag => tags})
62
60
  end
63
61
 
64
62
  # Polls all tasks based on array of IDs
65
63
  # temporary solution until https://bugzilla.redhat.com/show_bug.cgi?id=860089
66
64
  #
67
65
  # @param [Array] ids array of ids to poll the status of
68
- # @return [Array] array of RestClient::Response task poll objects
66
+ # @return [Array] array of RestClient::Response task poll objects
69
67
  def poll_all(ids)
70
- return ids.collect{|id| poll(id)}
68
+ return ids.map { |id| poll(id) }
71
69
  end
72
-
73
70
  end
74
71
  end
75
72
  end
@@ -21,12 +21,10 @@
21
21
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
22
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
23
 
24
-
25
24
  module Runcible
26
25
  module Resources
27
26
  # @see https://pulp-dev-guide.readthedocs.org/en/latest/rest-api/content/index.html
28
27
  class Unit < Runcible::Base
29
-
30
28
  # Generates the API path for Units
31
29
  #
32
30
  # @param [String] type the unit type
@@ -40,11 +38,10 @@ module Runcible
40
38
  # @param [String] type the unit type
41
39
  # @param [Hash] criteria criteria object containing Mongo syntax
42
40
  # @param [Hash] optional container for all optional parameters
43
- # @return [RestClient::Response]
44
- def search(type, criteria, optional={})
45
- call(:post, path(type), :payload=>{:required=>{:criteria=>criteria}, :optional=>optional})
41
+ # @return [RestClient::Response]
42
+ def search(type, criteria, optional = {})
43
+ call(:post, path(type), :payload => {:required => {:criteria => criteria}, :optional => optional})
46
44
  end
47
45
  end
48
-
49
46
  end
50
47
  end
@@ -21,23 +21,21 @@
21
21
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
22
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
23
 
24
-
25
24
  module Runcible
26
25
  module Resources
27
26
  # @see https://pulp-dev-guide.readthedocs.org/en/latest/rest-api/user/index.html
28
27
  class User < Runcible::Base
29
-
30
28
  # Generates the API path for Users
31
29
  #
32
30
  # @param [String] login the user's login
33
31
  # @return [String] the user path, may contain the login if passed
34
- def self.path(login=nil)
35
- (login == nil) ? "users/" : "users/#{login}/"
32
+ def self.path(login = nil)
33
+ (login.nil?) ? 'users/' : "users/#{login}/"
36
34
  end
37
35
 
38
36
  # Retrieves all users
39
37
  #
40
- # @return [RestClient::Response]
38
+ # @return [RestClient::Response]
41
39
  def retrieve_all
42
40
  call(:get, path)
43
41
  end
@@ -46,8 +44,8 @@ module Runcible
46
44
  #
47
45
  # @param [String] login the login requested for the user
48
46
  # @param [Hash] optional container for all optional parameters
49
- # @return [RestClient::Response]
50
- def create(login, optional={})
47
+ # @return [RestClient::Response]
48
+ def create(login, optional = {})
51
49
  required = required_params(binding.send(:local_variables), binding)
52
50
  call(:post, path, :payload => { :required => required, :optional => optional })
53
51
  end
@@ -55,7 +53,7 @@ module Runcible
55
53
  # Retrieves a user
56
54
  #
57
55
  # @param [String] login the login of the user being retrieved
58
- # @return [RestClient::Response]
56
+ # @return [RestClient::Response]
59
57
  def retrieve(login)
60
58
  call(:get, path(login))
61
59
  end
@@ -63,11 +61,10 @@ module Runcible
63
61
  # Deletes a user
64
62
  #
65
63
  # @param [String] login the login of the user being deleted
66
- # @return [RestClient::Response]
64
+ # @return [RestClient::Response]
67
65
  def delete(login)
68
66
  call(:delete, path(login))
69
67
  end
70
-
71
68
  end
72
69
  end
73
70
  end
@@ -1,3 +1,3 @@
1
1
  module Runcible
2
- VERSION = "1.2.0"
2
+ VERSION = '1.3.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runcible
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-08 00:00:00.000000000 Z
12
+ date: 2014-11-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json