epoch_api 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/epoch_api/capistrano.rb +3 -3
- data/lib/epoch_api/version.rb +1 -1
- data/lib/epoch_api.rb +4 -20
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjAzYzM3NWM3NTY4Yjc4OTAwNWE0ZDQ2M2U1NmZlZGFlOTM2ZmQyNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzE2MjY2NzBkODRjNDg5NzNkNzU2YWMzZGNkMjI4ZmYxYmY3MjY1Mw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjVkOTljNGJiYWQ5ZGI0ZGQ2ZTI5NjM1ZDg1NjFhZWQ5MDBiNWQ2M2VjMDdm
|
10
|
+
YzIwOGY2YTQ4ZDAxMmQ0YTYyODc1MDZkYTRhZGIwYWIwY2IxZTBiOWIxMmQ1
|
11
|
+
ODU5MWRiM2VmNTIxMzU0MjljYmZlMzlmOWQ1MWU1ODNjODQzYjA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZmJlNmIwNTM1NDU3ZGJlNTVkZDk0ODkyZTQ2NmIzN2U4MmY3M2IzMTczMzQ1
|
14
|
+
M2I3MjgzNmRiNzc0ODgzOTMxMTY5MDE5YjdjYjc4N2U1YjE0OWRjZWUyNjQz
|
15
|
+
ODczNmU1MGFhZTg1Y2U2ZDI3NDU4NmU3NjdjZThkZWI1NmRkMzU=
|
data/lib/epoch_api/capistrano.rb
CHANGED
@@ -35,7 +35,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
35
35
|
environment_string = "#{stage} (#{env})" if self.respond_to?(:stage)
|
36
36
|
location = "#{deployment_name} to #{environment_string}"
|
37
37
|
|
38
|
-
send "#{human} finished deploying #{location}#{fetch(:epoch_with_migrations, '')}.", send_options
|
38
|
+
send "#{human} finished deploying #{location}#{fetch(:epoch_with_migrations, '')}.", send_options
|
39
39
|
end
|
40
40
|
|
41
41
|
def send_options
|
@@ -48,11 +48,11 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
48
48
|
|
49
49
|
def send message, options
|
50
50
|
if fetch(:epoch_client, nil).nil?
|
51
|
-
set :epoch_client, EpochApi::Client.new
|
51
|
+
set :epoch_client, EpochApi::Client.new(epoch_token)
|
52
52
|
end
|
53
53
|
|
54
54
|
begin
|
55
|
-
epoch_client.message
|
55
|
+
epoch_client.message epoch_room_name, deploy_user, message, options
|
56
56
|
rescue => e
|
57
57
|
puts e.message
|
58
58
|
puts e.backtrace
|
data/lib/epoch_api/version.rb
CHANGED
data/lib/epoch_api.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'httparty'
|
2
|
-
require 'ostruct'
|
3
2
|
require 'epoch_api/version'
|
4
3
|
|
5
4
|
module EpochApi
|
@@ -19,39 +18,24 @@ module EpochApi
|
|
19
18
|
self
|
20
19
|
end
|
21
20
|
|
22
|
-
def message
|
21
|
+
def message room_id, from, message, options = {color: 'yellow', notify: false}
|
23
22
|
err_msg = "Username #{from} is `#{from.length} characters long. Limit is 15'"
|
24
23
|
raise UsernameTooLong, err_msg if from.length > 15
|
25
24
|
|
26
25
|
response = self.class.put "/#{room_id}/message",
|
27
|
-
query: { auth_token: @token },
|
28
26
|
body: {
|
29
27
|
from: from,
|
30
28
|
message: message,
|
31
29
|
color: options[:color],
|
32
|
-
notify: options[:notify] ? 1 : 0 }
|
30
|
+
notify: options[:notify] ? 1 : 0 },
|
31
|
+
headers: { "Authorization" => "Token token=#{@token}"}
|
33
32
|
|
34
|
-
_response response
|
35
|
-
end
|
36
|
-
|
37
|
-
def topic new_topic, options = {from: 'API'}
|
38
|
-
|
39
|
-
response = self.class.put "/#{room_id}/topic",
|
40
|
-
query: { auth_token: @token },
|
41
|
-
body: {
|
42
|
-
from: options[:from],
|
43
|
-
topic: new_topic}
|
44
|
-
|
45
|
-
_response response
|
46
|
-
end
|
47
|
-
|
48
|
-
def _response response
|
49
33
|
case response.code
|
50
34
|
when 200 then response.body
|
51
35
|
when 404 then raise UnknownRoom , "Unknown room: `#{room_id}'"
|
52
36
|
when 401 then raise Unauthorized , "Access denied to room `#{room_id}'"
|
53
37
|
else; raise UnknownResponseCode, "Unexpected #{response.code} for room `#{room_id}'"
|
54
38
|
end
|
55
|
-
|
39
|
+
end
|
56
40
|
end
|
57
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epoch_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Monsterbox Productions
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|