Sha256: b59e22598d4103a51cddfc12d96096a8d9273b4ad376f859bb8724d2db13b958
Contents?: true
Size: 710 Bytes
Versions: 13
Compression:
Stored size: 710 Bytes
Contents
module Boty module Slack module URL def self.included(base) base.instance_eval do def url(url); @_url = url end def _url; @_url end end end def self.get(url) JSON.parse Net::HTTP.get(URI(url)) || "{}" end private def parameterize(user_parameters, path: nil) url = path ? self.class._url + path : self.class._url parameters = {token: ENV["SLACK_BOT_API_TOKEN"]}.merge user_parameters parameters.reduce(url + "?") { |_url, param| parameter = param[0] value = URI.encode param[1].to_s "#{_url}#{parameter}=#{value}&" }.gsub(/&$/, "") end end end end
Version data entries
13 entries across 13 versions & 1 rubygems