<commit_before>require 'httparty'
require 'cgi'
require 'digest/sha1'

class Notifo
  include HTTParty
  base_uri 'https://api.notifo.com/v1'

  # Required Parameters
  # username - notifo service username
  # apikey - notifo service apisecret
  def initialize(username, apisecret)
    @auth = {:username => username, :password => <PASSWORD>}
  end
  
  # Required Parameters
  # username - notifo username to subscribe to your service
  def subscribe_user(username)
    options = { :body => {:username => username}, :basic_auth => @auth }
    self.class.post("/subscribe_user", options)
  end
  
  # Required Parameters
  # to - notifo username of recipient
  # msg - message being sent; must be url encoded
  # Optional Parameters
  # title - name of "notification event"
  # uri - the uri that will be loaded when the notification is opened; if specified, must be urlencoded; if a web address, must start with http:// or https://
  # label - label describing the "application" (used only if being sent from a User account; the Service label is automatically applied if being sent from a Service account) 
  def post(username, msg, title=nil, uri=nil, label=nil)
    options = { :body => {:to => username, :msg => msg, :label=>title, :title=>title, :uri=>uri}, :basic_auth => @auth }
    self.class.post('/send_notification', options)
  end

  # Require Parameters
  # params - the hash of params the webhook passed to you. All keys must be *Strings*, not symbols.
  def verify_webhook_signature(params)
    signature = params['notifo_signature']
    other_notifo_params = params.reject {|key,val| !(key =~ /\Anotifo_/ && key != "notifo_signature")}
    str = other_notifo_params.keys.sort.map do |key|
      params[key]
    end.join
    str << @auth[:password]
<commit_msg>label param to post() was sending title instead<commit_after>require 'httparty'
require 'cgi'
require 'digest/sha1'

class Notifo
  include HTTParty
  base_uri 'https://api.notifo.com/v1'

  # Required Parameters
  # username - notifo service username
  # apikey - notifo service apisecret
  def initialize(username, apisecret)
    @auth = {:username => username, :password => <PASSWORD>}
  end
  
  # Required Parameters
  # username - notifo username to subscribe to your service
  def subscribe_user(username)
    options = { :body => {:username => username}, :basic_auth => @auth }
    self.class.post("/subscribe_user", options)
  end
  
  # Required Parameters
  # to - notifo username of recipient
  # msg - message being sent; must be url encoded
  # Optional Parameters
  # title - name of "notification event"
  # uri - the uri that will be loaded when the notification is opened; if specified, must be urlencoded; if a web address, must start with http:// or https://
  # label - label describing the "application" (used only if being sent from a User account; the Service label is automatically applied if being sent from a Service account) 
  def post(username, msg, title=nil, uri=nil, label=nil)
    options = { :body => {:to => username, :msg => msg, :label=>label, :title=>title, :uri=>uri}, :basic_auth => @auth }
    self.class.post('/send_notification', options)
  end

  # Require Parameters
  # params - the hash of params the webhook passed to you. All keys must be *Strings*, not symbols.
  def verify_webhook_signature(params)
    signature = params['notifo_signature']
    other_notifo_params = params.reject {|key,val| !(key =~ /\Anotifo_/ && key != "notifo_signature")}
    str = other_notifo_params.keys.sort.map do |key|
      params[key]
    end.join
    str << @auth[:password]

{'fraction_non_alphanumeric': 0.11098717233686559, 'fraction_numerical': 0.0011154489682097045, 'mean_word_length': 3.8083109919571045, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 29, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2702209', 'n_tokens_mistral': 1083, 'n_tokens_neox': 1056, 'n_words': 379}