hangouts-chat 0.0.1 → 0.0.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: 5e32c09c217a575f6a4d35cd51a72481b68953fa15681bea43e9efe1e407033e
4
- data.tar.gz: ed81dcac6e1b00af89391565086bfead6a312fa95a7ad76f244a6beaca48f306
3
+ metadata.gz: 28b2e028adbcf7dbe7ca389840a12c831d78b489dbc05ab5ffba189ffd735022
4
+ data.tar.gz: ac1ad9b4d55696001f3eb3f19c5654218d6dd420c350b819245defaaa086fbc8
5
5
  SHA512:
6
- metadata.gz: 011be67409a024ecce94bd811428b97402c10b513b306a28450b8347cd7844488199b0be674a2cb7307da815c2c28dfcd9941743236f9a019158124605153ae5
7
- data.tar.gz: ccb349079db46b8fed09effa0b17904d646591f55c24bca93a1f744779587a697afef6fecf50b26e1bc282a6e256b20f2a0608fb4c711b0159a0bbbfcf36a0e6
6
+ metadata.gz: 1fd3985550cfb69b9cc75e5c9d3b533eec64c7844823ffc5249f9ef0894a16cbb3522532780489394c13919c04424bbc690c68bf856d2d3d26f8559f1bd10bab
7
+ data.tar.gz: c3757efe0a005448322390d6b8275485f6fbb4a87a06ec4499dbe782360f792d0561f4332bcca1bc27db2c12f01b2b28d6101ff1ae8c73667199f5ee327810df
@@ -1,5 +1,5 @@
1
- require_relative 'hangouts-chat/version'
2
- require_relative 'hangouts-chat/http'
1
+ require_relative 'hangouts_chat/version'
2
+ require_relative 'hangouts_chat/http'
3
3
 
4
4
  module HangoutsChat
5
5
  class Sender
@@ -0,0 +1,3 @@
1
+ module HangoutsChat
2
+ VERSION = '0.0.2'.freeze
3
+ end
@@ -0,0 +1,31 @@
1
+ require 'test_helper'
2
+
3
+ class HTTPTest < Minitest::Test
4
+ def setup
5
+ @url = 'https://example.com'
6
+ @http = HangoutsChat::Sender::HTTP.new(@url)
7
+ end
8
+
9
+ def test_initialized_with_valid_uri
10
+ uri = @http.instance_variable_get(:@uri)
11
+ assert_equal 'https', uri.scheme
12
+ assert_equal 'example.com', uri.host
13
+ end
14
+
15
+ def test_initialized_with_valid_post_request
16
+ req = @http.instance_variable_get(:@req)
17
+ assert_equal 'POST', req.method
18
+ assert_equal 'application/json', req['Content-Type']
19
+ end
20
+
21
+ def test_post_request
22
+ stub_request(:any, @url)
23
+ payload = 'Test text'
24
+
25
+ @http.post(payload)
26
+
27
+ assert_requested :post, @url, times: 1, body: payload.to_json, headers:
28
+ { 'Content-Type' => 'application/json' }
29
+ assert_not_requested :get, @url
30
+ end
31
+ end
@@ -0,0 +1,26 @@
1
+ require 'test_helper'
2
+
3
+ class HangoutsChatTest < Minitest::Test
4
+ def setup
5
+ @webhook_url = 'https://chat.googleapis.com/v1/spaces/space_id/' \
6
+ 'messages?key=secret_key&token=secret_token'
7
+ @sender = HangoutsChat::Sender.new(@webhook_url)
8
+ end
9
+
10
+ def test_initialized_with_valid_variables
11
+ url = @sender.instance_variable_get(:@url)
12
+ http = @sender.instance_variable_get(:@http)
13
+ assert_equal @webhook_url, url
14
+ assert_equal HangoutsChat::Sender::HTTP, http.class
15
+ end
16
+
17
+ def test_simple_message_request
18
+ stub_request(:any, /chat\.googleapis\.com/).to_return(status: 200)
19
+ message = 'Test simple message'
20
+
21
+ @sender.simple(message)
22
+
23
+ assert_requested :post, @webhook_url, times: 1, body:
24
+ { text: message }.to_json
25
+ end
26
+ end
@@ -0,0 +1,5 @@
1
+ require 'minitest/autorun'
2
+ require 'webmock/minitest'
3
+ require 'hangouts-chat'
4
+
5
+ WebMock.disable_net_connect!(net_http_connect_on_start: true)
metadata CHANGED
@@ -1,24 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hangouts-chat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - enzinia
8
8
  autorequire:
9
9
  bindir: bin
10
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
11
+ date: 2018-03-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubocop
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "<="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.54.0
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "<="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.54.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: webmock
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3'
41
+ description: |-
42
+ Send messages to G Suite Hangouts Chat rooms using
43
+ incoming webhooks and Net::HTTP::Post
14
44
  email: vkukovskij@gmail.com
15
45
  executables: []
16
46
  extensions: []
17
47
  extra_rdoc_files: []
18
48
  files:
19
- - lib/hangouts-chat.rb
20
- - lib/hangouts-chat/http.rb
21
- - lib/hangouts-chat/version.rb
49
+ - lib/hangouts_chat.rb
50
+ - lib/hangouts_chat/http.rb
51
+ - lib/hangouts_chat/version.rb
52
+ - test/hangouts-chat/http_test.rb
53
+ - test/hangouts_chat_test.rb
54
+ - test/test_helper.rb
22
55
  homepage: https://github.com/enzinia/hangouts-chat
23
56
  licenses:
24
57
  - MIT
@@ -42,5 +75,8 @@ rubyforge_project:
42
75
  rubygems_version: 2.7.4
43
76
  signing_key:
44
77
  specification_version: 4
45
- summary: Send messages to Hangouts Chat rooms using incoming webhooks
46
- test_files: []
78
+ summary: Library for sending messages to Hangouts Chat rooms
79
+ test_files:
80
+ - test/hangouts-chat/http_test.rb
81
+ - test/hangouts_chat_test.rb
82
+ - test/test_helper.rb
@@ -1,3 +0,0 @@
1
- module HangoutsChat
2
- VERSION = '0.0.1'
3
- end