runcible 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -62,6 +62,7 @@ module Runcible
62
62
  end
63
63
  content
64
64
  end
65
+
65
66
  end
66
67
  end
67
68
  end
@@ -25,6 +25,7 @@
25
25
  module Runcible
26
26
  module Extensions
27
27
  class ConsumerGroup < Runcible::Resources::ConsumerGroup
28
+
28
29
  def self.add_consumers_by_id(id, consumer_ids)
29
30
  self.associate(id, make_consumer_criteria(consumer_ids))
30
31
  end
@@ -33,14 +34,12 @@ module Runcible
33
34
  self.unassociate(id, make_consumer_criteria(consumer_ids))
34
35
  end
35
36
 
36
-
37
37
  def self.make_consumer_criteria(consumer_ids)
38
38
  {:criteria =>
39
39
  {:filters =>
40
40
  {:id =>{"$in" =>consumer_ids}}
41
41
  }
42
42
  }
43
-
44
43
  end
45
44
 
46
45
  def self.install_content(id, type_id, units)
@@ -90,9 +90,7 @@ module Runcible
90
90
  def self.rpm_remove(repo_id, package_ids)
91
91
  criteria = {:type_ids => ['rpm'], :filters => {}}
92
92
  criteria[:filters]['association'] = {'unit_id' => {'$in' => package_ids}}
93
- payload = {}
94
- payload[:criteria] = criteria
95
- self.unassociate_units(repo_id, payload)
93
+ self.unassociate_units(repo_id, criteria)
96
94
  end
97
95
 
98
96
  #optional
@@ -107,8 +105,7 @@ module Runcible
107
105
  def self.errata_remove(repo_id, errata_ids)
108
106
  criteria = {:type_ids => ['erratum'], :filters => {}}
109
107
  criteria[:filters][:unit] = { :id=>{ '$in' => errata_ids } }
110
- payload = {:criteria => criteria}
111
- self.unassociate_units(repo_id, payload)
108
+ self.unassociate_units(repo_id, criteria)
112
109
  end
113
110
 
114
111
  #optoinal
@@ -123,23 +120,16 @@ module Runcible
123
120
  def self.distribution_remove(repo_id, distribution_id)
124
121
  criteria = {:type_ids => ['distribution'], :filters => {}}
125
122
  criteria[:filters][:unit] = { :id=>{ '$in' => [distribution_id] } }
126
- payload = {:criteria => criteria}
127
- self.unassociate_units(repo_id, payload)
123
+ self.unassociate_units(repo_id, criteria)
128
124
  end
129
125
 
130
126
  def self.rpm_ids(id)
131
- criteria = {:type_ids=>['rpm'],
132
- :sort => {
133
- :unit => [ ['name', 'ascending'], ['version', 'descending'] ]
134
- }}
127
+ criteria = {:type_ids=>['rpm']}
135
128
  self.unit_search(id, criteria).collect{|i| i['unit_id']}
136
129
  end
137
130
 
138
131
  def self.rpms(id)
139
- criteria = {:type_ids=>['rpm'],
140
- :sort => {
141
- :unit => [ ['name', 'ascending'], ['version', 'descending'] ]
142
- }}
132
+ criteria = {:type_ids=>['rpm']}
143
133
  self.unit_search(id, criteria).collect{|i| i['metadata'].with_indifferent_access}
144
134
  end
145
135
 
@@ -163,45 +153,25 @@ module Runcible
163
153
  end
164
154
 
165
155
  def self.errata_ids(id, filter = {})
166
- criteria = {
167
- :type_ids=>['erratum'],
168
- :sort => {
169
- :unit => [ ['title', 'ascending'] ]
170
- }
171
- }
156
+ criteria = {:type_ids=>['erratum']}
172
157
 
173
158
  self.unit_search(id, criteria).collect{|i| i['unit_id']}
174
159
  end
175
160
 
176
161
  def self.distributions(id)
