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)


35
36
37
38
39
40
41
# File 'lib/stream/batch.rb', line 35

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 = [

{:source => 'flat:1', :target => 'user:1'},
{:source => '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