hall 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 +4 -4
- data/Gemfile +1 -1
- data/README.md +9 -1
- data/hall.gemspec +1 -0
- data/lib/hall/version.rb +1 -1
- data/lib/hall.rb +20 -14
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f36c7ed8cd6b4267dd38d5607e6b47146920e04
|
4
|
+
data.tar.gz: f69bd15535698e5b5bee050abfb7b5e4c22d53af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e15eab98f395d7be86382515f66a14682a259d036aac6bcf5c87d873b986f55a12e93edf7be777e6e710836529441e063e5bcd72137a8b491ee01674cb87539
|
7
|
+
data.tar.gz: 14d98eee85db76c9b5d754f44fd081932037a3dc76f231700067a6cfdf41308b69b3b68a4ae0a0ad90926b8f61ecedabdbcdbb8ac91c056b059d80bed75e066e
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
Simple client for corporate chat Hall.com
|
4
4
|
|
5
|
+
## TODO
|
6
|
+
|
7
|
+
1. Extract config
|
8
|
+
2. Cleanup
|
9
|
+
3. Add tests
|
10
|
+
|
5
11
|
## Installation
|
6
12
|
|
7
13
|
Add this line to your application's Gemfile:
|
@@ -18,7 +24,9 @@ Or install it yourself as:
|
|
18
24
|
|
19
25
|
## Usage
|
20
26
|
|
21
|
-
|
27
|
+
require 'hall'
|
28
|
+
hall = Hall::Client.new('room token goes here', 'integration name')
|
29
|
+
hall.post_message 'my message'
|
22
30
|
|
23
31
|
## Contributing
|
24
32
|
|
data/hall.gemspec
CHANGED
data/lib/hall/version.rb
CHANGED
data/lib/hall.rb
CHANGED
@@ -1,26 +1,32 @@
|
|
1
1
|
require "hall/version"
|
2
|
-
require "
|
2
|
+
require "httparty"
|
3
3
|
|
4
4
|
module Hall
|
5
|
-
def self.message(msg_text)
|
6
5
|
|
7
|
-
|
8
|
-
|
6
|
+
class Client
|
7
|
+
include HTTParty
|
8
|
+
base_uri 'https://hall.com/api/1/'
|
9
|
+
|
10
|
+
def initialize(room_token, integration_name)
|
11
|
+
@room_token = room_token
|
12
|
+
@integration_name = integration_name
|
9
13
|
end
|
10
14
|
|
11
|
-
|
12
|
-
|
15
|
+
def post_message(text)
|
16
|
+
body ={
|
17
|
+
"title" => @integration_name,
|
18
|
+
"message" => text
|
19
|
+
}
|
13
20
|
|
14
|
-
|
15
|
-
"title" => HALL_INTEGRATION_NAME,
|
16
|
-
"message" => msg_text
|
17
|
-
}
|
21
|
+
options = {body: body, options: { headers: { 'ContentType' => 'application/json' } } }
|
18
22
|
|
19
|
-
|
20
|
-
req.url "/api/1/services/generic/" + HALL_ROOM_TOKEN
|
21
|
-
req.headers['Content-Type'] = 'application/json'
|
22
|
-
req.body = doc.to_json
|
23
|
+
self.class.post(room_path, options)
|
23
24
|
end
|
24
25
|
|
26
|
+
private
|
27
|
+
|
28
|
+
def room_path
|
29
|
+
'/services/generic/' + @room_token
|
30
|
+
end
|
25
31
|
end
|
26
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hall
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Berezovsky
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: httparty
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: Client for corporate messanger Hall
|
42
56
|
email:
|
43
57
|
- a.b@usa.com
|