wechat-core 0.1 → 0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +4 -0
- data/ROADMAP.md +7 -7
- data/lib/wechat/core/server_address.rb +15 -0
- data/lib/wechat/core/tiny_link.rb +16 -0
- data/lib/wechat/core/version.rb +1 -1
- data/lib/wechat/core.rb +6 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 556c580d303e3e1665437c1e25e219282420b1e2
|
4
|
+
data.tar.gz: e9acc768a0b597192b08b1dd4dbb3afbfbd3cc09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94f35a815f9efe1ba20995cf9ba124db5e9aa59714a9ac526e810eaf45e368df4459e2afae178157d995d0bc83fd5c7259cbdd94423451a4adeb3ec5bce04ad2
|
7
|
+
data.tar.gz: 5f6abd7326e2b90224bf4f815cdd89781b24781573e892dc6c12bcc056b14e02ce08c0e04d3e580f930c6d7ec16f6f6aefe0344eec745a833e09fd31da4ac6e7
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Wechat::Core 微信核心库
|
2
2
|
|
3
|
+
[](http://opensource.org/licenses/MIT)
|
4
|
+
[](https://badge.fury.io/rb/wechat-core)
|
5
|
+
|
3
6
|
The Wechat Core Library is a code base to call the Wechat Core APIs.
|
4
7
|
微信核心库用于调用微信核心API。
|
5
8
|
|
@@ -21,6 +24,7 @@ Or install it yourself as:
|
|
21
24
|
|
22
25
|
## Usage
|
23
26
|
|
27
|
+
Get the [Wechat Access Token](http://mp.weixin.qq.com/wiki/14/9f9c82c1af308e3b14ba9b973f99a8ba.html)
|
24
28
|
```ruby
|
25
29
|
response = ::Wechat::Core::AccessToken.load Rails.application.secrets.wechat_app_id, Rails.application.secrets.wechat_app_secret
|
26
30
|
if response.present?
|
data/ROADMAP.md
CHANGED
@@ -2,19 +2,19 @@
|
|
2
2
|
|
3
3
|
## v0.1
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
1. Common module
|
6
|
+
2. Access Token wrapper class
|
7
7
|
|
8
8
|
## v0.2
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
1. Server Address wrapper class
|
11
|
+
2. Tiny Link wrapper class
|
12
12
|
|
13
13
|
## v0.3
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
1. Follower wrapper class
|
16
|
+
2. Follower Profile wrapper class
|
17
17
|
|
18
18
|
# v0.4
|
19
19
|
|
20
|
-
|
20
|
+
1. Logo wrapper class
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'jsonclient'
|
2
|
+
|
3
|
+
class Wechat::Core::ServerAddress
|
4
|
+
|
5
|
+
# 获取微信服务器IP地址
|
6
|
+
# http://mp.weixin.qq.com/wiki/0/2ad4b6bfd29f30f71d39616c2a0fcedc.html
|
7
|
+
#
|
8
|
+
# Return hash format if success:
|
9
|
+
# { ip_list: [ <IP_ADDRESS_1>, <IP_ADDRESS_2>, ... ] }
|
10
|
+
def self.index(access_token)
|
11
|
+
message = ::JSONClient.new.get 'https://api.weixin.qq.com/cgi-bin/getcallbackip', { access_token: access_token }
|
12
|
+
message.body
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'jsonclient'
|
2
|
+
|
3
|
+
class Wechat::Core::TinyLink
|
4
|
+
|
5
|
+
# 长链接转短链接接口
|
6
|
+
# http://mp.weixin.qq.com/wiki/10/165c9b15eddcfbd8699ac12b0bd89ae6.html
|
7
|
+
def self.create(access_token, link)
|
8
|
+
message = ::JSONClient.new.post "https://api.weixin.qq.com/cgi-bin/shorturl?access_token=#{access_token}",
|
9
|
+
{
|
10
|
+
action: 'long2short',
|
11
|
+
long_url: link
|
12
|
+
}
|
13
|
+
message.body
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
data/lib/wechat/core/version.rb
CHANGED
data/lib/wechat/core.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wechat-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -89,6 +89,8 @@ files:
|
|
89
89
|
- lib/wechat/core.rb
|
90
90
|
- lib/wechat/core/access_token.rb
|
91
91
|
- lib/wechat/core/common.rb
|
92
|
+
- lib/wechat/core/server_address.rb
|
93
|
+
- lib/wechat/core/tiny_link.rb
|
92
94
|
- lib/wechat/core/version.rb
|
93
95
|
- wechat-core.gemspec
|
94
96
|
homepage: https://github.com/topbitdu/wechat-core
|