Sha256: 27929c76ec60e58bbaecc07808253925e7960d8b49a0d86cffa0ffff1bcef038

Contents?: true

Size: 1.59 KB

Versions: 9

Compression:

Stored size: 1.59 KB

Contents

module Stream
  module Batch
    #
    # Follows many feeds in one single request
    #
    # @param [Array<Hash<:source, :target>>] follows the list of follows
    #
    # @return [nil]
    #
    # @example
    #
    #
    # follows = [
    #   {:source => 'flat:1', :target => 'user:1'},
    #   {:source => 'flat:1', :target => 'user:3'}
    # ]
    # @client.follow_many(follows)
    #
    def follow_many(follows, activity_copy_limit = nil)
      query_params = {}
      unless activity_copy_limit.nil?
        query_params['activity_copy_limit'] = activity_copy_limit
      end
      make_signed_request(:post, '/follow_many/', query_params, follows)
    end

    #
    # Unfollow many feeds in one single request
    #
    # @param [Array<Hash<:source, :target, :keep_history>>] unfollows the list of follows to remove.
    #
    # return [nil]
    #
    # @example
    #
    #
    # unfollows = [
    #   {source: 'user:1', target: 'timeline:1'},
    #   {source: 'user:2', target: 'timeline:2', keep_history: false}
    # ]
    # @client.unfollow_many(unfollows)
    #
    def unfollow_many(unfollows)
      make_signed_request(:post, '/unfollow_many/', {}, unfollows)
    end
    
    #
    # Adds an activity to many feeds in one single request
    #
    # @param [Hash] activity_data the activity do add
    # @param [Array<string>] feeds list of feeds (eg. 'user:1', 'flat:2')
    #
    # @return [nil]
    #
    def add_to_many(activity_data, feeds)
      data = {
        :feeds => feeds,
        :activity => activity_data
      }
      make_signed_request(:post, '/feed/add_to_many/', {}, data)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
stream-ruby-2.11.0 lib/stream/batch.rb
stream-ruby-2.10.0 lib/stream/batch.rb
stream-ruby-2.9.3 lib/stream/batch.rb
stream-ruby-2.9.2 lib/stream/batch.rb
stream-ruby-2.9.1 lib/stream/batch.rb
stream-ruby-2.9.0 lib/stream/batch.rb
stream-ruby-2.8.0 lib/stream/batch.rb
stream-ruby-2.7.1 lib/stream/batch.rb
stream-ruby-2.7.0 lib/stream/batch.rb