glip-rb 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.
- data/lib/glip.rb +39 -0
- data/lib/glip/version.rb +3 -0
- metadata +4 -9
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -22
- data/README.md +0 -38
- data/Rakefile +0 -1
- data/glip.gemspec +0 -25
data/lib/glip.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
require "glip/version"
|
5
|
+
|
6
|
+
module Glip
|
7
|
+
class Room
|
8
|
+
include HTTParty
|
9
|
+
|
10
|
+
def initialize(options = {})
|
11
|
+
default_options = {
|
12
|
+
:api_url => 'https://hooks.glip.com',
|
13
|
+
:room_id => ''
|
14
|
+
}
|
15
|
+
options = default_options.merge options
|
16
|
+
url = options[:api_url] + '/webhook/' + options[:room_id]
|
17
|
+
url = options[:full_url] if options[:full_url]
|
18
|
+
self.class.base_uri url
|
19
|
+
end
|
20
|
+
|
21
|
+
def post(options = {})
|
22
|
+
body = {
|
23
|
+
:icon => 'http://www.redmine.org/attachments/download/3462/redmine_fluid_icon.png',
|
24
|
+
:activity => 'Redmine',
|
25
|
+
:title => 'Something happened on Redmine',
|
26
|
+
:body => 'Check Redmine'
|
27
|
+
}.merge options
|
28
|
+
response = self.class.post('',
|
29
|
+
:headers => { 'Content-Type' => 'application/json' },
|
30
|
+
:body => body.to_json )
|
31
|
+
case response.code
|
32
|
+
when 200,204
|
33
|
+
true
|
34
|
+
else
|
35
|
+
raise "#{response.message} (#{response.code})"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/glip/version.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glip-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-07-
|
12
|
+
date: 2015-07-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -66,12 +66,8 @@ executables: []
|
|
66
66
|
extensions: []
|
67
67
|
extra_rdoc_files: []
|
68
68
|
files:
|
69
|
-
-
|
70
|
-
- glip
|
71
|
-
- glip.gemspec
|
72
|
-
- LICENSE.txt
|
73
|
-
- Rakefile
|
74
|
-
- README.md
|
69
|
+
- lib/glip.rb
|
70
|
+
- lib/glip/version.rb
|
75
71
|
homepage: https://github.com/twinklebob/glip-rb
|
76
72
|
licenses:
|
77
73
|
- MIT
|
@@ -98,4 +94,3 @@ signing_key:
|
|
98
94
|
specification_version: 3
|
99
95
|
summary: Ruby library to post messages to glip.com room
|
100
96
|
test_files: []
|
101
|
-
has_rdoc:
|
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2013 JLarky
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# Glip
|
2
|
-
|
3
|
-
Library that will allow you to post messages to [glip](https://glip.com) room.
|
4
|
-
|
5
|
-
No API to read room history at the moment.
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
gem 'glip-rb'
|
12
|
-
|
13
|
-
And then execute:
|
14
|
-
|
15
|
-
$ bundle
|
16
|
-
|
17
|
-
Or install it yourself as:
|
18
|
-
|
19
|
-
$ gem install glip-rb
|
20
|
-
|
21
|
-
## Usage
|
22
|
-
|
23
|
-
Go to your room integrations page, search for "HTTP POST" integration, make
|
24
|
-
sure you have switched it **on**, use Room ID provided at that page instead of
|
25
|
-
`room_id` in instructions below:
|
26
|
-
|
27
|
-
require 'glip'
|
28
|
-
|
29
|
-
room = Glip::Room.new("room_id")
|
30
|
-
room.post("Andrei", "Hello **world**", {:color => "green", :renderer => "markdown"})
|
31
|
-
|
32
|
-
## Contributing
|
33
|
-
|
34
|
-
1. Fork it
|
35
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
36
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
37
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
38
|
-
5. Create new Pull Request
|
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
data/glip.gemspec
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'glip/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "glip-rb"
|
8
|
-
spec.version = Glip::VERSION
|
9
|
-
spec.authors = ["DLumm"]
|
10
|
-
spec.email = ["david.lumm@twinklebob.co.uk"]
|
11
|
-
spec.description = %q{Ruby library to post messages to glip.com room}
|
12
|
-
spec.summary = %q{Ruby library to post messages to glip.com room}
|
13
|
-
spec.homepage = "https://github.com/twinklebob/glip-rb"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.files = Dir['lib/ *.rb'] + Dir['bin/*']
|
17
|
-
spec.files += Dir['[A-Z]*'] + Dir['test/**/*']
|
18
|
-
spec.files.reject! { |fn| fn.include? "CVS" }
|
19
|
-
spec.require_paths = ["lib"]
|
20
|
-
|
21
|
-
spec.add_dependency "httparty"
|
22
|
-
|
23
|
-
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
-
spec.add_development_dependency "rake"
|
25
|
-
end
|