Module: WechatPublic::Responder

Extended by:
ActiveSupport::Concern
Defined in:
lib/wechat/responder.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#get_uid(params) ⇒ Object

if response.respond_to? :to_xml

  render xml: response.to_xml
else
  render :nothing => true, :status => 200, :content_type => 'text/html'
end

end



97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/wechat/responder.rb', line 97

def get_uid params
  request = WechatPublic::Message.from_hash(params[:xml] || post_xml)
  response = self.class.responder_for(request) do |responder, *args|
    responder ||= self.class.responders(:login).first

    next if responder.nil?
    next request.reply.text responder[:respond] if (responder[:respond])
    next responder[:proc].call(*args.unshift(request)) if (responder[:proc])
  end
  {
    request: request,
    response: response
  }
end