class Rpush::Daemon::Wns::ToastRequest

Public Class Methods

create(notification, access_token) click to toggle source
# File lib/rpush/daemon/wns/toast_request.rb, line 5
def self.create(notification, access_token)
  body = ToastRequestPayload.new(notification).to_xml
  uri  = URI.parse(notification.uri)
  post = Net::HTTP::Post.new(
    uri.request_uri,
    "Content-Length" => body.length.to_s,
    "Content-Type" => "text/xml",
    "X-WNS-Type" => "wns/toast",
    "X-WNS-RequestForStatus" => "true",
    "Authorization" => "Bearer #{access_token}"
  )
  post.body = body
  post
end