Class: Firetruck::API
- Inherits:
-
Object
- Object
- Firetruck::API
- Defined in:
- lib/firetruck.rb
Class Method Summary collapse
- .ambulance(key, message, priority = 9) ⇒ Object
- .firetruck(key, message, priority = 3) ⇒ Object
- .firetruck!(key, message, priority = 5) ⇒ Object
- .squadcar(key, message, priority = 7) ⇒ Object
Instance Method Summary collapse
Class Method Details
.ambulance(key, message, priority = 9) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/firetruck.rb', line 26 def self.ambulance(key, , priority = 9) #these are mission critical to the server, treat with 9 type = "ambulance" @response = self.post!(key, , priority) return @response.code end |
.firetruck(key, message, priority = 3) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/firetruck.rb', line 12 def self.firetruck(key, , priority = 3) #standard priority type = "firetruck" @response = self.post!(key, , priority) return @response.code end |
.firetruck!(key, message, priority = 5) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/firetruck.rb', line 5 def self.firetruck!(key, , priority = 5) #superhigh type = "firetruck" @response = self.post!(key, , priority) return @response.code end |
.squadcar(key, message, priority = 7) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/firetruck.rb', line 19 def self.squadcar(key, , priority = 7) #these are mission critical type = "squadcar" @response = self.post!(key, , priority) return @response.code end |
Instance Method Details
#post!(key, message, priority) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/firetruck.rb', line 33 def post!(key, , priority) @endpoint = "http://firetruckapp.com" payload = JSON.generate( hpl = { :key => key, :message => , :priority => priority, :time => Time.now.getutc.to_s } ) response = HTTParty.post("#{endpoint}/endpoint", { :payload => payload }) return response end |