Class: PushWorkBuilder
- Inherits:
-
Object
- Object
- PushWorkBuilder
- Defined in:
- lib/mobpush/client/push/push_work_builder.rb
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(workno, title, content) ⇒ PushWorkBuilder
constructor
A new instance of PushWorkBuilder.
- #targetAlias(*alia) ⇒ Object
- #targetAll ⇒ Object
- #targetAreas(pushAreas) ⇒ Object
- #targetRids(*rids) ⇒ Object
- #targetTags(*tags) ⇒ Object
Constructor Details
#initialize(workno, title, content) ⇒ PushWorkBuilder
Returns a new instance of PushWorkBuilder.
7 8 9 10 11 12 13 |
# File 'lib/mobpush/client/push/push_work_builder.rb', line 7 def initialize(workno, title, content) @push = OpenStruct.new(workno: workno, source: 'webapi') @push.pushTarget = OpenStruct.new(tagsType: 1) @push.pushNotify = OpenStruct.new(title: title, content: content, taskCron: 0, plats: [1, 2], iosProduction: 1, offlineSeconds: 3600, type: 1, speed: 1) @push.pushOperator = OpenStruct.new() end |
Instance Method Details
#build ⇒ Object
45 46 47 |
# File 'lib/mobpush/client/push/push_work_builder.rb', line 45 def build() @push end |
#targetAlias(*alia) ⇒ Object
20 21 22 23 24 |
# File 'lib/mobpush/client/push/push_work_builder.rb', line 20 def targetAlias(*alia) @push.pushTarget.target = PushTarget::TARGET_ALIAS @push.pushTarget.alias = alia.uniq self end |
#targetAll ⇒ Object
15 16 17 18 |
# File 'lib/mobpush/client/push/push_work_builder.rb', line 15 def targetAll() @push.pushTarget.target = PushTarget::TARGET_ALL self end |
#targetAreas(pushAreas) ⇒ Object
38 39 40 41 42 |
# File 'lib/mobpush/client/push/push_work_builder.rb', line 38 def targetAreas(pushAreas) @push.pushTarget.target = PushTarget::TARGET_AREAS @push.pushTarget.pushAreas = pushAreas self end |
#targetRids(*rids) ⇒ Object
32 33 34 35 36 |
# File 'lib/mobpush/client/push/push_work_builder.rb', line 32 def targetRids(*rids) @push.pushTarget.target = PushTarget::TARGET_RIDS @push.pushTarget.rids = rids.uniq self end |
#targetTags(*tags) ⇒ Object
26 27 28 29 30 |
# File 'lib/mobpush/client/push/push_work_builder.rb', line 26 def targetTags(*) @push.pushTarget.target = PushTarget::TARGET_TAGS @push.pushTarget. = .uniq self end |