Method: Fastlane::Actions::WorkWechatAction.news_http_body

Defined in:
lib/fastlane/plugin/work_wechat/actions/work_wechat_action.rb

.news_http_body(params) ⇒ Object



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/fastlane/plugin/work_wechat/actions/work_wechat_action.rb', line 99

def self.news_http_body(params)
  news_title = params[:news_title]
  news_description = params[:news_description]
  news_url = params[:news_url]
  news_picurl = params[:news_picurl]



  body = {}
  body['msgtype'] = "news"
  
#   {
#     "msgtype": "news",
#     "news": {
#        "articles" : [
#            {
#                "title" : "中秋节礼品领取",
#                "description" : "今年中秋节公司有豪礼相送",
#                "url" : "www.qq.com",
#                "picurl" : "http://res.mail.qq.com/node/ww/wwopenmng/images/independent/doc/test_pic_msg1.png"
#            }
#         ]
#     }
# }
  article = { 'title'=>news_title, 'url'=>news_url}
  article['description'] = news_description if news_description
  article['picurl'] = news_picurl if news_picurl
  articles = [article]
  body['news'] = {'articles'=>articles}
  body.to_json
end