Class: IgApi::Thread

Inherits:
Object
  • Object
show all
Defined in:
lib/ig_api/thread.rb

Instance Method Summary collapse

Constructor Details

#initializeThread



3
4
5
# File 'lib/ig_api/thread.rb', line 3

def initialize
  @api = Http.singleton
end

Instance Method Details

#configure_text(users, text) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ig_api/thread.rb', line 16

def configure_text(users, text)
  body = {
    recipient_users: [users].to_json,
    client_context: Http.generate_uuid,
    text: text
  }

  response = @api.multipart(Constants::URL + 'direct_v2/threads/broadcast/text/',
                       body)
                 .with(ua: @user[:ua], session: @user[:session])
                 .exec

  response.body
end

#using(user) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/ig_api/thread.rb', line 7

def using(user)
  @user = {
    session: user.session,
    ua: user.useragent
  }

  self
end