Class: Fog::Compute::Softlayer::Tags
- Inherits:
-
Fog::Collection
- Object
- Fog::Collection
- Fog::Compute::Softlayer::Tags
- Defined in:
- lib/fog/softlayer/models/compute/tags.rb
Instance Method Summary collapse
- #all(filters = filters) ⇒ Object
- #get(id) ⇒ Object
-
#initialize(attributes) ⇒ Tags
constructor
A new instance of Tags.
Constructor Details
#initialize(attributes) ⇒ Tags
Returns a new instance of Tags.
19 20 21 22 |
# File 'lib/fog/softlayer/models/compute/tags.rb', line 19 def initialize(attributes) self.filters ||= [] super end |
Instance Method Details
#all(filters = filters) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/fog/softlayer/models/compute/tags.rb', line 24 def all(filters = filters) raise ArgumentError, "Filters argument for #{self.class.name}##{__method__} must be Array." unless filters.is_a?(Array) self.filters = filters data = service..body data.select! { |tag| filters.include?(tag) } unless filters.empty? load(data) end |
#get(id) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/fog/softlayer/models/compute/tags.rb', line 32 def get(id) return nil if id.nil? || id == "" response = service.get_tag(id) data = response.body new.merge_attributes(data) end |