Class: PushV3Client

Inherits:
Object
  • Object
show all
Includes:
CommonHelper
Defined in:
lib/mobpush/client/push/push_v3_client.rb

Class Attribute Summary collapse

Instance Method Summary collapse

Methods included from CommonHelper

#hash2os, #os2hash, #sanitze_hash

Class Attribute Details

.CANCEL_TASK_URIObject

Returns the value of attribute CANCEL_TASK_URI.



17
18
19
# File 'lib/mobpush/client/push/push_v3_client.rb', line 17

def CANCEL_TASK_URI
  @CANCEL_TASK_URI
end

.GET_BY_WORKID_URIObject

Returns the value of attribute GET_BY_WORKID_URI.



17
18
19
# File 'lib/mobpush/client/push/push_v3_client.rb', line 17

def GET_BY_WORKID_URI
  @GET_BY_WORKID_URI
end

.GET_BY_WORKNO_URIObject

Returns the value of attribute GET_BY_WORKNO_URI.



17
18
19
# File 'lib/mobpush/client/push/push_v3_client.rb', line 17

def GET_BY_WORKNO_URI
  @GET_BY_WORKNO_URI
end

.PUSH_MULTIObject

Returns the value of attribute PUSH_MULTI.



17
18
19
# File 'lib/mobpush/client/push/push_v3_client.rb', line 17

def PUSH_MULTI
  @PUSH_MULTI
end

.PUSH_URIObject

Returns the value of attribute PUSH_URI.



17
18
19
# File 'lib/mobpush/client/push/push_v3_client.rb', line 17

def PUSH_URI
  @PUSH_URI
end

.RECALL_TASK_URIObject

Returns the value of attribute RECALL_TASK_URI.



17
18
19
# File 'lib/mobpush/client/push/push_v3_client.rb', line 17

def RECALL_TASK_URI
  @RECALL_TASK_URI
end

.REPLACE_TASK_URIObject

Returns the value of attribute REPLACE_TASK_URI.



17
18
19
# File 'lib/mobpush/client/push/push_v3_client.rb', line 17

def REPLACE_TASK_URI
  @REPLACE_TASK_URI
end

Instance Method Details

#cancelPushTask(workId) ⇒ Object



52
53
54
55
# File 'lib/mobpush/client/push/push_v3_client.rb', line 52

def cancelPushTask(workId)
    params = {:batchId => workId}
    MobHTTP.post(MobPushConfig.baseUrl + PushV3Client.CANCEL_TASK_URI, nil, params)
end

#getPushByBatchId(batchId) ⇒ Object



67
68
69
70
# File 'lib/mobpush/client/push/push_v3_client.rb', line 67

def getPushByBatchId(batchId)
    params = {:workId => batchId}
    MobHTTP.post(MobPushConfig.baseUrl + PushV3Client.GET_BY_WORKID_URI, nil, params)
end

#getPushByWorkno(workno) ⇒ Object



72
73
74
75
# File 'lib/mobpush/client/push/push_v3_client.rb', line 72

def getPushByWorkno(workno)
    params = {:workno => workno}
    MobHTTP.post(MobPushConfig.baseUrl + PushV3Client.GET_BY_WORKNO_URI, nil, params)
end

#pushAll(workNo, title, content) ⇒ Object



32
33
34
# File 'lib/mobpush/client/push/push_v3_client.rb', line 32

def pushAll(workNo, title, content)
    pushTaskV3ByBuilder(PushWorkBuilder.new(workNo, title, content).targetAll())
end

#pushByAlias(workNo, title, content, *alia) ⇒ Object



36
37
38
# File 'lib/mobpush/client/push/push_v3_client.rb', line 36

def pushByAlias(workNo, title, content, *alia)
    pushTaskV3ByBuilder(PushWorkBuilder.new(workNo, title, content).targetAlias(alia))
end

#pushByAreas(workNo, title, content, pushAreas) ⇒ Object



48
49
50
# File 'lib/mobpush/client/push/push_v3_client.rb', line 48

def pushByAreas(workNo, title, content, pushAreas)
    pushTaskV3ByBuilder(PushWorkBuilder.new(workNo, title, content).targetAreas(pushAreas))
end

#pushByRids(workNo, title, content, *rids) ⇒ Object



44
45
46
# File 'lib/mobpush/client/push/push_v3_client.rb', line 44

def pushByRids(workNo, title, content, *rids)
    pushTaskV3ByBuilder(PushWorkBuilder.new(workNo, title, content).targetRids(rids))
end

#pushByTags(workNo, title, content, *tags) ⇒ Object



40
41
42
# File 'lib/mobpush/client/push/push_v3_client.rb', line 40

def pushByTags(workNo, title, content, *tags)
    pushTaskV3ByBuilder(PushWorkBuilder.new(workNo, title, content).targetTags(tags))
end

#pushMulti(pushMulti) ⇒ Object



77
78
79
# File 'lib/mobpush/client/push/push_v3_client.rb', line 77

def pushMulti(pushMulti)
    MobHTTP.post(MobPushConfig.baseUrl + PushV3Client.PUSH_MULTI, nil, pushMulti)
end

#pushTaskV3(push) ⇒ Object



23
24
25
26
# File 'lib/mobpush/client/push/push_v3_client.rb', line 23

def pushTaskV3(push)
    url = MobPushConfig.baseUrl + PushV3Client.PUSH_URI
    MobHTTP.post(url, nil, os2hash(push))
end

#pushTaskV3ByBuilder(builder) ⇒ Object



28
29
30
# File 'lib/mobpush/client/push/push_v3_client.rb', line 28

def pushTaskV3ByBuilder(builder)
    pushTaskV3(builder.build())
end

#recallPushTask(workId) ⇒ Object



62
63
64
65
# File 'lib/mobpush/client/push/push_v3_client.rb', line 62

def recallPushTask(workId)
    params = {:batchId => workId}
    MobHTTP.post(MobPushConfig.baseUrl + PushV3Client.RECALL_TASK_URI, nil, params)
end

#replacePushTask(workId, content) ⇒ Object



57
58
59
60
# File 'lib/mobpush/client/push/push_v3_client.rb', line 57

def replacePushTask(workId, content)
    params = {:batchId => workId, :content => content}
    MobHTTP.post(MobPushConfig.baseUrl + PushV3Client.REPLACE_TASK_URI, nil, params)
end