lib/wechat/api/client.rb in wechat-api-0.1.1 vs lib/wechat/api/client.rb in wechat-api-0.1.3
- old
+ new
@@ -40,10 +40,10 @@
url = format('%stoken', API_BASE)
resp = connection.get(url, token_params)
response = MultiJson.load(resp.body)
return handle_error(response) if response['errcode']
@access_token = response['access_token']
- File.open(@token_file, 'w') { |f| f.write(resp.body) } if token
+ File.open(@token_file, 'w') { |f| f.write(resp.body) } if @access_token
@access_token
end
def get(uri, params = {})
with_access_token(uri, params) do |url, params_with_token|