Sha256: 5751a0932ab3c52ada20b5ce9ffed904bc6da401755eaac227502e20d73de6d6

Contents?: true

Size: 1014 Bytes

Versions: 10

Compression:

Stored size: 1014 Bytes

Contents

#
# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>)
# © Copyright IBM Corporation 2014.
#
# LICENSE: MIT (http://opensource.org/licenses/MIT)
#

require 'fog/softlayer/models/compute/tag'

module Fog
  module Compute
    class Softlayer
      class Tags < Fog::Collection
        attribute :filters

        model Fog::Compute::Softlayer::Tag

        def initialize(attributes)
          self.filters ||= []
          super
        end

        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.describe_tags.body
          data.select! { |tag| filters.include?(tag) } unless filters.empty?
          load(data)
        end

        def get(id)
          return nil if id.nil? || id == ""
          response = service.get_tag(id)
          data = response.body
          new.merge_attributes(data)
        end
      end
    end
  end
end

Version data entries

10 entries across 8 versions & 2 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/models/compute/tags.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/models/compute/tags.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/models/compute/tags.rb
fog-softlayer-1.1.4 lib/fog/softlayer/models/compute/tags.rb
fog-softlayer-1.1.3 lib/fog/softlayer/models/compute/tags.rb
fog-softlayer-1.1.2 lib/fog/softlayer/models/compute/tags.rb
fog-softlayer-1.1.1 lib/fog/softlayer/models/compute/tags.rb
fog-softlayer-1.1.0 lib/fog/softlayer/models/compute/tags.rb
fog-softlayer-1.0.3 lib/fog/softlayer/models/compute/tags.rb
fog-softlayer-1.0.2 lib/fog/softlayer/models/compute/tags.rb