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 = self.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.
18 19 20 21 |
# File 'lib/fog/softlayer/models/compute/tags.rb', line 18 def initialize(attributes) self.filters ||= [] super end |
Instance Method Details
#all(filters = self.filters) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/fog/softlayer/models/compute/tags.rb', line 23 def all(filters = self.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
31 32 33 34 35 36 |
# File 'lib/fog/softlayer/models/compute/tags.rb', line 31 def get(id) return nil if id.nil? || id == "" response = service.get_tag(id) data = response.body new.merge_attributes(data) end |