Skip to content

Commit

Permalink
Merge pull request Eric-Guo#260 from paicha/master
Browse files Browse the repository at this point in the history
ADD: support wxa_get_wxacode_unlimit API for miniapp
  • Loading branch information
Eric-Guo authored Jun 3, 2019
2 parents 310f0ca + b2d66ff commit 44c892d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/wechat/concern/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ def wxa_get_wxacode(path, width = 430)
post 'getwxacode', JSON.generate(path: path, width: width), base: WXA_BASE
end

def wxa_get_wxacode_unlimit(scene, page = nil, width = 430)
post 'getwxacodeunlimit', JSON.generate(scene: scene, page: page, width: width), base: WXA_BASE
end

def wxa_create_qrcode(path, width = 430)
post 'wxaapp/createwxaqrcode', JSON.generate(path: path, width: width)
end
Expand Down
15 changes: 15 additions & 0 deletions spec/lib/wechat/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,21 @@
end
end

describe '#wxa_get_wxacode_unlimit' do
wxacode_result = { errcode: 0, errmsg: 'ok',
url: 'wxa_code_pic_url' }

specify 'will post wxa_get_wxacode_unlimit with scene, page, width and access_token' do
scene = 'query=1'
page = 'pages/index'
wxa_get_wxacode_unlimit_req = { scene: scene, page: page, width: 430 }
expect(subject.client).to receive(:post)
.with('getwxacodeunlimit', JSON.generate(wxa_get_wxacode_unlimit_req),
params: { access_token: 'access_token' }, base: Wechat::Api::WXA_BASE).and_return(wxacode_result)
expect(subject.wxa_get_wxacode_unlimit(scene, page)).to eq wxacode_result
end
end

describe '#wxa_create_qrcode' do
qrcode_result = { errcode: 0, errmsg: 'ok',
url: 'qr_code_pic_url' }
Expand Down

0 comments on commit 44c892d

Please sign in to comment.