msteams_notifier 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe446fbf7ca4eedd51829ae3ea0a37897996fb3cb43dafa09cd8f13c3ec8d125
4
- data.tar.gz: c71d23ae23f2e7c2b810eced7fc18fa533f2f409430840297b9bf6b4e28a125f
3
+ metadata.gz: 1c1da52a34f03ee3f4580db528768b05f6a63de85a2b2d0d603de43d32bf6b23
4
+ data.tar.gz: 7fedc2ef893d4f047c5f15810f14c6a7502b3c07f8c22bc139d6d12720de330d
5
5
  SHA512:
6
- metadata.gz: '029c27599e3b72c7740595014ec34cc7173350da751c9484c3cfb9944d0b6b43cb8b3e1df42475dc58c0fda8ffc7a09233bf6162175b207baa4ceed82ce49432'
7
- data.tar.gz: 818872ef2c0f7132b474a5e97c1f9df553486110dc1cc3ddd42106b84b1d46cdaab2952bab6bac2692ec78d20e3d48be5f8a13c7d05bc4dce8c462ae65034e55
6
+ metadata.gz: de35a4e7cbbdbe927e3331c5c5937eace5aaefb37cd91e7a84f3118b33115e2dd737cc08ae075738ce5205f9966d577dfca262efcb7dd054edc696de33ef1384
7
+ data.tar.gz: 26bcc7a1674eb7dbc0b4ecd4c3e22feff3f6f7a4e45efdccfb2455af3c0f3dfdb3410100ae7a49711217e912c9902b8df8b1f1a998044f5bdf653270fdb36cdb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- msteams_notifier (0.1.1)
4
+ msteams_notifier (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module MsteamsNotifier
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -1,21 +1,29 @@
1
1
  require "msteams_notifier/version"
2
2
  require "net/http"
3
+ require "json"
3
4
 
4
5
  module MsteamsNotifier
5
6
  class Error < StandardError; end
6
7
 
7
8
  class Message
8
9
 
10
+ attr_accessor :enabled, :webhook_url, :quick_title
11
+
9
12
  # A quick method to send a text notification
10
13
  def self.quick_message(message)
11
14
  notifier = MsteamsNotifier::Message.new
15
+ if !notifier.quick_title.nil? && !notifier.quick_title != ""
16
+ notifier.add_title notifier.quick_title
17
+ end
12
18
  notifier.add_text(message)
19
+
13
20
  notifier.send
14
21
  end
15
22
 
16
23
  def initialize(options={})
17
24
  @enabled = options[:enabled] || (defined?(Rails) ? Rails.application.credentials.dig(:ms_teams, :enabled).to_s == "1" : true)
18
- @webhook_url = options[:webhook_url] || (defined?(Rails) ? Rails.application.credentials.dig(:ms_teams, :webhook_url) : '')
25
+ @webhook_url = options[:webhook_url] || (defined?(Rails) ? Rails.application.credentials.dig(:ms_teams, :webhook_url) : "")
26
+ @quick_title = options[:quick_title] || (defined?(Rails) ? Rails.application.credentials.dig(:ms_teams, :quick_title) : nil)
19
27
  @items = []
20
28
  @actions = []
21
29
  end
@@ -69,7 +77,9 @@ module MsteamsNotifier
69
77
  request.body = json_payload
70
78
  response = http.request(request)
71
79
  response.is_a?(Net::HTTPSuccess)
72
- rescue
80
+ rescue => e
81
+ puts e.message
82
+ puts e.backtrace
73
83
  false
74
84
  end
75
85
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msteams_notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - adventistmedia
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-27 00:00:00.000000000 Z
11
+ date: 2024-08-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: