msteams-ruby-client 0.1.0 → 0.2.0
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 +4 -4
- data/README.md +6 -4
- data/examples/post/post.rb +2 -2
- data/lib/msteams-ruby-client.rb +2 -2
- data/lib/teams.rb +18 -0
- data/lib/teams/version.rb +3 -0
- data/msteams-ruby-client.gemspec +2 -2
- metadata +4 -4
- data/lib/msteams/ruby/client.rb +0 -22
- data/lib/msteams/ruby/client/version.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2d2dee8d6fe3511c2d9fa058489673f6efd9134f514148ff1ac3a0ec1f19ac0
|
4
|
+
data.tar.gz: 609eb3a1aed5ae7da0cf2e19bb83d4689ae233af609191e811946012c0be562e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d86a3cda56173a45745768cf01b8459dd4415717a5a24d8bd51a153b357c33aef315e540407161ee2fb2aeb13bf8d42ac4bb07d94b7d60cd19f0cf175fb687d6
|
7
|
+
data.tar.gz: 106ee2fb65dc2b9d880a2a55d8bcc18045baaad26cb4a906fe55dfcddd3380a7391905d797cc691598670546014a664a457e644f4b6441c12c65cfdd86ac981c
|
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# Teams
|
2
|
+
|
3
|
+
[](https://badge.fury.io/rb/msteams-ruby-client)
|
2
4
|
|
3
5
|
Ruby Wrapper Library to send requests to Microsoft Teams Webhooks.
|
4
6
|
|
@@ -23,14 +25,14 @@ Or install it yourself as:
|
|
23
25
|
```ruby
|
24
26
|
require 'msteams-ruby-client'
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
+
teams = Teams.new('<webhook url>')
|
29
|
+
teams.post('hello')
|
28
30
|
```
|
29
31
|
|
30
32
|
Or
|
31
33
|
|
32
34
|
```bash
|
33
|
-
$ MSTEAMS_RUBY_CLIENT_WEBHOOK_URL=https://outlook.office.com/webhook/... examples/post/post.rb
|
35
|
+
$ MSTEAMS_RUBY_CLIENT_WEBHOOK_URL=https://outlook.office.com/webhook/... ruby examples/post/post.rb
|
34
36
|
```
|
35
37
|
|
36
38
|
## License
|
data/examples/post/post.rb
CHANGED
data/lib/msteams-ruby-client.rb
CHANGED
data/lib/teams.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
class Teams
|
2
|
+
def initialize(webhook_url = '')
|
3
|
+
@webhook_url = webhook_url || ENV['MSTEAMS_RUBY_CLIENT_WEBHOOK_URL']
|
4
|
+
end
|
5
|
+
|
6
|
+
def post(text)
|
7
|
+
uri = URI.parse(@webhook_url)
|
8
|
+
|
9
|
+
request = Net::HTTP::Post.new(uri.request_uri)
|
10
|
+
request['Content-Type'] = 'application/json'
|
11
|
+
request.body = { text: text }.to_json
|
12
|
+
|
13
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
14
|
+
http.use_ssl = true
|
15
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
16
|
+
http.start { |h| h.request(request) }
|
17
|
+
end
|
18
|
+
end
|
data/msteams-ruby-client.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
|
2
2
|
lib = File.expand_path('lib', __dir__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require '
|
4
|
+
require 'teams/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'msteams-ruby-client'
|
8
|
-
spec.version =
|
8
|
+
spec.version = Teams::VERSION
|
9
9
|
spec.authors = ['oooooooo']
|
10
10
|
spec.email = ['60764+oooooooo@users.noreply.github.com']
|
11
11
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: msteams-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- oooooooo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -55,9 +55,9 @@ files:
|
|
55
55
|
- examples/post/Gemfile
|
56
56
|
- examples/post/post.rb
|
57
57
|
- lib/msteams-ruby-client.rb
|
58
|
-
- lib/msteams/ruby/client.rb
|
59
|
-
- lib/msteams/ruby/client/version.rb
|
60
58
|
- lib/msteams_ruby_client.rb
|
59
|
+
- lib/teams.rb
|
60
|
+
- lib/teams/version.rb
|
61
61
|
- msteams-ruby-client.gemspec
|
62
62
|
homepage: https://github.com/oooooooo/msteams-ruby-client
|
63
63
|
licenses:
|
data/lib/msteams/ruby/client.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
module Msteams
|
2
|
-
module Ruby
|
3
|
-
class Client
|
4
|
-
def initialize(webhook_url = '')
|
5
|
-
@webhook_url = webhook_url || ENV['MSTEAMS_RUBY_CLIENT_WEBHOOK_URL']
|
6
|
-
end
|
7
|
-
|
8
|
-
def post(text)
|
9
|
-
uri = URI.parse(@webhook_url)
|
10
|
-
|
11
|
-
request = Net::HTTP::Post.new(uri.request_uri)
|
12
|
-
request['Content-Type'] = 'application/json'
|
13
|
-
request.body = { text: text }.to_json
|
14
|
-
|
15
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
16
|
-
http.use_ssl = true
|
17
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
18
|
-
http.start { |h| h.request(request) }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|