-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from lsmolic/feature/refactor
feature/refactor
- Loading branch information
Showing
10 changed files
with
4,668 additions
and
98 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
require "bundler/gem_tasks" | ||
require "rake/testtask" | ||
require 'bundler/gem_tasks' | ||
require 'rake/testtask' | ||
|
||
def load_libs(t) | ||
t.libs << "test" | ||
t.libs << "lib" | ||
def load_libs(rake_task) | ||
rake_task.libs << 'test' | ||
rake_task.libs << 'lib' | ||
end | ||
|
||
Rake::TestTask.new(:test) do |t| | ||
load_libs t | ||
t.test_files = FileList['test/**/*-test.rb'] | ||
Rake::TestTask.new(:test) do |rake_task| | ||
load_libs rake_task | ||
rake_task.test_files = FileList['test/**/*-test.rb'] | ||
end | ||
|
||
Rake::TestTask.new(:manual_test) do |t| | ||
load_libs t | ||
t.test_files = FileList['manual_test.rb'] | ||
Rake::TestTask.new(:getting_started) do |rake_task| | ||
load_libs rake_task | ||
rake_task.test_files = FileList['examples/getting_started.rb'] | ||
end | ||
|
||
task :default => :test | ||
task default: :test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'exponent-server-sdk' | ||
|
||
class Test | ||
def initialize | ||
# @client = Exponent::Push::Client.new | ||
|
||
# OR use GZIP to be AWESOME | ||
@client = Exponent::Push::Client.new(gzip: true) | ||
end | ||
|
||
def too_many_messages | ||
(0..101).map { create_message } | ||
end | ||
|
||
def create_message | ||
{ | ||
# REPLACE WITH YOUR EXPONENT PUSH TOKEN LIKE: | ||
# to: 'ExponentPushToken[g5sIEbOm2yFdzn5VdSSy9n]', | ||
to: "ExponentPushToken[#{(0...22).map { ('a'..'z').to_a[rand(26)] }.join}]", | ||
sound: 'default', | ||
title: 'Hello World', | ||
subtitle: 'This is a Push Notification', | ||
body: 'Here\'s a little message for you...', | ||
data: { | ||
user_id: 1, | ||
points: 23_434 | ||
}, | ||
ttl: 10, | ||
expiration: 1_886_207_332, | ||
priority: 'default', | ||
badge: 0, | ||
channelId: 'game' | ||
} | ||
end | ||
|
||
def test | ||
# messages = too_many_messages | ||
messages = [create_message] | ||
|
||
response_handler = @client.send_messages(messages) | ||
puts response_handler.response.response_body | ||
end | ||
end | ||
|
||
Test.new.test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.