Class: Telegram::Bot::Botan::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/telegram/bot/botan/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ Api

Returns a new instance of Api.



7
8
9
# File 'lib/telegram/bot/botan/api.rb', line 7

def initialize(token)
  @token = token
end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



5
6
7
# File 'lib/telegram/bot/botan/api.rb', line 5

def token
  @token
end

Instance Method Details

#track(event, uid, properties = {}) ⇒ Object



11
12
13
14
# File 'lib/telegram/bot/botan/api.rb', line 11

def track(event, uid, properties = {})
  query_str = URI.encode_www_form(token: token, name: event, uid: uid)
  conn.post("/track?#{query_str}", properties.to_json)
end