wechat-adapter 0.0.2 → 0.0.3
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/README.md +0 -8
- data/lib/wechat/adapter/version.rb +1 -1
- data/spec/adapter_spec.rb +5 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c716aafff25722907fdc7d35c5a05373c04d15a9
|
4
|
+
data.tar.gz: 0b4dc1cb58131080de865116f36b72659f8bf98d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fead32777f09fce40d69d3ecba0b034dc54484ea9d7e4bcec1af4484ecb62dad53a816baaf0e21abd529ce59d622e234c65e24ddc7b21c2534061a05749411e2
|
7
|
+
data.tar.gz: 27abcc4a97aca4c9b4d9cd47bbdf87688c19723dc1a48842420bcab4e8f119237306fc9b76c86ed42efc7434f2f9c8a99f81337ec6f029f1e6a50afb4bdf30f8
|
data/README.md
CHANGED
@@ -31,11 +31,3 @@ api = WechatAPI.new(appid, appsecret)
|
|
31
31
|
|
32
32
|
api.get 'menu/get'
|
33
33
|
```
|
34
|
-
|
35
|
-
## Contributing
|
36
|
-
|
37
|
-
1. Fork it ( https://github.com/[my-github-username]/wechat-adapter/fork )
|
38
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
39
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
40
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
41
|
-
5. Create a new Pull Request
|
data/spec/adapter_spec.rb
CHANGED
@@ -17,18 +17,17 @@ describe Wechat::Adapter do
|
|
17
17
|
}]
|
18
18
|
}
|
19
19
|
|
20
|
-
let (:client) { RestClient::Request = double }
|
21
20
|
let (:app) { Wechat::Adapter::WechatAPI.new(appid, appsecret, base_url)}
|
22
21
|
|
23
22
|
it "should be able to get access token" do
|
24
23
|
|
25
24
|
access_token_response = double
|
26
25
|
allow(access_token_response).to receive(:body).and_return({ :access_token => access_token, :expires_in => 7200}.to_json)
|
27
|
-
allow(
|
26
|
+
allow(RestClient::Request).to receive(:execute) { access_token_response }
|
28
27
|
expect(app.aquire_access_token).to eq(access_token)
|
29
28
|
end
|
30
29
|
|
31
|
-
it "should be able to get menu
|
30
|
+
it "should be able to get menu" do
|
32
31
|
access_token_response = double
|
33
32
|
allow(access_token_response).to receive(:body).and_return({:access_token => access_token, :expires_in => 7200}.to_json)
|
34
33
|
|
@@ -41,7 +40,7 @@ describe Wechat::Adapter do
|
|
41
40
|
menu_retrieve_method = double
|
42
41
|
expect(menu_retrieve_method).to receive(:invoke).exactly(10).times
|
43
42
|
|
44
|
-
allow(
|
43
|
+
allow(RestClient::Request).to receive(:execute) do |args|
|
45
44
|
case args[:url]
|
46
45
|
when "https://api.weixin.qq.com/cgi-bin/token" then
|
47
46
|
expect(args[:method]).to eq(:get)
|
@@ -73,7 +72,7 @@ describe Wechat::Adapter do
|
|
73
72
|
menu_delete_response = double
|
74
73
|
allow(menu_delete_response).to receive(:body).and_return({:errcode => 0, :errmsg => "ok"}.to_json)
|
75
74
|
|
76
|
-
allow(
|
75
|
+
allow(RestClient::Request).to receive(:execute) do |args|
|
77
76
|
case args[:url]
|
78
77
|
when "https://api.weixin.qq.com/cgi-bin/token" then access_token_response
|
79
78
|
when "https://api.weixin.qq.com/cgi-bin/menu/delete" then
|
@@ -94,7 +93,7 @@ describe Wechat::Adapter do
|
|
94
93
|
menu_create_response = double
|
95
94
|
allow(menu_create_response).to receive(:body).and_return({:errcode => 0, :errmsg => "ok"}.to_json)
|
96
95
|
|
97
|
-
allow(
|
96
|
+
allow(RestClient::Request).to receive(:execute) do |args|
|
98
97
|
case args[:url]
|
99
98
|
when "https://api.weixin.qq.com/cgi-bin/token" then access_token_response
|
100
99
|
when "https://api.weixin.qq.com/cgi-bin/menu/create" then
|