epoch_api 0.1.0 → 0.1.1

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzQyMTg2MmM5NjMwOWRkYTAwYzFiN2VlZjg1MjRiNTk1MGZiY2Y1Mw==
4
+ NjAzYzM3NWM3NTY4Yjc4OTAwNWE0ZDQ2M2U1NmZlZGFlOTM2ZmQyNw==
5
5
  data.tar.gz: !binary |-
6
- NWRjY2FiMzY0MzRlZGQyZDE2ZDkzZTQ1NDA5YmJkZjUxYmQ3ZDJkNw==
6
+ MzE2MjY2NzBkODRjNDg5NzNkNzU2YWMzZGNkMjI4ZmYxYmY3MjY1Mw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZGRlODQwODRjNTAyZDkzNDhjZDQxZGY3OGU0YWQ3M2JkZTczNWY2ZDRlZWIy
10
- ZTY1ODdiMzdmOTE4ODJlMzJhZjcwZDBiODk1ZTk5OGQ4MzVlMjQ5NGNhOWI0
11
- NmI2MDY2YmM4MmRiZjFjZTNiYWE4MWJkYThiNTRjYzgwOTQ1YmU=
9
+ NjVkOTljNGJiYWQ5ZGI0ZGQ2ZTI5NjM1ZDg1NjFhZWQ5MDBiNWQ2M2VjMDdm
10
+ YzIwOGY2YTQ4ZDAxMmQ0YTYyODc1MDZkYTRhZGIwYWIwY2IxZTBiOWIxMmQ1
11
+ ODU5MWRiM2VmNTIxMzU0MjljYmZlMzlmOWQ1MWU1ODNjODQzYjA=
12
12
  data.tar.gz: !binary |-
13
- Y2U4YWM2YzA0NzEyNmE3MjA1OGM1MzI2OGIxNjYxZGUxMGQyNjQ4MzZlZmQ0
14
- YzAyZmFmYzExOGEwODc5YWEzNjc1ZTkzYzBlMTI1ZjMxODQ4MmY4YjE5MmFl
15
- MTEzYjYyNjM0M2M2YzA4OWE5ZDUxMzg2YTQ4ZmMyYTQyMDVkYjg=
13
+ ZmJlNmIwNTM1NDU3ZGJlNTVkZDk0ODkyZTQ2NmIzN2U4MmY3M2IzMTczMzQ1
14
+ M2I3MjgzNmRiNzc0ODgzOTMxMTY5MDE5YjdjYjc4N2U1YjE0OWRjZWUyNjQz
15
+ ODczNmU1MGFhZTg1Y2U2ZDI3NDU4NmU3NjdjZThkZWI1NmRkMzU=
@@ -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 epoch_token
51
+ set :epoch_client, EpochApi::Client.new(epoch_token)
52
52
  end
53
53
 
54
54
  begin
55
- epoch_client.message epoch_room_token, deploy_user, message, options
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
@@ -1,3 +1,3 @@
1
1
  module EpochApi
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
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 room_token, from, message, options = {color: 'yellow', notify: false}
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
- end
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.0
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-13 00:00:00.000000000 Z
11
+ date: 2013-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty