Module: WxExt::Api::Mass

Extended by:
Mass
Included in:
Mass
Defined in:
lib/wx_ext/api/mass.rb

Overview

User api of weixin.

Author:

  • FuShengYang

Instance Method Summary collapse

Instance Method Details

#del_mass(access_token, msg_id) ⇒ Hash

Del mass via post.

Parameters:

  • access_token (Enumerable<String>)
  • msg_id (String)

Returns:

  • (Hash)

    Json based hash.



52
53
54
55
56
# File 'lib/wx_ext/api/mass.rb', line 52

def del_mass(access_token, msg_id)
  url = 'https://api.weixin.qq.com/cgi-bin/message/mass/delete'\
        "?access_token=#{access_token}"
  Helper.http_post(url, { msg_id: msg_id }.to_json)
end

#get_mass_status(access_token, msg_id) ⇒ Hash

Get mass status via post.

Parameters:

  • access_token (Enumerable<String>)
  • msg_id (String)

Returns:

  • (Hash)

    Json based hash.



74
75
76
77
78
# File 'lib/wx_ext/api/mass.rb', line 74

def get_mass_status(access_token, msg_id)
  url = 'https://api.weixin.qq.com/cgi-bin/message/mass/get'\
        "?access_token=#{access_token}"
  Helper.http_post(url, { msg_id: msg_id }.to_json)
end

#mass_by_filter_group(access_token, filter_hash) ⇒ Hash

Mass to users by filter group via post.

Parameters:

  • access_token (Enumerable<String>)
  • filter_hash (Hash)

Returns:

  • (Hash)

    Json based hash.



30
31
32
33
34
# File 'lib/wx_ext/api/mass.rb', line 30

def mass_by_filter_group(access_token, filter_hash)
  url = 'https://api.weixin.qq.com/cgi-bin/message/mass/sendall'\
        "?access_token=#{access_token}"
  Helper.http_post(url, filter_hash.to_json)
end

#mass_by_openid(access_token, openid_hash) ⇒ Hash

Mass to users by openid via post.

Parameters:

  • access_token (Enumerable<String>)
  • openid_hash (Hash)

Returns:

  • (Hash)

    Json based hash.



41
42
43
44
45
# File 'lib/wx_ext/api/mass.rb', line 41

def mass_by_openid(access_token, openid_hash)
  url = 'https://api.weixin.qq.com/cgi-bin/message/mass/send'\
        "?access_token=#{access_token}"
  Helper.http_post(url, openid_hash.to_json)
end

#preview_mass(access_token, preview_hash) ⇒ Hash

Preview mass via post.

Parameters:

  • access_token (Enumerable<String>)
  • preview_hash (Hash)

Returns:

  • (Hash)

    Json based hash.



63
64
65
66
67
# File 'lib/wx_ext/api/mass.rb', line 63

def preview_mass(access_token, preview_hash)
  url = 'https://api.weixin.qq.com/cgi-bin/message/mass/preview'\
        "?access_token=#{access_token}"
  Helper.http_post(url, preview_hash.to_json)
end

#upload_news(access_token, news_hash) ⇒ Hash

Upload news to weixin server via post.

Parameters:

  • access_token (Enumerable<String>)
  • news_hash (Hash)

Returns:

  • (Hash)

    Json based hash.



19
20
21
22
23
# File 'lib/wx_ext/api/mass.rb', line 19

def upload_news(access_token, news_hash)
  url = 'https://api.weixin.qq.com/cgi-bin/media/uploadnews'\
        "?access_token=#{access_token}"
  Helper.http_post(url, news_hash.to_json)
end