Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
igetui-ruby
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
igetui-ruby
Commits
d82a6716
Commit
d82a6716
authored
Aug 12, 2014
by
Victor Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支持链接类型的通知推送
parent
1d03a63b
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
135 additions
and
52 deletions
+135
-52
lib/igetui/template.rb
+1
-0
lib/igetui/template/link_template.rb
+64
-0
lib/igetui/template/notification_template.rb
+32
-32
lib/igetui/template/transmission_template.rb
+17
-17
lib/igetui/version.rb
+1
-1
test/pusher_test.rb
+20
-2
No files found.
lib/igetui/template.rb
View file @
d82a6716
require
'igetui/template/base_template'
require
'igetui/template/transmission_template'
require
'igetui/template/link_template'
require
'igetui/template/notification_template'
lib/igetui/template/link_template.rb
0 → 100644
View file @
d82a6716
module
IGeTui
class
LinkTemplate
<
BaseTemplate
attr_accessor
:title
,
:text
,
:logo
,
:logo_url
,
:url
attr_accessor
:is_ring
,
:is_vibrate
,
:is_clearable
def
initialize
@title
=
''
@text
=
''
@logo
=
''
@logo_url
=
''
@transmission_type
=
0
@transmission_content
=
''
@is_ring
=
true
@is_vibrate
=
true
@is_clearable
=
false
super
end
def
get_action_chain
# set actionchain
action_chain_1
=
GtReq
::
ActionChain
.
new
action_chain_1
.
actionId
=
1
action_chain_1
.
type
=
GtReq
::
ActionChain
::
Type
::
Goto
action_chain_1
.
next
=
10000
# notification
action_chain_2
=
GtReq
::
ActionChain
.
new
action_chain_2
.
actionId
=
10000
action_chain_2
.
type
=
GtReq
::
ActionChain
::
Type
::
Notification
action_chain_2
.
title
=
title
action_chain_2
.
text
=
text
action_chain_2
.
logo
=
logo
action_chain_2
.
logoURL
=
logo_url
action_chain_2
.
ring
=
is_ring
action_chain_2
.
clearable
=
is_clearable
action_chain_2
.
buzz
=
is_vibrate
action_chain_2
.
next
=
10010
# goto
action_chain_3
=
GtReq
::
ActionChain
.
new
action_chain_3
.
actionId
=
10010
action_chain_3
.
type
=
GtReq
::
ActionChain
::
Type
::
Goto
action_chain_3
.
next
=
10030
# start web
action_chain_4
=
GtReq
::
ActionChain
.
new
action_chain_4
.
actionId
=
10030
action_chain_4
.
type
=
GtReq
::
ActionChain
::
Type
::
Startweb
action_chain_4
.
url
=
url
action_chain_4
.
next
=
100
# end
action_chain_5
=
GtReq
::
ActionChain
.
new
action_chain_5
.
actionId
=
100
action_chain_5
.
type
=
GtReq
::
ActionChain
::
Type
::
Eoa
[
action_chain_1
,
action_chain_2
,
action_chain_3
,
action_chain_4
,
action_chain_5
]
end
def
get_push_type
"NotifyMsg"
end
end
end
lib/igetui/template/notification_template.rb
View file @
d82a6716
...
...
@@ -18,49 +18,49 @@ module IGeTui
def
get_action_chain
# set actionchain
action
Chain
1
=
GtReq
::
ActionChain
.
new
action
Chain
1
.
actionId
=
1
action
Chain
1
.
type
=
GtReq
::
ActionChain
::
Type
::
Goto
action
Chain
1
.
next
=
10000
action
_chain_
1
=
GtReq
::
ActionChain
.
new
action
_chain_
1
.
actionId
=
1
action
_chain_
1
.
type
=
GtReq
::
ActionChain
::
Type
::
Goto
action
_chain_
1
.
next
=
10000
# notification
action
Chain
2
=
GtReq
::
ActionChain
.
new
action
Chain
2
.
actionId
=
10000
action
Chain
2
.
type
=
GtReq
::
ActionChain
::
Type
::
Notification
action
Chain
2
.
title
=
title
action
Chain
2
.
text
=
text
action
Chain
2
.
logo
=
logo
action
Chain
2
.
logoURL
=
logo_url
action
Chain
2
.
ring
=
is_ring
action
Chain
2
.
clearable
=
is_clearable
action
Chain
2
.
buzz
=
is_vibrate
action
Chain
2
.
next
=
10010
action
_chain_
2
=
GtReq
::
ActionChain
.
new
action
_chain_
2
.
actionId
=
10000
action
_chain_
2
.
type
=
GtReq
::
ActionChain
::
Type
::
Notification
action
_chain_
2
.
title
=
title
action
_chain_
2
.
text
=
text
action
_chain_
2
.
logo
=
logo
action
_chain_
2
.
logoURL
=
logo_url
action
_chain_
2
.
ring
=
is_ring
action
_chain_
2
.
clearable
=
is_clearable
action
_chain_
2
.
buzz
=
is_vibrate
action
_chain_
2
.
next
=
10010
# goto
action
Chain
3
=
GtReq
::
ActionChain
.
new
action
Chain
3
.
actionId
=
10010
action
Chain
3
.
type
=
GtReq
::
ActionChain
::
Type
::
Goto
action
Chain
3
.
next
=
10030
action
_chain_
3
=
GtReq
::
ActionChain
.
new
action
_chain_
3
.
actionId
=
10010
action
_chain_
3
.
type
=
GtReq
::
ActionChain
::
Type
::
Goto
action
_chain_
3
.
next
=
10030
# appStartUp
app
StartU
p
=
GtReq
::
AppStartUp
.
new
(
android:
''
,
symbia:
''
,
ios:
''
)
app
_start_u
p
=
GtReq
::
AppStartUp
.
new
(
android:
''
,
symbia:
''
,
ios:
''
)
# start web
action
Chain
4
=
GtReq
::
ActionChain
.
new
action
Chain
4
.
actionId
=
10030
action
Chain
4
.
type
=
GtReq
::
ActionChain
::
Type
::
Startapp
action
Chain
4
.
appid
=
''
action
Chain
4
.
autostart
=
@transmission_type
==
1
action
Chain4
.
appstartupid
=
appStartU
p
action
Chain
4
.
failedAction
=
100
action
Chain
4
.
next
=
100
action
_chain_
4
=
GtReq
::
ActionChain
.
new
action
_chain_
4
.
actionId
=
10030
action
_chain_
4
.
type
=
GtReq
::
ActionChain
::
Type
::
Startapp
action
_chain_
4
.
appid
=
''
action
_chain_
4
.
autostart
=
@transmission_type
==
1
action
_chain_4
.
appstartupid
=
app_start_u
p
action
_chain_
4
.
failedAction
=
100
action
_chain_
4
.
next
=
100
# end
action
Chain
5
=
GtReq
::
ActionChain
.
new
action
Chain
5
.
actionId
=
100
action
Chain
5
.
type
=
GtReq
::
ActionChain
::
Type
::
Eoa
action
_chain_
5
=
GtReq
::
ActionChain
.
new
action
_chain_
5
.
actionId
=
100
action
_chain_
5
.
type
=
GtReq
::
ActionChain
::
Type
::
Eoa
[
action
Chain1
,
actionChain2
,
actionChain3
,
actionChain4
,
actionChain
5
]
[
action
_chain_1
,
action_chain_2
,
action_chain_3
,
action_chain_4
,
action_chain_
5
]
end
def
get_push_type
...
...
lib/igetui/template/transmission_template.rb
View file @
d82a6716
...
...
@@ -8,30 +8,30 @@ module IGeTui
def
get_action_chain
# set actionChain
action
Chain
1
=
GtReq
::
ActionChain
.
new
action
Chain
1
.
actionId
=
1
action
Chain
1
.
type
=
GtReq
::
ActionChain
::
Type
::
Goto
action
Chain
1
.
next
=
10030
action
_chain_
1
=
GtReq
::
ActionChain
.
new
action
_chain_
1
.
actionId
=
1
action
_chain_
1
.
type
=
GtReq
::
ActionChain
::
Type
::
Goto
action
_chain_
1
.
next
=
10030
# appStartUp
app
StartU
p
=
GtReq
::
AppStartUp
.
new
(
android:
''
,
symbia:
''
,
ios:
''
)
app
_start_u
p
=
GtReq
::
AppStartUp
.
new
(
android:
''
,
symbia:
''
,
ios:
''
)
# start up app
action
Chain
2
=
GtReq
::
ActionChain
.
new
action
Chain
2
.
actionId
=
10030
action
Chain
2
.
type
=
GtReq
::
ActionChain
::
Type
::
Startapp
action
Chain
2
.
appid
=
''
action
Chain
2
.
autostart
=
transmission_type
==
1
action
Chain2
.
appstartupid
=
appStartU
p
action
Chain
2
.
failedAction
=
100
action
Chain
2
.
next
=
100
action
_chain_
2
=
GtReq
::
ActionChain
.
new
action
_chain_
2
.
actionId
=
10030
action
_chain_
2
.
type
=
GtReq
::
ActionChain
::
Type
::
Startapp
action
_chain_
2
.
appid
=
''
action
_chain_
2
.
autostart
=
transmission_type
==
1
action
_chain_2
.
appstartupid
=
app_start_u
p
action
_chain_
2
.
failedAction
=
100
action
_chain_
2
.
next
=
100
# end
action
Chain
3
=
GtReq
::
ActionChain
.
new
action
Chain
3
.
actionId
=
100
action
Chain
3
.
type
=
GtReq
::
ActionChain
::
Type
::
Eoa
action
_chain_
3
=
GtReq
::
ActionChain
.
new
action
_chain_
3
.
actionId
=
100
action
_chain_
3
.
type
=
GtReq
::
ActionChain
::
Type
::
Eoa
[
action
Chain1
,
actionChain2
,
actionChain
3
]
[
action
_chain_1
,
action_chain_2
,
action_chain_
3
]
end
def
get_push_type
...
...
lib/igetui/version.rb
View file @
d82a6716
module
IGeTui
VERSION
=
"0.0.
1
"
VERSION
=
"0.0.
2
"
end
test/pusher_test.rb
View file @
d82a6716
...
...
@@ -28,6 +28,13 @@ class PusherTest < MiniTest::Unit::TestCase
assert_equal
ret
[
"result"
],
"ok"
end
def
test_to_single_link_notification
single_message
=
IGeTui
::
SingleMessage
.
new
single_message
.
data
=
link_template
ret
=
@pusher
.
push_message_to_single
(
single_message
,
@client_1
)
assert_equal
ret
[
"result"
],
"ok"
end
def
test_to_single_transmission
single_message
=
IGeTui
::
SingleMessage
.
new
single_message
.
data
=
transmission_template
...
...
@@ -56,12 +63,23 @@ class PusherTest < MiniTest::Unit::TestCase
private
def
notification_template
template
=
IGeTui
::
NotificationTemplate
.
new
def
set_template_base_info
(
template
)
template
.
logo
=
'push.png'
template
.
logo_url
=
'http://www.igetui.com/wp-content/uploads/2013/08/logo_getui1.png'
template
.
title
=
'测试标题'
template
.
text
=
'测试文本'
end
def
link_template
template
=
IGeTui
::
LinkTemplate
.
new
set_template_base_info
(
template
)
template
.
url
=
"http://www.baidu.com"
template
end
def
notification_template
template
=
IGeTui
::
NotificationTemplate
.
new
set_template_base_info
(
template
)
template
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment