Skip to content

Commit 4124205

Browse files
author
Jon Elverkilde
authored
Merge pull request #151 from pusher/remove-push-notif
remove native push notifications
2 parents 35d2c6f + d5782b2 commit 4124205

File tree

4 files changed

+0
-152
lines changed

4 files changed

+0
-152
lines changed

lib/pusher.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,3 @@ def default_client
6666
require 'pusher/request'
6767
require 'pusher/resource'
6868
require 'pusher/webhook'
69-
require 'pusher/native_notification/client'

lib/pusher/client.rb

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -330,24 +330,6 @@ def trigger_batch_async(*events)
330330
post_async('/batch_events', trigger_batch_params(events.flatten))
331331
end
332332

333-
def notification_client
334-
@notification_client ||=
335-
NativeNotification::Client.new(@app_id, @notification_host, @notification_scheme, self)
336-
end
337-
338-
339-
# Send a push notification
340-
#
341-
# POST /apps/[app_id]/notifications
342-
#
343-
# @param interests [Array] An array of interests
344-
# @param message [String] Message to send
345-
# @param options [Hash] Additional platform specific options
346-
#
347-
# @return [Hash]
348-
def notify(interests, data = {})
349-
notification_client.notify(interests, data)
350-
end
351333

352334
# Generate the expected response for an authentication endpoint.
353335
# See http://pusher.com/docs/authenticating_users for details.

lib/pusher/native_notification/client.rb

Lines changed: 0 additions & 69 deletions
This file was deleted.

spec/client_spec.rb

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -697,70 +697,6 @@
697697
end
698698
end
699699
end
700-
701-
describe "native notifications" do
702-
before :each do
703-
@client.app_id = "20"
704-
@client.key = "testytest"
705-
@client.secret = "mysupersecretkey"
706-
end
707-
708-
it "should configure a native notification client using the pusher client object" do
709-
expect(@client.notification_client).to_not be(nil)
710-
end
711-
712-
it "should use the default host if not provided" do
713-
expect(@client.notification_host).to eq("nativepush-cluster1.pusher.com")
714-
end
715-
716-
it "should use a newly provided host" do
717-
@client.notification_host = "test.com"
718-
expect(@client.notification_host).to eq("test.com")
719-
end
720-
721-
it "should set the native notification client host to the same one" do
722-
expect(@client.notification_host).to eq(@client.notification_client.host)
723-
end
724-
725-
it "should raise an error if no interest is provided" do
726-
payload = {
727-
gcm: {
728-
notification: {
729-
title: "Hello",
730-
icon: "icon",
731-
}
732-
}
733-
}
734-
735-
expect { @client.notify([], payload) }.to raise_error(Pusher::Error)
736-
end
737-
738-
it "should send a request to the notifications endpoint" do
739-
notification_host_regexp = %r{nativepush-cluster1.pusher.com}
740-
payload = {
741-
interests: ["test"],
742-
gcm: {
743-
notification: {
744-
title: "Hello",
745-
icon: "icon",
746-
}
747-
}
748-
}
749-
750-
stub_request(
751-
:post,
752-
notification_host_regexp,
753-
).with(
754-
body: MultiJson.encode(payload)
755-
).to_return({
756-
:status => 200,
757-
:body => MultiJson.encode({ :foo => "bar" })
758-
})
759-
760-
res = @client.notify(["test"], payload)
761-
expect(res).to eq({foo: "bar"})
762-
end
763-
end
764700
end
765701

766702
describe 'configuring cluster' do

0 commit comments

Comments
 (0)