Commit c9fabd0d341955a694df536d630e1904ac059b8e
1 parent
9ecc4b71
Exists in
master
FIX: access token endpoint url
Showing
1 changed file
with
7 additions
and
3 deletions
Show diff stats
lib/dingtalk/api/base.rb
... | ... | @@ -27,7 +27,7 @@ module Dingtalk |
27 | 27 | end |
28 | 28 | |
29 | 29 | def set_corp_access_token |
30 | - res = http_get("gettoken?corpid=#{@corp.corp_id}&corpsecret=#{@corp.corp_secret}") | |
30 | + res = http_get("#{ENDPOINT}/gettoken?corpid=#{@corp.corp_id}&corpsecret=#{@corp.corp_secret}") | |
31 | 31 | key = "#{@corp.corp_id}_#{ACCESS_TOKEN}" |
32 | 32 | redis.set(key, res['access_token']) |
33 | 33 | redis.expire(key, 60) |
... | ... | @@ -36,7 +36,7 @@ module Dingtalk |
36 | 36 | |
37 | 37 | def set_js_ticket |
38 | 38 | key = "#{@corp.corp_id}_#{JS_TICKET}" |
39 | - res = http_get("get_jsapi_ticket?access_token=#{access_token}") | |
39 | + res = http_get("#{ENDPOINT}/get_jsapi_ticket?access_token=#{access_token}") | |
40 | 40 | redis.set(key, res['ticket']) |
41 | 41 | # redis.expire(key, res['expires_in']) |
42 | 42 | redis.expire(key, 6600) |
... | ... | @@ -71,7 +71,11 @@ module Dingtalk |
71 | 71 | end |
72 | 72 | |
73 | 73 | def request_url(url) |
74 | - "#{ENDPOINT}/#{base_url}/#{url}" | |
74 | + if url.start_with?('https') | |
75 | + url | |
76 | + else | |
77 | + "#{ENDPOINT}/#{base_url}/#{url}" | |
78 | + end | |
75 | 79 | end |
76 | 80 | |
77 | 81 | def redis | ... | ... |