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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27a007db1684e5b9f9d4be975f9dcced956ae12de5bf483fb4796af6481c0cc0
4
- data.tar.gz: 29fcfbbb492750b288242fb5ce83c56fabeb83f6a0d729fb73c72b6e652e865a
3
+ metadata.gz: d2d2dee8d6fe3511c2d9fa058489673f6efd9134f514148ff1ac3a0ec1f19ac0
4
+ data.tar.gz: 609eb3a1aed5ae7da0cf2e19bb83d4689ae233af609191e811946012c0be562e
5
5
  SHA512:
6
- metadata.gz: 862c56babb93f0370dc1db323d8c802160ce12d2ec8992ed2d8d4a1677ca1fd66eef1b8883cefcf25b983ce60c5b405725145ee24eafc08736a75a89d0dde530
7
- data.tar.gz: d5a11f4a0ea583c930c175f9d094a493b09c0241562c13af42d34d7652e1b97eeeba5d9462ab2e0b5b0cf1109530cd969abe2121a3970bea4169be7f022ba041
6
+ metadata.gz: d86a3cda56173a45745768cf01b8459dd4415717a5a24d8bd51a153b357c33aef315e540407161ee2fb2aeb13bf8d42ac4bb07d94b7d60cd19f0cf175fb687d6
7
+ data.tar.gz: 106ee2fb65dc2b9d880a2a55d8bcc18045baaad26cb4a906fe55dfcddd3380a7391905d797cc691598670546014a664a457e644f4b6441c12c65cfdd86ac981c
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
- # Msteams::Ruby::Client
1
+ # Teams
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/msteams-ruby-client.svg)](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
- msteams = Msteams::Ruby::Client.new('<webhook url>')
27
- msteams.post('hello')
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
@@ -1,4 +1,4 @@
1
1
  require 'msteams-ruby-client'
2
2
 
3
- msteams = Msteams::Ruby::Client.new
4
- msteams.post('hello')
3
+ teams = Teams.new
4
+ teams.post('hello')
@@ -3,5 +3,5 @@ require 'net/http'
3
3
  require 'openssl'
4
4
  require 'uri'
5
5
 
6
- require_relative 'msteams/ruby/client/version'
7
- require_relative 'msteams/ruby/client'
6
+ require_relative 'teams/version'
7
+ require_relative 'teams'
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
@@ -0,0 +1,3 @@
1
+ class Teams
2
+ VERSION = '0.2.0'.freeze
3
+ end
@@ -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 'msteams/ruby/client/version'
4
+ require 'teams/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'msteams-ruby-client'
8
- spec.version = Msteams::Ruby::Client::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.1.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-26 00:00:00.000000000 Z
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:
@@ -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
@@ -1,7 +0,0 @@
1
- module Msteams
2
- module Ruby
3
- class Client
4
- VERSION = '0.1.0'.freeze
5
- end
6
- end
7
- end