Method: Wechat::Message#as
- Defined in:
- lib/wechat/message.rb
#as(type) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/wechat/message.rb', line 85 def as(type) case type when :text [:Content] when :image, :voice, :video Wechat.api.media([:MediaId]) when :location .slice(:Location_X, :Location_Y, :Scale, :Label).each_with_object({}) do |value, results| results[value[0].to_s.underscore.to_sym] = value[1] end else raise "Don't know how to parse message as #{type}" end end |