hangouts-chat 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5e32c09c217a575f6a4d35cd51a72481b68953fa15681bea43e9efe1e407033e
4
+ data.tar.gz: ed81dcac6e1b00af89391565086bfead6a312fa95a7ad76f244a6beaca48f306
5
+ SHA512:
6
+ metadata.gz: 011be67409a024ecce94bd811428b97402c10b513b306a28450b8347cd7844488199b0be674a2cb7307da815c2c28dfcd9941743236f9a019158124605153ae5
7
+ data.tar.gz: ccb349079db46b8fed09effa0b17904d646591f55c24bca93a1f744779587a697afef6fecf50b26e1bc282a6e256b20f2a0608fb4c711b0159a0bbbfcf36a0e6
@@ -0,0 +1,23 @@
1
+ require 'net/http'
2
+ require 'json'
3
+
4
+ module HangoutsChat
5
+ class Sender
6
+ class HTTP
7
+ def initialize(url)
8
+ @uri = URI(url)
9
+ @req = Net::HTTP::Post.new(@uri)
10
+ @req['Content-Type'] = 'application/json'
11
+ end
12
+
13
+ def post(payload)
14
+ @req.body = payload.to_json
15
+
16
+ res = Net::HTTP.start(@uri.hostname, @uri.port, use_ssl: true) do |http|
17
+ http.request(@req)
18
+ end
19
+ res
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ module HangoutsChat
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,16 @@
1
+ require_relative 'hangouts-chat/version'
2
+ require_relative 'hangouts-chat/http'
3
+
4
+ module HangoutsChat
5
+ class Sender
6
+ def initialize(webhook_url)
7
+ @url = webhook_url
8
+ @http = HTTP.new(@url)
9
+ end
10
+
11
+ def simple(text)
12
+ payload = { text: text }
13
+ @http.post payload
14
+ end
15
+ end
16
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hangouts-chat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - enzinia
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-03-20 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Send messages to Hangouts Chat rooms using incoming webhooks
14
+ email: vkukovskij@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/hangouts-chat.rb
20
+ - lib/hangouts-chat/http.rb
21
+ - lib/hangouts-chat/version.rb
22
+ homepage: https://github.com/enzinia/hangouts-chat
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.7.4
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: Send messages to Hangouts Chat rooms using incoming webhooks
46
+ test_files: []