module Wechat::Core::Common

Constants

ERROR_CODES

mp.weixin.qq.com/wiki/17/fa4e1434e57290788bde25603fa2fcbd.html $('table#ec-t').find('tr').each(function(index, line) {

console.log($(line).find('td:first').text().trim()+" => '"+$(line).find('td:last').text().trim()+"',");

});

LANGUAGE_ENGLISH
LANGUAGE_SIMPLIFIED_CHINESE
LANGUAGE_TRANDITIONAL_CHINESE

Public Instance Methods

assert_present!(name, value) click to toggle source

判断给定的参数 value 是否为空,如果为空,则抛出 ArgumentError 异常。参数名为 name 。例如: assert_present! :access_token, access_token

# File lib/wechat/core/common.rb, line 148
def assert_present!(name, value)
  raise ArgumentError.new("The #{name} argument is required.") if value.blank?
end
get_json(link, body: {}) click to toggle source

向链接 link 发出 GET 请求,参数为 body 指定的 Hash。返回的数据结构必须为 JSON 格式。如: get_json 'api.product.com/path/resources.json', body: { page: 2, per_page: 5 }

# File lib/wechat/core/common.rb, line 155
def get_json(link, body: {})
  assert_present! :link, link
  message = JSONClient.new.get link, body
  message.body
end
post_json(link, body: {}) click to toggle source

向链接 link 发出 GET 请求,参数为 body 指定的 Hash。返回的数据结构必须为 JSON 格式。如: post_json 'api.product.com/path/resources.json', body: { name: 'Some Name' }

# File lib/wechat/core/common.rb, line 164
def post_json(link, body: {})
  assert_present! :link, link
  message = JSONClient.new.post link, body
  message.body
end