module Repro::Client::Push

Public Instance Methods

push(push_id, user_ids, options={}) click to toggle source
# File lib/repro/client/push.rb, line 6
def push(push_id, user_ids, options={})
  post(push_endpoint, push_path(push_id), push_payload(user_ids, options))
end
push_endpoint() click to toggle source
# File lib/repro/client/push.rb, line 10
def push_endpoint
  "https://marketing.repro.io"
end
push_path(push_id) click to toggle source
# File lib/repro/client/push.rb, line 14
def push_path(push_id)
  "/v1/push/#{push_id}/deliver"
end
push_payload(user_ids, notification) click to toggle source
# File lib/repro/client/push.rb, line 18
def push_payload(user_ids, notification)
  custom_payload = notification.delete(:custom_payload)

  {
    audience: { user_ids: user_ids },
    notification: custom_payload ? { custom_payload: custom_payload } : notification
  }
end