Class: Wechat::Core::ServerAddress

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

Overview

Server Address 是服务器地址的远程调用封装类。

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>, … ] }



14
15
16
17
18
19
20
# File 'lib/wechat/core/server_address.rb', line 14

def self.index(access_token)

  assert_present! :access_token, access_token

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

end