177
- criteria = {
178
- :type_ids=>['distribution'],
179
- :sort => {
180
- :unit => [ ['id', 'ascending'] ]
181
- }
182
- }
162
+ criteria = {:type_ids=>['distribution']}
183
163
 
184
164
  self.unit_search(id, criteria).collect{|i| i['metadata'].with_indifferent_access}
185
165
  end
186
166
 
187
167
  def self.package_groups(id)
188
- criteria = {
189
- :type_ids=>[Runcible::Extensions::PackageGroup::TYPE],
190
- :sort => {
191
- :unit => [ ['id', 'ascending'] ]
192
- }
193
- }
168
+ criteria = {:type_ids=>[Runcible::Extensions::PackageGroup::TYPE]}
194
169
 
195
170
  self.unit_search(id, criteria).collect{|i| i['metadata'].with_indifferent_access}
196
171
  end
197
172
 
198
173
  def self.package_categories(id)
199
- criteria = {
200
- :type_ids=>[Runcible::Extensions::PackageCategory::TYPE],
201
- :sort => {
202
- :unit => [ ['id', 'ascending'] ]
203
- }
204
- }
174
+ criteria = {:type_ids=>[Runcible::Extensions::PackageCategory::TYPE]}
205
175
  self.unit_search(id, criteria).collect{|i| i['metadata'].with_indifferent_access}
206
176
  end
207
177
 
@@ -43,7 +43,6 @@ module Runcible
43
43
  call(:put, path(id), :payload => { :delta => optional })
44
44
  end
45
45
 
46
-
47
46
  def self.upload_profile(id, content_type, profile)
48
47
  required = required_params(binding.send(:local_variables), binding, ["id"])
49
48
  call(:post, path("#{id}/profiles/"), :payload => { :required => required })
@@ -65,7 +64,6 @@ module Runcible
65
64
  call(:get, path("#{id}/bindings/"))
66
65
  end
67
66
 
68
-
69
67
  def self.bind(id, repo_id, distributor_id)
70
68
  required = required_params(binding.send(:local_variables), binding, ["id"])
71
69
  call(:post, path("#{id}/bindings"), :payload => { :required => required })
@@ -75,10 +73,6 @@ module Runcible
75
73
  call(:delete, path("#{id}/bindings/#{repo_id}/#{distributor_id}"))
76
74
  end
77
75
 
78
- def self.repos(id)
79
- call(:get, path("#{id}/bindings/"))
80
- end
81
-
82
76
  def self.install_units(id, units, options={})
83
77
  required = required_params(binding.send(:local_variables), binding, ["id"])
84
78
  call(:post, path("#{id}/actions/content/install/"), :payload => { :required => required })
@@ -93,6 +87,7 @@ module Runcible
93
87
  required = required_params(binding.send(:local_variables), binding, ["id"])
94
88
  call(:post, path("#{id}/actions/content/uninstall/"), :payload => { :required => required })
95
89
  end
90
+
96
91
  end
97
92
  end
98
- end
93
+ end
@@ -81,10 +81,10 @@ module Runcible
81
81
  :payload => { :required => required, :optional=> optional })
82
82
  end
83
83
 
84
- def self.unassociate_units(source_repo_id, optional={})
84
+ def self.unassociate_units(source_repo_id, criteria={})
85
85
  required = required_params(binding.send(:local_variables), binding, ["source_repo_id"])
86
86
  call(:post, "#{path(source_repo_id)}actions/unassociate/",
87
- :payload => { :required => required, :optional=> optional })
87
+ :payload => { :required => { :criteria => criteria }})
88
88
  end
89
89
 
90
90
  def self.unit_search(id, criteria={})
@@ -1,3 +1,3 @@
1
1
  module Runcible
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runcible
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Eric D Helms
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-11-02 00:00:00 Z
18
+ date: 2012-11-12 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: Exposing Pulp's juiciest components to the Ruby world.