wechat-adapter 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ba03d3c0d5a5e9b5c91d9e35443aba76bf43e6d
4
- data.tar.gz: bae6d64a3ffd03934e1e343b6464d940b0ec322e
3
+ metadata.gz: c716aafff25722907fdc7d35c5a05373c04d15a9
4
+ data.tar.gz: 0b4dc1cb58131080de865116f36b72659f8bf98d
5
5
  SHA512:
6
- metadata.gz: a394b3662466d77b8c931e29f47f4136eafaa6061ee1f66a02484c1c15a371fba35c90e9d2ca9eb810e88b3e75e953d091b6c83b2cda1f2682861cd9068038f8
7
- data.tar.gz: a9d420088eaa665b89339a3b61398a398e10d0b8d6ac03eca4e16c232bf29612c42eab8748909fff7ffe881ba5607c1cc13b2d60a3d26f345d93bf080ed8214e
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
@@ -1,5 +1,5 @@
1
1
  module Wechat
2
2
  module Adapter
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -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(client).to receive(:execute) { access_token_response }
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 token" do
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(client).to receive(:execute) do |args|
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(client).to receive(:execute) do |args|
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(client).to receive(:execute) do |args|
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wechat-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lu, Jun