Class: NotificationServices::HoiioService

Inherits:
NotificationService
  • Object
show all
Defined in:
app/models/notification_services/hoiio_service.rb

Constant Summary collapse

Label =
"hoiio"

Instance Method Summary collapse

Instance Method Details

#check_paramsObject


18
19
20
21
22
# File 'app/models/notification_services/hoiio_service.rb', line 18

def check_params
  if Fields.detect {|f| self[f[0]].blank? }
    errors.add :base, 'You must specify your App ID, Access Token and Recipient\'s phone numbers'
  end
end

#create_notification(problem) ⇒ Object


32
33
34
35
36
37
38
39
40
41
# File 'app/models/notification_services/hoiio_service.rb', line 32

def create_notification(problem)
  # build the hoi client
  sms = Hoi::SMS.new(api_token, subdomain)

  # send sms
  room_id.split(',').each do |number|
    sms.send :dest => number, :msg => "#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id.to_s} #{notification_description problem}"
  end

end

#notification_description(problem) ⇒ Object


28
29
30
# File 'app/models/notification_services/hoiio_service.rb', line 28

def notification_description(problem)
  "[#{ problem.environment }]#{problem.message.to_s.truncate(50)}"
end

#urlObject


24
25
26
# File 'app/models/notification_services/hoiio_service.rb', line 24

def url
  "https://secure.hoiio.com/user/"
end