Sha256: 641f862a7d71ad4e9e87686e929df1992637992a55b7e14e1b774f6dd2e1680a

Contents?: true

Size: 627 Bytes

Versions: 17

Compression:

Stored size: 627 Bytes

Contents

module Telegram
  module Bot
    module Botan
      class Api
        attr_reader :token

        def initialize(token)
          @token = token
        end

        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

        private

        def conn
          @conn ||= Faraday.new(url: 'https://api.botan.io') do |faraday|
            faraday.request :url_encoded
            faraday.adapter Telegram::Bot.configuration.adapter
          end
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
telegram-bot-ruby-0.8.3 lib/telegram/bot/botan/api.rb
telegram-bot-ruby-0.8.2 lib/telegram/bot/botan/api.rb
telegram-bot-ruby-0.8.1 lib/telegram/bot/botan/api.rb
telegram-bot-ruby-0.8.0 lib/telegram/bot/botan/api.rb
telegram-bot-ruby-0.7.2 lib/telegram/bot/botan/api.rb
telegram-bot-ruby-0.7.1 lib/telegram/bot/botan/api.rb
telegram-bot-ruby-0.7.0 lib/telegram/bot/botan/api.rb
telegram-bot-ruby-0.6.0.2 lib/telegram/bot/botan/api.rb
telegram-bot-ruby-0.6.0.1 lib/telegram/bot/botan/api.rb
telegram-bot-ruby-0.5.3 lib/telegram/bot/botan/api.rb
telegram-bot-ruby-0.5.2 lib/telegram/bot/botan/api.rb
telegram-bot-ruby-0.5.1 lib/telegram/bot/botan/api.rb
telegram-bot-ruby-0.5.0 lib/telegram/bot/botan/api.rb
telegram-bot-ruby-0.5.0.beta4 lib/telegram/bot/botan/api.rb
telegram-bot-ruby-0.5.0.beta3 lib/telegram/bot/botan/api.rb
telegram-bot-ruby-0.5.0.beta2 lib/telegram/bot/botan/api.rb
telegram-bot-ruby-0.5.0.beta1 lib/telegram/bot/botan/api.rb