Class: Wechat::Core::ServerAddress

Inherits:
Object
  • Object
show all
Extended by:
Common
Defined in:
lib/wechat/core/server_address.rb

Constant Summary

Constants included from Common

Common::ERROR_CODES, Common::LANGUAGE_ENGLISH, Common::LANGUAGE_SIMPLIFIED_CHINESE, Common::LANGUAGE_TRANDITIONAL_CHINESE

Class Method Summary collapse

Methods included from Common

assert_present!, get_json, post_json

Class Method Details

.index(access_token) ⇒ Object

获取微信服务器IP地址mp.weixin.qq.com/wiki/0/2ad4b6bfd29f30f71d39616c2a0fcedc.html

Return hash format if success: { ip_list: [ <IP_ADDRESS_1>, <IP_ADDRESS_2>, … ] }



10
11
12
13
14
15
16
# File 'lib/wechat/core/server_address.rb', line 10

def self.index(access_token)

  assert_present! :access_token, access_token

  message = get_json 'https://api.weixin.qq.com/cgi-bin/getcallbackip', body: { access_token: access_token }
  message.body
end