weixin_authorize 1.5.6 → 1.5.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZWIzYzY2N2NmMTJjYmZmOThjZDQ1ZmZkMDVlZmVjOGIxNDYwNjgyOQ==
5
- data.tar.gz: !binary |-
6
- OTNkNzc1MmNjY2I1MGZlNjE0YmI0ZTZhZDc4ZTZiMDZlNzcwM2U3Yw==
2
+ SHA1:
3
+ metadata.gz: d129bc3d015de739c581be31a890d2d69a660c3c
4
+ data.tar.gz: 0733221f98d69e18fcc590b722b5ca65b6e160a1
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- N2ZlNTJmMWQxNDFlZDMzYzQ1MDhhNDE4ZDU5OGUwM2E0ZDRkNjg3YmMwMTVm
10
- OWE1MDlhMzg4MzBjMDMzNDY2NmNkMDUwYjlkMDM1MjVmNjc2YjdkOTlhZmQz
11
- ODZmZTE1YjY1YjFiNDg4MTk4MzRlYTg2MGJlYjg5ZTFlY2E5NDk=
12
- data.tar.gz: !binary |-
13
- ZDg4MjkwYzRhODM0YWYxYWE4NjI4MzhhOWMyNWMzZDQ2ZTdlOTllMjFhZDFl
14
- NGI3NjAwYmQzYTI5ZTlhM2Y0MmRkYmNkMjRjN2M5ODNhMGQ5MjNkOTI1NGQ3
15
- NjRmZWQyMTQxYjZlYWMyYTJlZjNlYWZjMWM1OTc5ZDMxODVkNDQ=
6
+ metadata.gz: ce78111847c32d86347750e4801ab110129c96759ef5e96ec6d8554abda6da4a0ed4859573379f7c061f2eab9f93230f0c0f5930215474b3a1c7ded42dd01e49
7
+ data.tar.gz: 9ce24065e53e9fdc5be18244541d018f333377f5bece38d8639ffe79f617a775cc6afdfc6975482fa3383c1e1e942cd7856275dd51fa37b6aaebe37cff498dcc
data/README.md CHANGED
@@ -17,6 +17,8 @@ export OPENID="your weixin openid"
17
17
  ```
18
18
  Last, you have to **open a new terminal tag (Reload bash_profile)** , and run `rspec .`
19
19
 
20
+ **微信API挺SB,客服消息API,如果出现45015(回复时间超过限制),那么需要取消关注测试账号,然后再重新关注一次即可。另外,创建用户分组API刚开始测试的时候是OK的,后来会出现-1(系统繁忙),然后一直是这样。**
21
+
20
22
  ## Contributing
21
23
 
22
24
  1. Fork it
@@ -27,7 +27,7 @@ module WeixinAuthorize
27
27
  end
28
28
 
29
29
  def weixin_redis
30
- WeixinAuthorize.config.redis
30
+ WeixinAuthorize.weixin_redis
31
31
  end
32
32
 
33
33
  end
@@ -10,7 +10,7 @@ module WeixinAuthorize
10
10
  end
11
11
 
12
12
  def self.init_with(client)
13
- if WeixinAuthorize.config.redis.nil?
13
+ if WeixinAuthorize.weixin_redis.nil?
14
14
  ClientStorage.new(client)
15
15
  else
16
16
  RedisStorage.new(client)
@@ -7,6 +7,11 @@ module WeixinAuthorize
7
7
  def configure
8
8
  yield self.config ||= Config.new
9
9
  end
10
+
11
+ def weixin_redis
12
+ return nil if WeixinAuthorize.config.nil?
13
+ @redis ||= WeixinAuthorize.config.redis
14
+ end
10
15
  end
11
16
 
12
17
  class Config
@@ -1,3 +1,3 @@
1
1
  module WeixinAuthorize
2
- VERSION = "1.5.6"
2
+ VERSION = "1.5.7"
3
3
  end
@@ -28,5 +28,17 @@ describe WeixinAuthorize::Client do
28
28
  $client_2 = WeixinAuthorize::Client.new("appid_2", "app_secret_2")
29
29
  expect{$client_2.get_access_token}.to raise_error(RuntimeError)
30
30
  end
31
+
32
+ it "#token_expired return the different access_token after token is expired" do
33
+ token_1 = $client.get_access_token
34
+ if WeixinAuthorize.weixin_redis.nil?
35
+ $client.expired_at = Time.now.to_i - 7300
36
+ else
37
+ WeixinAuthorize.weixin_redis.del($client.redis_key)
38
+ end
39
+ token_2 = $client.get_access_token
40
+ expect(token_1).to_not eq(token_2)
41
+ end
42
+
31
43
  end
32
44
  end
@@ -5,6 +5,14 @@ describe WeixinAuthorize::Api::Custom do
5
5
  "text Custom message"
6
6
  end
7
7
 
8
+ let(:image_path) do
9
+ "#{File.dirname(__FILE__)}/medias/ruby-logo.jpg"
10
+ end
11
+
12
+ let(:image_file) do
13
+ File.new(image_path)
14
+ end
15
+
8
16
  it "#send_text_custom" do
9
17
  response = $client.send_text_custom(ENV["OPENID"], text_message)
10
18
  expect(response["errcode"]).to eq(0)
@@ -28,8 +36,10 @@ describe WeixinAuthorize::Api::Custom do
28
36
  end
29
37
 
30
38
  it "#send_image_custom" do
31
- pending("The test must have a media_id")
32
- this_should_not_get_executed
39
+ image = $client.upload_media(image_file, "image")
40
+ media_id = image["media_id"]
41
+ response = $client.send_image_custom(ENV["OPENID"], media_id)
42
+ expect(response["errcode"]).to eq(0)
33
43
  end
34
44
 
35
45
  it "#send_video_custom" do
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weixin_authorize
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.6
4
+ version: 1.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - lanrion
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-31 00:00:00.000000000 Z
11
+ date: 2014-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.6.7
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.6.7
27
27
  - !ruby/object:Gem::Dependency
@@ -70,14 +70,14 @@ dependencies:
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
@@ -156,12 +156,12 @@ require_paths:
156
156
  - lib
157
157
  required_ruby_version: !ruby/object:Gem::Requirement
158
158
  requirements:
159
- - - ! '>='
159
+ - - '>='
160
160
  - !ruby/object:Gem::Version
161
161
  version: '0'
162
162
  required_rubygems_version: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ! '>='
164
+ - - '>='
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  requirements: []