hall 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/.travis.yml +6 -0
- data/README.md +16 -7
- data/hall.gemspec +5 -5
- data/lib/hall.rb +13 -7
- data/lib/hall/version.rb +1 -1
- data/spec/hall_spec.rb +20 -5
- metadata +12 -12
- data/spec/spec.opts +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4267256e6d54bf69f34843a17197f763d86906fe
|
4
|
+
data.tar.gz: 483ad8f9ae7d1993226ff1f89625524575745d35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 933a39e6bbe7d46fbc64d2fc330a0539c4b299136b853bd089ea27d7b40efcd5cd578ec9167033bd0c5118902630e91c80bab7e9626193bc181c3932b302b2a4
|
7
|
+
data.tar.gz: c9664ed1ddde9e3fdf5bab20d1bd4911c8fc318a332cdc79aaddb06b24384fa0fe7d166a03a265d8f0761859cbf652c9ff77afbedba6b33398d190f9f296c61b
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,12 +1,7 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/a-b/hall.png?branch=master)](https://travis-ci.org/a-b/hall)
|
1
2
|
# Hall
|
2
3
|
|
3
|
-
Simple client for corporate chat Hall.com
|
4
|
-
|
5
|
-
## TODO
|
6
|
-
|
7
|
-
1. Extract config
|
8
|
-
2. Cleanup
|
9
|
-
3. Add tests
|
4
|
+
Simple client for corporate chat [Hall.com](https://hall.com)
|
10
5
|
|
11
6
|
## Installation
|
12
7
|
|
@@ -24,10 +19,24 @@ Or install it yourself as:
|
|
24
19
|
|
25
20
|
## Usage
|
26
21
|
|
22
|
+
```ruby
|
23
|
+
|
27
24
|
require 'hall'
|
25
|
+
|
26
|
+
# Grab your room token at https://hall.com/docs/integrations/generic/
|
27
|
+
|
28
28
|
hall = Hall::Client.new('room token goes here', 'integration name')
|
29
29
|
hall.post_message 'my message'
|
30
30
|
|
31
|
+
```
|
32
|
+
|
33
|
+
## TODO
|
34
|
+
|
35
|
+
1. Add html message support
|
36
|
+
2. Add picture support *done*
|
37
|
+
3. Add Rake task (require configuration)
|
38
|
+
4. Add Capistrano
|
39
|
+
|
31
40
|
## Contributing
|
32
41
|
|
33
42
|
1. Fork it
|
data/hall.gemspec
CHANGED
@@ -24,9 +24,9 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
25
25
|
|
26
26
|
#Test stuff
|
27
|
-
spec.add_development_dependency "rspec"
|
28
|
-
spec.add_development_dependency "rr"
|
29
|
-
spec.add_development_dependency "webmock", "1.8.0"
|
30
|
-
spec.add_development_dependency "vcr"
|
31
|
-
spec.add_development_dependency "rdoc",
|
27
|
+
spec.add_development_dependency "rspec", ">= 2.14"
|
28
|
+
spec.add_development_dependency "rr", ">= 1.1.2"
|
29
|
+
spec.add_development_dependency "webmock", "1.8.0" # blocked by vcr
|
30
|
+
spec.add_development_dependency "vcr", ">= 2.7.0"
|
31
|
+
spec.add_development_dependency "rdoc", ">= 2.4.2"
|
32
32
|
end
|
data/lib/hall.rb
CHANGED
@@ -19,10 +19,13 @@ module Hall
|
|
19
19
|
#
|
20
20
|
# +from_name+:: defines the name used for message posting
|
21
21
|
#
|
22
|
+
# +from_picture+:: optional add picture to the post
|
23
|
+
#
|
22
24
|
|
23
|
-
def initialize(room_token, from_name)
|
24
|
-
@room_token
|
25
|
-
@from_name
|
25
|
+
def initialize(room_token, from_name, from_picture = nil)
|
26
|
+
@room_token = room_token
|
27
|
+
@from_name = from_name
|
28
|
+
@from_picture = from_picture
|
26
29
|
end
|
27
30
|
|
28
31
|
# Post a message.
|
@@ -38,13 +41,12 @@ module Hall
|
|
38
41
|
|
39
42
|
def post_message(text)
|
40
43
|
body ={
|
41
|
-
"title"
|
44
|
+
"title" => @from_name,
|
45
|
+
"picture" => @from_picture,
|
42
46
|
"message" => text
|
43
47
|
}
|
44
48
|
|
45
|
-
|
46
|
-
|
47
|
-
self.class.post(room_path, options)
|
49
|
+
self.class.post(room_path, request_options(body))
|
48
50
|
end
|
49
51
|
|
50
52
|
private
|
@@ -52,5 +54,9 @@ module Hall
|
|
52
54
|
def room_path
|
53
55
|
'/services/generic/' + @room_token
|
54
56
|
end
|
57
|
+
|
58
|
+
def request_options(body)
|
59
|
+
{body: body, options: { headers: { 'ContentType' => 'application/json' } } }
|
60
|
+
end
|
55
61
|
end
|
56
62
|
end
|
data/lib/hall/version.rb
CHANGED
data/spec/hall_spec.rb
CHANGED
@@ -1,12 +1,27 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
3
|
describe Hall do
|
4
|
-
subject { Hall::Client.new("fake_room_token", "form_name") }
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
context 'with picture' do
|
6
|
+
#let(:hall_client) { Hall::Client.new("fake_room_token", "form_name", "http://www.mycompany.com/images/plant_icon.png") }
|
7
|
+
|
8
|
+
#describe '#post_message' do
|
9
|
+
#it 'shold successfully post a message' do
|
10
|
+
#VCR.use_cassette('hall_api', :record => :once) do
|
11
|
+
#hall_client.post_message('my text').response.code.should eq "201"
|
12
|
+
#end
|
13
|
+
#end
|
14
|
+
#end
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'without picture' do
|
18
|
+
let(:hall_client) { Hall::Client.new("fake_room_token", "form_name") }
|
19
|
+
|
20
|
+
describe '#post_message' do
|
21
|
+
it 'shold successfully post a message' do
|
22
|
+
VCR.use_cassette('hall_api') do
|
23
|
+
hall_client.post_message('my text').response.code.should eq "201"
|
24
|
+
end
|
10
25
|
end
|
11
26
|
end
|
12
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Berezovsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -58,28 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '2.14'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '2.14'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rr
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 1.1.2
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 1.1.2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: webmock
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,26 +100,26 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 2.7.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 2.7.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rdoc
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - '
|
115
|
+
- - '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: 2.4.2
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - '
|
122
|
+
- - '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 2.4.2
|
125
125
|
description: Client for corporate messanger Hall
|
@@ -130,6 +130,8 @@ extensions: []
|
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
132
|
- .gitignore
|
133
|
+
- .rspec
|
134
|
+
- .travis.yml
|
133
135
|
- Gemfile
|
134
136
|
- LICENSE
|
135
137
|
- LICENSE.txt
|
@@ -140,7 +142,6 @@ files:
|
|
140
142
|
- lib/hall.rb
|
141
143
|
- lib/hall/version.rb
|
142
144
|
- spec/hall_spec.rb
|
143
|
-
- spec/spec.opts
|
144
145
|
- spec/spec_helper.rb
|
145
146
|
homepage: https://github.com/a-b/hall
|
146
147
|
licenses:
|
@@ -169,5 +170,4 @@ summary: Client for corporate messanger Hall.com allow to post message to the ch
|
|
169
170
|
room
|
170
171
|
test_files:
|
171
172
|
- spec/hall_spec.rb
|
172
|
-
- spec/spec.opts
|
173
173
|
- spec/spec_helper.rb
|
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|