firetruck 0.2 → 0.3

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.
Files changed (2) hide show
  1. data/lib/firetruck.rb +17 -6
  2. metadata +1 -1
data/lib/firetruck.rb CHANGED
@@ -2,28 +2,39 @@ require "httparty"
2
2
  require "json"
3
3
  module Firetruck
4
4
  class API
5
- def self.firetruck!(key, message, priority = 7)
5
+ def self.firetruck!(key, message, priority = 5)
6
6
  #superhigh
7
7
  type = "firetruck"
8
- self.post!(key, message, priority)
8
+ @response = self.post!(key, message, priority)
9
+ return @response.code
9
10
  end
10
11
 
11
12
  def self.firetruck(key, message, priority = 3)
12
13
  #standard priority
13
14
  type = "firetruck"
14
- self.post!(key, message, priority)
15
+ @response = self.post!(key, message, priority)
16
+ return @response.code
15
17
  end
16
18
 
17
- def self.squadcar(key, message, priority = 10)
19
+ def self.squadcar(key, message, priority = 7)
18
20
  #these are mission critical
19
21
  type = "squadcar"
20
- self.post!(key, message, priority)
22
+ @response = self.post!(key, message, priority)
23
+ return @response.code
24
+ end
25
+
26
+ def self.ambulance(key, message, priority = 9)
27
+ #these are mission critical to the server, treat with 9
28
+ type = "ambulance"
29
+ @response = self.post!(key, message, priority)
30
+ return @response.code
21
31
  end
22
32
 
23
33
  def post!(key, message, priority)
24
34
  @endpoint = "http://firetruckapp.com"
25
35
  payload = JSON.generate( hpl = { :key => key, :message => message, :priority => priority, :time => Time.now.getutc.to_s } )
26
- HTTParty.post("#{endpoint}/endpoint", { :payload => payload })
36
+ response = HTTParty.post("#{endpoint}/endpoint", { :payload => payload })
37
+ return response
27
38
  end
28
39
  end
29
40
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: firetruck
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: "0.2"
5
+ version: "0.3"
6
6
  platform: ruby
7
7
  authors:
8
8
  - Luke Carpenter