Sha256: 175ae02e8d9bdd185f0520bef8298c671e912c21e77946d258a1bae11c435b43

Contents?: true

Size: 1.33 KB

Versions: 8

Compression:

Stored size: 1.33 KB

Contents

module DataSift
  class DynamicList < DataSift::ApiResource

    ##
    # Get all lists and their ids.
    def get
      params = {}
      requires params
      DataSift.request(:GET, 'list/get', @config, params)
    end

    ##
    # Create a new dynamic list
    def create (type, name)
      params = {
          :type => type
      }
      requires params
      params[:name] = name
      DataSift.request(:POST, 'list/create', @config, params)
    end

    ##
    # Delete a dynamic list
    def delete (id)
      params = {
          :id => id
      }
      requires params
      DataSift.request(:DELETE, 'list/delete', @config, params)
    end

    ##
    # Check if items exist in given list
    def exists (id, items)
      params = {
          :id => id,
          :items => items
      }
      requires params
      DataSift.request(:POST, 'list/exists', @config, params)
    end

    ##
    # Add items to a given list
    def add (id, items)
      params = {
          :id => id,
          :items => items
      }
      requires params
      DataSift.request(:POST, 'list/add', @config, params)
    end

    ##
    # Remove items from a given list
    def remove (id, items)
      params = {
          :id => id,
          :items => items
      }
      requires params
      DataSift.request(:POST, 'list/remove', @config, params)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
datasift-3.1.5 lib/dynamic_list.rb
datasift-3.1.4 lib/dynamic_list.rb
datasift-3.1.3 lib/dynamic_list.rb
datasift-3.1.2 lib/dynamic_list.rb
datasift-3.1.1 lib/dynamic_list.rb
datasift-3.1.0 lib/dynamic_list.rb
datasift-3.0.1 lib/dynamic_list.rb
datasift-3.0.0 lib/dynamic_list.rb