jpush 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.project +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +339 -0
- data/README.md +75 -0
- data/Rakefile +1 -0
- data/example/push_example.rb +101 -0
- data/example/report_example.rb +18 -0
- data/jpush.gemspec +24 -0
- data/lib/jpush.rb +20 -0
- data/lib/jpush/http_client.rb +124 -0
- data/lib/jpush/jpush_client.rb +75 -0
- data/lib/jpush/model/audience.rb +67 -0
- data/lib/jpush/model/message.rb +37 -0
- data/lib/jpush/model/messages_result.rb +7 -0
- data/lib/jpush/model/notification/android_notification.rb +38 -0
- data/lib/jpush/model/notification/ios_notification.rb +60 -0
- data/lib/jpush/model/notification/notification.rb +35 -0
- data/lib/jpush/model/notification/winphone_notification.rb +37 -0
- data/lib/jpush/model/options.rb +53 -0
- data/lib/jpush/model/platform.rb +57 -0
- data/lib/jpush/model/push_payload.rb +70 -0
- data/lib/jpush/model/push_result.rb +32 -0
- data/lib/jpush/model/receiveds_result.rb +62 -0
- data/lib/jpush/push_client.rb +31 -0
- data/lib/jpush/report_client.rb +45 -0
- data/lib/jpush/response_wrapper.rb +36 -0
- data/lib/jpush/util/service_helper.rb +10 -0
- data/test/alert_override_tests.rb +62 -0
- data/test/audience_tests.rb +169 -0
- data/test/base_remote_tests.rb +27 -0
- data/test/message_tests.rb +49 -0
- data/test/notification_tests.rb +52 -0
- data/test/push_payload_test.rb +58 -0
- data/test/report_function_tests.rb +40 -0
- metadata +101 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'jpush'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
class PushPayLoadTest <Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
@payload = JPush::PushPayload.new
|
7
|
+
end
|
8
|
+
|
9
|
+
def testIllegal_OnlyPlatform
|
10
|
+
@payload = JPush::PushPayload.build(
|
11
|
+
platform: JPush::Platform.all)
|
12
|
+
end
|
13
|
+
|
14
|
+
def testIllegal_OnlyAudience
|
15
|
+
@payload = JPush::PushPayload.build(
|
16
|
+
audience: JPush::Audience.all)
|
17
|
+
end
|
18
|
+
|
19
|
+
def testIllegal_PlatformAudience
|
20
|
+
@payload = JPush::PushPayload.build(
|
21
|
+
audience: JPush::Audience.all,
|
22
|
+
platform: JPush::Platform.all)
|
23
|
+
end
|
24
|
+
|
25
|
+
def testIllegal_NoAudience
|
26
|
+
@payload = JPush::PushPayload.build(
|
27
|
+
platform: JPush::Platform.all,
|
28
|
+
notification: JPush::Notification.build(
|
29
|
+
alert: 'alert'))
|
30
|
+
end
|
31
|
+
|
32
|
+
def testIllegal_NoPlatform
|
33
|
+
@payload = JPush::PushPayload.build(
|
34
|
+
audience: JPush::Audience.all,
|
35
|
+
notification: JPush::Notification.build(
|
36
|
+
alert: 'alert'))
|
37
|
+
end
|
38
|
+
|
39
|
+
def testNotification
|
40
|
+
@payload = JPush::PushPayload.build(
|
41
|
+
platform: JPush::Platform.all,
|
42
|
+
audience: JPush::Audience.all,
|
43
|
+
notification: JPush::Notification.build(
|
44
|
+
alert: 'alert'))
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
def testMessage
|
49
|
+
@payload = JPush::PushPayload.build(
|
50
|
+
platform: JPush::Platform.all,
|
51
|
+
audience: JPush::Audience.all,
|
52
|
+
message: JPush::Message.build(
|
53
|
+
msg_content: "message content test",
|
54
|
+
title: "message title test",
|
55
|
+
content_type: "message content type test",
|
56
|
+
extras: {"key1" => "value1", "key2" => "value2"}))
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'jpush'
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
class ReportFunctionTests < Test::Unit::TestCase
|
6
|
+
AppKey = "7d431e42dfa6a6d693ac2d04"
|
7
|
+
MasterSecret = "5e987ac6d2e04d95a9d8f0d1"
|
8
|
+
def setup
|
9
|
+
@client = JPush::JPushClient.new(AppKey, MasterSecret)
|
10
|
+
end
|
11
|
+
|
12
|
+
def testgetReceivedsFixed
|
13
|
+
result = @client.getReportReceiveds("1613113584,1229760629,1174658841,1174658641")
|
14
|
+
end
|
15
|
+
|
16
|
+
def testgetReceivedsFixed2
|
17
|
+
result = @client.getReportReceiveds("1613113584, ,1229760629, ")
|
18
|
+
end
|
19
|
+
=begin
|
20
|
+
def testgetMessagesTest
|
21
|
+
result = @client.getReportMessages("1613113584")
|
22
|
+
end
|
23
|
+
|
24
|
+
def testgetMessagesTest2
|
25
|
+
result = @client.getReportMessages("1613113584, ,1229760629, ")
|
26
|
+
end
|
27
|
+
|
28
|
+
def testgetUsersTest
|
29
|
+
result = @client.getReportUsers('MONTH', "2014-05", 1)
|
30
|
+
end
|
31
|
+
|
32
|
+
def testgetUserTest2
|
33
|
+
result = @client.getReportUsers('DAY', "2014-05-10", 5)
|
34
|
+
end
|
35
|
+
|
36
|
+
def getUserTest3
|
37
|
+
result = @client.getReportUsers('HOUR', "2014-05-10 06", 10)
|
38
|
+
end
|
39
|
+
=end
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jpush
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- JPush Offical
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.6'
|
27
|
+
description: JPush's officially supported Ruby client library for accessing JPush
|
28
|
+
APIs. http://jpush.cn
|
29
|
+
email:
|
30
|
+
- support@jpush.cn
|
31
|
+
executables: []
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- ".gitignore"
|
36
|
+
- ".project"
|
37
|
+
- Gemfile
|
38
|
+
- LICENSE.txt
|
39
|
+
- README.md
|
40
|
+
- Rakefile
|
41
|
+
- example/push_example.rb
|
42
|
+
- example/report_example.rb
|
43
|
+
- jpush.gemspec
|
44
|
+
- lib/jpush.rb
|
45
|
+
- lib/jpush/http_client.rb
|
46
|
+
- lib/jpush/jpush_client.rb
|
47
|
+
- lib/jpush/model/audience.rb
|
48
|
+
- lib/jpush/model/message.rb
|
49
|
+
- lib/jpush/model/messages_result.rb
|
50
|
+
- lib/jpush/model/notification/android_notification.rb
|
51
|
+
- lib/jpush/model/notification/ios_notification.rb
|
52
|
+
- lib/jpush/model/notification/notification.rb
|
53
|
+
- lib/jpush/model/notification/winphone_notification.rb
|
54
|
+
- lib/jpush/model/options.rb
|
55
|
+
- lib/jpush/model/platform.rb
|
56
|
+
- lib/jpush/model/push_payload.rb
|
57
|
+
- lib/jpush/model/push_result.rb
|
58
|
+
- lib/jpush/model/receiveds_result.rb
|
59
|
+
- lib/jpush/push_client.rb
|
60
|
+
- lib/jpush/report_client.rb
|
61
|
+
- lib/jpush/response_wrapper.rb
|
62
|
+
- lib/jpush/util/service_helper.rb
|
63
|
+
- test/alert_override_tests.rb
|
64
|
+
- test/audience_tests.rb
|
65
|
+
- test/base_remote_tests.rb
|
66
|
+
- test/message_tests.rb
|
67
|
+
- test/notification_tests.rb
|
68
|
+
- test/push_payload_test.rb
|
69
|
+
- test/report_function_tests.rb
|
70
|
+
homepage: https://github.com/jpush/jpush-api-ruby-client
|
71
|
+
licenses:
|
72
|
+
- GNU
|
73
|
+
metadata: {}
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options: []
|
76
|
+
require_paths:
|
77
|
+
- lib
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
requirements: []
|
89
|
+
rubyforge_project:
|
90
|
+
rubygems_version: 2.2.2
|
91
|
+
signing_key:
|
92
|
+
specification_version: 4
|
93
|
+
summary: JPush's officially supported Ruby client library for accessing JPush APIs.
|
94
|
+
test_files:
|
95
|
+
- test/alert_override_tests.rb
|
96
|
+
- test/audience_tests.rb
|
97
|
+
- test/base_remote_tests.rb
|
98
|
+
- test/message_tests.rb
|
99
|
+
- test/notification_tests.rb
|
100
|
+
- test/push_payload_test.rb
|
101
|
+
- test/report_function_tests.rb
|