Sha256: 7d23b01cf672d8b5300bf392c5c3e0ca410fd697338d8e121b4bc7898349ebfc

Contents?: true

Size: 1.06 KB

Versions: 13

Compression:

Stored size: 1.06 KB

Contents

class Kaui::Tag < KillBillClient::Model::Tag

  def self.list_or_search(search_key = nil, offset = 0, limit = 10, options = {})
    if search_key.present?
      find_in_batches_by_search_key(search_key, offset, limit, options)
    else
      find_in_batches(offset, limit, options)
    end
  end

  class << self
    [:account, :bundle].each do |model|
      define_method "all_for_#{model.to_s}" do |model_id, included_deleted, audit, options|
        instance = Kaui.const_get(model.to_s.camelize).new("#{model.to_s}_id".to_sym => model_id)
        instance.tags(included_deleted, audit, options)
      end

      define_method "set_for_#{model.to_s}" do |model_id, tags, user, reason, comment, options|
        instance = Kaui.const_get(model.to_s.camelize).new("#{model.to_s}_id".to_sym => model_id)
        instance.set_tags(tags, user, reason, comment, options)
      end
    end
  end

  def is_system_tag?
    Kaui::TagDefinition(:id => tag_definition_id).is_system_tag?
  end

  def <=>(tag)
    tag_definition_name.downcase <=> tag.tag_definition_name.downcase
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
kaui-0.16.2 app/models/kaui/tag.rb
kaui-0.16.1 app/models/kaui/tag.rb
kaui-0.16.0 app/models/kaui/tag.rb
kaui-0.15.5 app/models/kaui/tag.rb
kaui-0.15.4 app/models/kaui/tag.rb
kaui-0.15.3 app/models/kaui/tag.rb
kaui-0.15.2 app/models/kaui/tag.rb
kaui-0.15.1 app/models/kaui/tag.rb
kaui-0.15.0 app/models/kaui/tag.rb
kaui-0.14.2 app/models/kaui/tag.rb
kaui-0.14.1 app/models/kaui/tag.rb
kaui-0.14.0 app/models/kaui/tag.rb
kaui-0.12.0 app/models/kaui/tag.rb