app/controllers/posts_controller.rb
#Pushes the token and the post message to account server.
Pushes the token and the post message to account server.
Pushes the token and the post message to account server .
def send_mail
  		pathPushMail = '/applications/push-to-subscribers/1'
  		link = Rails.application.config.account_ip + pathPushMail
  		url = URI.parse(link)
  		http = Net::HTTP.new(url.host, url.port)
  		http.use_ssl = true
  		req = Net::HTTP::Get.new(url.path)
  		req.add_field('Authorization', 'Token token=' + Rails.application.secrets.push_mail_token)
  		req.add_field('push_message', @post.body)
  		req.add_field('push_title', @post.title)
  		req.add_field('push_url',post_url(@post))
  		req.add_field('push_url_title', @post.title)
  		response = http.request(req)
   	end
def send_mail pathPushMail = '/applications/push-to-subscribers/1' link = Rails . application . config . account_ip + pathPushMail url = URI . parse ( link ) http = Net :: HTTP . new ( url . host , url . port ) http . use_ssl = true req = Net :: HTTP :: Get . new ( url . path ) req . add_field ( 'Authorization' , 'Token token=' + Rails . application . secrets . push_mail_token ) req . add_field ( 'push_message' , @post . body ) req . add_field ( 'push_title' , @post . title ) req . add_field ( 'push_url' , post_url ( @post ) ) req . add_field ( 'push_url_title' , @post . title ) response = http . request ( req ) end
Pushes the token and the post message to account server.
Pushes the token and the post message to account server .