wechat-core 0.4 → 0.4.1
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 +7 -0
- data/Gemfile.lock +14 -2
- data/ROADMAP.md +7 -0
- data/lib/wechat/core/access_token.rb +7 -1
- data/lib/wechat/core/follower.rb +1 -3
- data/lib/wechat/core/follower_profile.rb +4 -8
- data/lib/wechat/core/server_address.rb +1 -3
- data/lib/wechat/core/tiny_link.rb +1 -3
- data/lib/wechat/core/version.rb +1 -1
- data/lib/wechat/core.rb +3 -0
- data/wechat-core.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 652dce668279af5ec743b29fc94dda40144596ec
|
4
|
+
data.tar.gz: b06e70285eea750ae85dd147d55d4d94ebc69d98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ab34f8906dc3028c66c342145d6777a7355567935274e4e964f0f878580613feebd631054d9c07aa5b840f0ecf7b162be93108d3cb726e142ef65fdf25bca1e
|
7
|
+
data.tar.gz: bed85f1de53c1c9112fe0793ef808f9475c8e91b436de09ea312d9253ea46b343f23403d7e5029383cf89d016d11935cdb883afc26da29c76a176c36c8bfc744
|
data/CHANGELOG.md
CHANGED
@@ -21,3 +21,10 @@
|
|
21
21
|
6. Improve the Server Address wrapper class for the argument validation
|
22
22
|
7. Improve the Tiny Link wrapper class for the argument validation
|
23
23
|
8. Improve the Access Token wrapper class to deprecate ::load method, use the Access Token ::create method instead
|
24
|
+
|
25
|
+
## v0.4.1
|
26
|
+
1. Improve the Access Token wrapper class for the HTTP request
|
27
|
+
2. Improve the Follower wrapper class for the HTTP request
|
28
|
+
3. Improve the Follower Profile wrapper class for the HTTP request
|
29
|
+
4. Improve the Server Address wrapper class for the HTTP request
|
30
|
+
5. Improve the Tiny Link wrapper class for the HTTP request
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,23 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
wechat-core (0.4)
|
4
|
+
wechat-core (0.4.1)
|
5
|
+
activesupport (>= 4.2)
|
5
6
|
httpclient (>= 2.8)
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
11
|
+
activesupport (5.0.0.1)
|
12
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
|
+
i18n (~> 0.7)
|
14
|
+
minitest (~> 5.1)
|
15
|
+
tzinfo (~> 1.1)
|
16
|
+
concurrent-ruby (1.0.2)
|
10
17
|
diff-lcs (1.2.5)
|
11
|
-
httpclient (2.8.
|
18
|
+
httpclient (2.8.2.4)
|
19
|
+
i18n (0.7.0)
|
20
|
+
minitest (5.9.1)
|
12
21
|
rake (10.5.0)
|
13
22
|
rspec (3.4.0)
|
14
23
|
rspec-core (~> 3.4.0)
|
@@ -23,6 +32,9 @@ GEM
|
|
23
32
|
diff-lcs (>= 1.2.0, < 2.0)
|
24
33
|
rspec-support (~> 3.4.0)
|
25
34
|
rspec-support (3.4.1)
|
35
|
+
thread_safe (0.3.5)
|
36
|
+
tzinfo (1.2.2)
|
37
|
+
thread_safe (~> 0.1)
|
26
38
|
|
27
39
|
PLATFORMS
|
28
40
|
ruby
|
data/ROADMAP.md
CHANGED
@@ -22,6 +22,13 @@
|
|
22
22
|
7. Improve the Tiny Link wrapper class for the argument validation
|
23
23
|
8. Improve the Access Token wrapper class to deprecate ::load method, use the Access Token ::create method instead
|
24
24
|
|
25
|
+
## v0.4.1
|
26
|
+
1. Improve the Access Token wrapper class for the HTTP request
|
27
|
+
2. Improve the Follower wrapper class for the HTTP request
|
28
|
+
3. Improve the Follower Profile wrapper class for the HTTP request
|
29
|
+
4. Improve the Server Address wrapper class for the HTTP request
|
30
|
+
5. Improve the Tiny Link wrapper class for the HTTP request
|
31
|
+
|
25
32
|
## v1.0
|
26
33
|
1. Improve the Follower & Follower Profile wrapper class to support the Keyword Arguments
|
27
34
|
2. Removed the depreated classes and methods
|
@@ -37,7 +37,13 @@ class Wechat::Core::AccessToken
|
|
37
37
|
assert_present! :app_id, app_id
|
38
38
|
assert_present! :app_secret, app_secret
|
39
39
|
|
40
|
-
message = ::JSONClient.new.get 'https://api.weixin.qq.com/cgi-bin/token',
|
40
|
+
#message = ::JSONClient.new.get 'https://api.weixin.qq.com/cgi-bin/token',
|
41
|
+
# {
|
42
|
+
# grant_type: 'client_credential',
|
43
|
+
# appid: app_id, # Rails.application.secrets.wechat_app_id,
|
44
|
+
# secret: app_secret, # Rails.application.secrets.wechat_app_secret
|
45
|
+
# }
|
46
|
+
message = get_json 'https://api.weixin.qq.com/cgi-bin/token', body:
|
41
47
|
{
|
42
48
|
grant_type: 'client_credential',
|
43
49
|
appid: app_id, # Rails.application.secrets.wechat_app_id,
|
data/lib/wechat/core/follower.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'jsonclient'
|
2
|
-
|
3
1
|
class Wechat::Core::Follower
|
4
2
|
|
5
3
|
extend Wechat::Core::Common
|
@@ -21,7 +19,7 @@ class Wechat::Core::Follower
|
|
21
19
|
options = { access_token: access_token }
|
22
20
|
options[:next_openid] = next_open_id if next_open_id.present?
|
23
21
|
|
24
|
-
message =
|
22
|
+
message = get_json 'https://api.weixin.qq.com/cgi-bin/user/get', body: options
|
25
23
|
message.body
|
26
24
|
end
|
27
25
|
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'jsonclient'
|
2
|
-
|
3
1
|
class Wechat::Core::FollowerProfile
|
4
2
|
|
5
3
|
extend Wechat::Core::Common
|
@@ -31,11 +29,10 @@ class Wechat::Core::FollowerProfile
|
|
31
29
|
def self.index(access_token, open_ids, language: Wechat::Core::Common::LANGUAGE_SIMPLIFIED_CHINESE)
|
32
30
|
|
33
31
|
assert_present! :access_token, access_token
|
34
|
-
assert_present! :open_ids,
|
35
|
-
#raise ArgumentError.new('The access_token argument is required.') if access_token.blank?
|
32
|
+
assert_present! :open_ids, open_ids
|
36
33
|
|
37
34
|
followers = open_ids.map { |open_id| { openid: open_id, lang: language } }
|
38
|
-
message
|
35
|
+
message = post_json "https://api.weixin.qq.com/cgi-bin/user/info/batchget?access_token=#{access_token}", body: { user_list: followers }
|
39
36
|
message.body
|
40
37
|
|
41
38
|
end
|
@@ -62,10 +59,9 @@ class Wechat::Core::FollowerProfile
|
|
62
59
|
def self.load(access_token, open_id, language: 'zh_CN')
|
63
60
|
|
64
61
|
assert_present! :access_token, access_token
|
65
|
-
assert_present! :open_id,
|
66
|
-
#raise ArgumentError.new('The access_token argument is required.') if access_token.blank?
|
62
|
+
assert_present! :open_id, open_id
|
67
63
|
|
68
|
-
message =
|
64
|
+
message = get_json 'https://api.weixin.qq.com/cgi-bin/user/info', body:
|
69
65
|
{
|
70
66
|
access_token: access_token,
|
71
67
|
openid: open_id,
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'jsonclient'
|
2
|
-
|
3
1
|
class Wechat::Core::ServerAddress
|
4
2
|
|
5
3
|
extend Wechat::Core::Common
|
@@ -13,7 +11,7 @@ class Wechat::Core::ServerAddress
|
|
13
11
|
|
14
12
|
assert_present! :access_token, access_token
|
15
13
|
|
16
|
-
message =
|
14
|
+
message = get_json 'https://api.weixin.qq.com/cgi-bin/getcallbackip', body: { access_token: access_token }
|
17
15
|
message.body
|
18
16
|
end
|
19
17
|
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'jsonclient'
|
2
|
-
|
3
1
|
class Wechat::Core::TinyLink
|
4
2
|
|
5
3
|
extend Wechat::Core::Common
|
@@ -25,7 +23,7 @@ class Wechat::Core::TinyLink
|
|
25
23
|
assert_present! :access_token, access_token
|
26
24
|
assert_present! :link, link
|
27
25
|
|
28
|
-
message =
|
26
|
+
message = post_json "https://api.weixin.qq.com/cgi-bin/shorturl?access_token=#{access_token}", body:
|
29
27
|
{
|
30
28
|
action: 'long2short',
|
31
29
|
long_url: link
|
data/lib/wechat/core/version.rb
CHANGED
data/lib/wechat/core.rb
CHANGED
data/wechat-core.gemspec
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:
|
4
|
+
version: 0.4.1
|
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-
|
11
|
+
date: 2016-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activesupport
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '4.2'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '4.2'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: httpclient
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|