Module: NewUmeng::SendMessage

Includes:
JsonBody, Services
Included in:
Client
Defined in:
lib/new_umeng/send_message.rb,
lib/new_umeng/send_message_bak.rb

Defined Under Namespace

Modules: APIKey

Instance Method Summary collapse

Methods included from JsonBody

#android_params, #ios_params

Methods included from Services

#cancel, #push, #status

Methods included from Util

#generate_sign, #result

Instance Method Details

#push_broadcast(opts = {}) ⇒ Object

广播



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/new_umeng/send_message.rb', line 10

def push_broadcast(opts={})
  params = {
    type: 'broadcast',
    production_mode: opts[:production_mode]
  }
  case @plantform
  when 'Android'
    params.merge! android_params(opts)
    push(params)
  when 'iOS'
    params.merge! ios_params(opts)
    push(params)
  end
end

#push_groupcast(filter, opts = {}) ⇒ Object

组播



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/new_umeng/send_message.rb', line 60

def push_groupcast(filter, opts={})
  params = {
    type: 'groupcast',
    filter: {
      where: {
        and: {
          or: filter
        }
      }
    },
    production_mode: opts[:production_mode]
  }
  case @plantform
  when 'Android'
    params.merge! android_params(opts)
    push(params)
  when 'iOS'
    params.merge! ios_params(opts)
    push(params)
  end
end

#push_listcast(device_tokens, opts = {}) ⇒ Object

列播



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/new_umeng/send_message.rb', line 43

def push_listcast(device_tokens, opts={})
  params = {
    device_tokens: device_tokens,
    type: 'listcast',
    production_mode: opts[:production_mode]
  }
  case @plantform
  when 'Android'
    params.merge! android_params(opts)
    push(params)
  when 'iOS'
    params.merge! ios_params(opts)
    push(params)
  end
end

#push_unicast(device_tokens, opts = {}) ⇒ Object

单播



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/new_umeng/send_message.rb', line 26

def push_unicast(device_tokens, opts={})
  params = {
    device_tokens: device_tokens,
    type: 'unicast',
    production_mode: opts[:production_mode]
  }
  case @plantform
  when 'Android'
    params.merge! android_params(opts)
    push(params)
  when 'iOS'
    params.merge! ios_params(opts)
    push(params)
  end
end