Commit f579b9b5 by lanrion

added #upload_mass_news and #upload_mass_video

parent bce2a6e5
...@@ -43,11 +43,31 @@ module WeixinAuthorize ...@@ -43,11 +43,31 @@ module WeixinAuthorize
# } # }
# ] # ]
# } # }
def upload_news(news) # Option: author, content_source_url
def upload_mass_news(news=[])
upload_news_url = "#{media_base_url}/uploadnews" upload_news_url = "#{media_base_url}/uploadnews"
http_post(upload_news_url, {articles: news}) http_post(upload_news_url, {articles: news})
end end
# media_id: 需通过基础支持中的上传下载多媒体文件来得到
# https://file.api.weixin.qq.com/cgi-bin/media/uploadvideo?access_token=ACCESS_TOKEN
# return:
# {
# "type":"video",
# "media_id":"IhdaAQXuvJtGzwwc0abfXnzeezfO0NgPK6AQYShD8RQYMTtfzbLdBIQkQziv2XJc",
# "created_at":1398848981
# }
def upload_mass_video(media_id, title="", desc="")
video_msg = {
"media_id" => media_id,
"title" => title,
"description" => desc
}
http_post("#{media_base_url}/uploadvideo", video_msg)
end
private private
def process_file(media) def process_file(media)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment