@@ -212,6 +212,14 @@ def softlayer_properties(object_mask = nil)
212212 # * <b>+:name+</b> (string/array) - Return templates with the given name
213213 # * <b>+:global_id+</b> (string/array) - Return templates with the given global identifier
214214 # * <b>+:tags+</b> (string/array) - Return templates with the tags
215+ #
216+ # Additionally you may provide options related to the request itself:
217+ #
218+ # * <b>*:object_filter*</b> (ObjectFilter) - Include private image templates for templates that matche the
219+ # criteria of this object filter
220+ # * <b>+:object_mask+</b> (string, hash, or array) - The object mask of properties you wish to receive for the items returned.
221+ # If not provided, the result will use the default object mask
222+ # * <b>+:result_limit+</b> (hash with :limit, and :offset keys) - Limit the scope of results returned.
215223 def self . find_private_templates ( options_hash = { } )
216224 softlayer_client = options_hash [ :client ] || Client . default_client
217225 raise "#{ __method__ } requires a client but none was given and Client::default_client is not set" if !softlayer_client
@@ -239,20 +247,14 @@ def self.find_private_templates(options_hash = {})
239247 account_service = softlayer_client [ :Account ]
240248 account_service = account_service . object_filter ( object_filter ) unless object_filter . empty?
241249 account_service = account_service . object_mask ( default_object_mask )
250+ account_service = account_service . object_mask ( options_hash [ :object_mask ] ) if options_hash [ :object_mask ]
242251
243- if options_hash . has_key? :object_mask
244- account_service = account_service . object_mask ( options_hash [ :object_mask ] )
245- end
246-
247- if options_hash . has_key? ( :result_limit )
248- offset = options [ :result_limit ] [ :offset ]
249- limit = options [ :result_limit ] [ :limit ]
250-
251- account_service = account_service . result_limit ( offset , limit )
252+ if options_hash [ :result_limit ] && options_hash [ :result_limit ] [ :offset ] && options_hash [ :result_limit ] [ :limit ]
253+ account_service = account_service . result_limit ( options_hash [ :result_limit ] [ :offset ] , options_hash [ :result_limit ] [ :limit ] )
252254 end
253255
254256 templates_data = account_service . getPrivateBlockDeviceTemplateGroups
255- templates_data . collect { |template_data | new ( softlayer_client , template_data ) }
257+ templates_data . collect { |template_data | ImageTemplate . new ( softlayer_client , template_data ) }
256258 end
257259
258260 ##
@@ -269,6 +271,14 @@ def self.find_private_templates(options_hash = {})
269271 # * <b>+:name+</b> (string/array) - Return templates with the given name
270272 # * <b>+:global_id+</b> (string/array) - Return templates with the given global identifier
271273 # * <b>+:tags+</b> (string/array) - Return templates with the tags
274+ #
275+ # Additionally you may provide options related to the request itself:
276+ #
277+ # * <b>*:object_filter*</b> (ObjectFilter) - Include public image templates for templates that matche the
278+ # criteria of this object filter
279+ # * <b>+:object_mask+</b> (string, hash, or array) - The object mask of properties you wish to receive for the items returned.
280+ # If not provided, the result will use the default object mask
281+ # * <b>+:result_limit+</b> (hash with :limit, and :offset keys) - Limit the scope of results returned.
272282 def self . find_public_templates ( options_hash = { } )
273283 softlayer_client = options_hash [ :client ] || Client . default_client
274284 raise "#{ __method__ } requires a client but none was given and Client::default_client is not set" if !softlayer_client
@@ -296,20 +306,14 @@ def self.find_public_templates(options_hash = {})
296306 template_service = softlayer_client [ :Virtual_Guest_Block_Device_Template_Group ]
297307 template_service = template_service . object_filter ( object_filter ) unless object_filter . empty?
298308 template_service = template_service . object_mask ( default_object_mask )
309+ template_service = template_service . object_mask ( options_hash [ :object_mask ] ) if options_hash [ :object_mask ]
299310
300- if options_hash . has_key? :object_mask
301- template_service = template_service . object_mask ( options_hash [ :object_mask ] )
302- end
303-
304- if options_hash . has_key? ( :result_limit )
305- offset = options [ :result_limit ] [ :offset ]
306- limit = options [ :result_limit ] [ :limit ]
307-
308- template_service = template_service . result_limit ( offset , limit )
311+ if options_hash [ :result_limit ] && options_hash [ :result_limit ] [ :offset ] && options_hash [ :result_limit ] [ :limit ]
312+ template_service = template_service . result_limit ( options_hash [ :result_limit ] [ :offset ] , options_hash [ :result_limit ] [ :limit ] )
309313 end
310314
311315 templates_data = template_service . getPublicImages
312- templates_data . collect { |template_data | new ( softlayer_client , template_data ) }
316+ templates_data . collect { |template_data | ImageTemplate . new ( softlayer_client , template_data ) }
313317 end
314318
315319 ##
@@ -337,7 +341,7 @@ def self.template_with_id(id, options_hash = {})
337341 end
338342
339343 template_data = service . getObject
340- new ( softlayer_client , template_data )
344+ ImageTemplate . new ( softlayer_client , template_data )
341345 end
342346
343347 ##
0 commit comments