Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rails_dingtalk
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
other
rails_dingtalk
Commits
f88d9746
Commit
f88d9746
authored
Sep 05, 2021
by
mingyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new app get access token
parent
dc2542da
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
7 deletions
+15
-7
Gemfile.lock
Gemfile.lock
+1
-1
api.rb
app/apis/dingtalk/api.rb
+1
-0
base_new.rb
app/apis/dingtalk/api/base_new.rb
+9
-1
app.rb
app/models/dingtalk/model/app.rb
+2
-3
new_app.rb
app/models/dingtalk/model/app/new_app.rb
+2
-2
No files found.
Gemfile.lock
View file @
f88d9746
...
@@ -7,7 +7,7 @@ GIT
...
@@ -7,7 +7,7 @@ GIT
GIT
GIT
remote: https://github.com/work-design/rails_com.git
remote: https://github.com/work-design/rails_com.git
revision:
806cc320be3056c8c53cc6c8d89461216e898546
revision:
96b28af01b4a3aaca389ea4b44b33e869e01a67c
specs:
specs:
rails_com (1.2.9)
rails_com (1.2.9)
acme-client
acme-client
...
...
app/apis/dingtalk/api.rb
View file @
f88d9746
require
'dingtalk/http_client'
require
'dingtalk/http_client'
require
'dingtalk/api/base'
require
'dingtalk/api/base'
require
'dingtalk/api/base_new'
app/apis/dingtalk/api/base_new.rb
View file @
f88d9746
...
@@ -3,7 +3,15 @@ module Dingtalk::Api
...
@@ -3,7 +3,15 @@ module Dingtalk::Api
BASE
=
'https://api.dingtalk.com/'
BASE
=
'https://api.dingtalk.com/'
def
token
def
token
@client
.
post
'v1.0/oauth2/userAccessToken'
,
{
clientId:
app
.
app_key
,
clientSecret:
app
.
app_secret
}.
to_json
,
base:
BASE
payload
=
{
appKey:
app
.
app_key
,
appSecret:
app
.
app_secret
,
}
r
=
@client
.
post
'v1.0/oauth2/accessToken'
,
payload
.
to_json
,
base:
BASE
{
'access_token'
=>
r
[
'accessToken'
],
'expires_in'
=>
r
[
'expireIn'
]
}
end
end
end
end
...
...
app/models/dingtalk/model/app.rb
View file @
f88d9746
...
@@ -11,7 +11,6 @@ module Dingtalk
...
@@ -11,7 +11,6 @@ module Dingtalk
attribute
:corp_id
,
:string
attribute
:corp_id
,
:string
attribute
:access_token
,
:string
attribute
:access_token
,
:string
attribute
:access_token_expires_at
,
:datetime
attribute
:access_token_expires_at
,
:datetime
attribute
:refresh_token
,
:string
attribute
:jsapi_ticket
,
:string
attribute
:jsapi_ticket
,
:string
attribute
:oauth2_state
,
:string
attribute
:oauth2_state
,
:string
attribute
:jsapi_ticket_expires_at
,
:datetime
attribute
:jsapi_ticket_expires_at
,
:datetime
...
@@ -42,9 +41,9 @@ module Dingtalk
...
@@ -42,9 +41,9 @@ module Dingtalk
access_token_expires_at
>
Time
.
current
access_token_expires_at
>
Time
.
current
end
end
def
jsapi_ticket
def
get_
jsapi_ticket
if
jsapi_ticket_valid?
if
jsapi_ticket_valid?
super
jsapi_ticket
else
else
refresh_jsapi_ticket
refresh_jsapi_ticket
end
end
...
...
app/models/dingtalk/model/app/new_app.rb
View file @
f88d9746
module
Dingtalk
::Model
module
Dingtalk
module
App::NewApp
module
Model::
App::NewApp
def
api
def
api
return
@api
if
defined?
@api
return
@api
if
defined?
@api
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment