Guest User

Untitled

a guest
Apr 20th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. class User < ActiveRecord::Base
  2. after_commit :register_rdstation_event, on: :create
  3.  
  4. def register_rdstation_event
  5. rd = RdstationService.initialize
  6. rd.send_data('simulado-saraiva-oab-cadastro', self)
  7. end
  8.  
  9. end
  10.  
  11.  
  12. class RdstationService
  13. def self.initialize
  14. @client = RDStation::Client.new(
  15. Rails.application.secrets.rdstation_token,
  16. Rails.application.secrets.rdstation_auth
  17. )
  18. self
  19. end
  20.  
  21. def self.send_data(event, user)
  22. {
  23. identificador: 'simulado-saraiva-oab-cadastro',
  24. email: user.email,
  25. nome: user.name
  26. }
  27. end
  28. end
Add Comment
Please, Sign In to add comment