jpush 3.1.1 → 3.2.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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jpush.rb +10 -0
  3. data/lib/jpush/api_connection_exception.rb +11 -0
  4. data/lib/jpush/device_client.rb +84 -0
  5. data/lib/jpush/http_client.rb +32 -18
  6. data/lib/jpush/jpush_client.rb +81 -7
  7. data/lib/jpush/model/alias_uids_result.rb +32 -0
  8. data/lib/jpush/model/exist_result.rb +33 -0
  9. data/lib/jpush/model/get_messages_result.rb +30 -0
  10. data/lib/jpush/model/notification/ios_notification.rb +6 -2
  11. data/lib/jpush/model/options.rb +15 -4
  12. data/lib/jpush/model/push_payload.rb +6 -0
  13. data/lib/jpush/model/push_result.rb +4 -4
  14. data/lib/jpush/model/receiveds_result.rb +3 -3
  15. data/lib/jpush/model/tag_alias.rb +62 -0
  16. data/lib/jpush/model/tag_alias_result.rb +32 -0
  17. data/lib/jpush/model/tag_list_result.rb +32 -0
  18. data/lib/jpush/model/tag_manager.rb +44 -0
  19. data/lib/jpush/model/user_result.rb +40 -0
  20. data/lib/jpush/push_client.rb +18 -4
  21. data/lib/jpush/report_client.rb +11 -6
  22. data/lib/jpush/response_wrapper.rb +2 -1
  23. data/lib/jpush/util/service_helper.rb +3 -2
  24. metadata +13 -26
  25. data/.gitignore +0 -18
  26. data/.project +0 -18
  27. data/Gemfile +0 -4
  28. data/LICENSE.txt +0 -339
  29. data/README.md +0 -75
  30. data/Rakefile +0 -1
  31. data/example/push_example.rb +0 -101
  32. data/example/report_example.rb +0 -18
  33. data/jpush.gemspec +0 -24
  34. data/test/alert_override_tests.rb +0 -62
  35. data/test/audience_tests.rb +0 -169
  36. data/test/base_remote_tests.rb +0 -27
  37. data/test/message_tests.rb +0 -49
  38. data/test/notification_tests.rb +0 -52
  39. data/test/push_payload_test.rb +0 -58
  40. data/test/report_function_tests.rb +0 -40
@@ -1,52 +0,0 @@
1
- require 'jpush'
2
-
3
- require './base_remote_tests.rb'
4
-
5
- require 'test/unit'
6
- class NotificationTests < Test::Unit::TestCase
7
- def setup
8
- @client = JPush::JPushClient.new(AppKey, MasterSecret)
9
- end
10
-
11
- def testsendNotification_android_title
12
- @payload = JPush::PushPayload.build(
13
- audience: JPush::Audience.all,
14
- platform: JPush::Platform.all,
15
- notification: JPush::Notification.build(
16
- android: JPush::AndroidNotification.build(
17
- alert: 'alert',
18
- title: 'title')))
19
- res = @client.sendPush(@payload)
20
- assert(res.isok, message = "")
21
- end
22
-
23
- def testsendNotification_android_buildId
24
- @payload = JPush::PushPayload.build(
25
- audience: JPush::Audience.all,
26
- platform: JPush::Platform.all,
27
- notification: JPush::Notification.build(
28
- android: JPush::AndroidNotification.build(
29
- alert: 'alert',
30
- builder_id: 100)))
31
- res = @client.sendPush(@payload)
32
- assert(res.isok, message = "")
33
- end
34
-
35
- def testsendNotification_android_extras
36
- array = {}
37
- array['key1'] = 'value1'
38
- array['key2'] = 'value2'
39
- array['key3'] = 'value3'
40
- @payload = JPush::PushPayload.build(
41
- audience: JPush::Audience.all,
42
- platform: JPush::Platform.all,
43
- notification: JPush::Notification.build(
44
- android: JPush::AndroidNotification.build(
45
- alert: 'alert',
46
- extras: array)))
47
- res = @client.sendPush(@payload)
48
- assert(res.isok, message = "")
49
- end
50
-
51
-
52
- end
@@ -1,58 +0,0 @@
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
@@ -1,40 +0,0 @@
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