Module: Stream::Batch

Included in:
Client
Defined in:
lib/stream/batch.rb

Instance Method Summary collapse

Instance Method Details

#add_to_many(activity_data, feeds) ⇒ nil

Adds an activity to many feeds in one single request

Parameters:

  • activity_data (Hash)

    the activity do add

  • feeds (Array<string>)

    list of feeds (eg. 'user:1', 'flat:2')

Returns:

  • (nil)


55
56
57
58
59
60
61
# File 'lib/stream/batch.rb', line 55

def add_to_many(activity_data, feeds)
  data = {
    :feeds => feeds,
    :activity => activity_data
  }
  make_signed_request(:post, '/feed/add_to_many/', {}, data)
end

#follow_many(follows, activity_copy_limit = nil) ⇒ nil

Follows many feeds in one single request

follows = [ => 'flat:1', :target => 'user:1', => 'flat:1', :target => 'user:3' ] @client.follow_many(follows)

Parameters:

  • follows (Array<Hash<:source, :target>>)

    the list of follows

Returns:

  • (nil)


19
20
21
22
23
24
25
# File 'lib/stream/batch.rb', line 19

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(unfollows) ⇒ Object

Unfollow many feeds in one single request

return [nil]

unfollows = [ 'user:1', target: 'timeline:1', 'user:2', target: 'timeline:2', keep_history: false ] @client.unfollow_many(unfollows)

Parameters:

  • unfollows (Array<Hash<:source, :target, :keep_history>>)

    the list of follows to remove.



43
44
45
# File 'lib/stream/batch.rb', line 43

def unfollow_many(unfollows)
  make_signed_request(:post, '/unfollow_many/', {}, unfollows)
end