class WeChat::Bot::MessageData::ShareCard
Attributes
app[R]
@return [String, Nil]
description[R]
@return [String]
from_user[R]
@return [String]
link[R]
@return [String]
mp[R]
@return [Hash<Symbol, String>, Hash<Symbol, Nil>]
thumb_image[R]
@return [String, Nil]
title[R]
@return [String]
Public Class Methods
new(raw)
click to toggle source
# File lib/wechat/bot/message_data/share_card.rb, line 28 def initialize(raw) @raw = MultiXml.parse(raw.gsub("<br/>", "")) parse end
parse(raw)
click to toggle source
# File lib/wechat/bot/message_data/share_card.rb, line 3 def self.parse(raw) self.new(raw) end
Public Instance Methods
parse()
click to toggle source
# File lib/wechat/bot/message_data/share_card.rb, line 33 def parse @title = @raw["msg"]["appmsg"]["title"] @link = @raw["msg"]["appmsg"]["url"] @description = @raw["msg"]["appmsg"]["des"] @thumb_image = @raw["msg"]["appmsg"]["thumb_url"] @from_user = @raw["msg"]["fromusername"] @app = @raw["msg"]["appname"] @mp = { username: @raw["msg"]["sourceusername"], nickname: @raw["msg"]["sourcedisplayname"], } end