Module: EasyWeixin
- Extended by:
- EasyWeixin
- Included in:
- EasyWeixin
- Defined in:
- lib/easy_weixin/auth.rb,
lib/easy_weixin.rb,
lib/easy_weixin/model.rb,
lib/easy_weixin/version.rb
Overview
Defined Under Namespace
Classes: Auth, Item, Message, NewsReplyMessage, ReplyMessage, TextReplyMessage
Constant Summary
collapse
- VERSION =
"0.0.8"
Instance Method Summary
collapse
Instance Method Details
#analysis_xml(request_xml) ⇒ Object
28
29
30
31
|
# File 'lib/easy_weixin.rb', line 28
def analysis_xml(request_xml)
hash = MultiXml.parse(request_xml)['xml']
source = OpenStruct.new(hash)
end
|
#get_weixin_access_token(appid, appsecret) ⇒ Object
33
34
35
36
|
# File 'lib/easy_weixin.rb', line 33
def get_weixin_access_token(appid, appsecret)
url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=#{appid}&secret=#{appsecret}"
JSON.parse(open(url).read)["access_token"]
end
|
#news_msg(from, to, articles, articleCount) ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/easy_weixin.rb', line 19
def news_msg(from, to, articles, articleCount)
msg = NewsReplyMessage.new
msg.ToUserName = to
msg.FromUserName = from
msg.Articles = articles
msg.ArticleCount = articleCount
msg.to_xml
end
|
#text_msg(from, to, content) ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/easy_weixin.rb', line 11
def text_msg(from, to, content)
msg = TextReplyMessage.new
msg.ToUserName = to
msg.FromUserName = from
msg.Content = content
msg.to_xml
end
|