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
271d3e9b
Commit
271d3e9b
authored
Sep 21, 2021
by
mingyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
for to qeury
parent
986139a1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
saas.rb
app/apis/dingtalk/api/inner/saas.rb
+6
-1
saas.rb
app/apis/dingtalk/api/saas.rb
+6
-2
No files found.
app/apis/dingtalk/api/inner/saas.rb
View file @
271d3e9b
...
...
@@ -32,7 +32,12 @@ module Dingtalk::Api
payload
=
{
receiverIds:
Array
(
receiver_ids
).
join
(
','
),
tenantId:
app
.
tenant_id
,
msg:
%Q({"msgtype":"text","text":{"content":
#{
text
}
}})
msg:
{
msgtype:
'text'
,
text:
{
content:
text
}
}.
to_json
}
r
=
post
'/message/workNotification'
,
**
payload
...
...
app/apis/dingtalk/api/saas.rb
View file @
271d3e9b
...
...
@@ -13,7 +13,7 @@ module Dingtalk::Api
def
post
(
path
,
params:
{},
headers:
{},
base:
app
.
base_url
,
**
payload
)
with_access_token
(
'post'
,
path
,
params
,
headers
,
payload
)
do
|
processed_params
,
processed_headers
|
@client
.
post
path
,
payload
.
to_query
,
headers:
processed_headers
,
params:
processed_params
,
base:
base
@client
.
post
path
,
payload
.
map
(
&->
(
k
,
v
){
"
#{
k
}
=
#{
v
}
"
}).
sort!
.
join
(
'&'
)
,
headers:
processed_headers
,
params:
processed_params
,
base:
base
end
end
...
...
@@ -45,7 +45,11 @@ module Dingtalk::Api
headers
[
:'X-Hmac-Auth-Nonce'
],
path
]
result
<<
params
.
merge
(
payload
).
to_query
if
params
.
present?
||
payload
.
present?
if
params
.
present?
||
payload
.
present?
r
=
params
.
merge
(
payload
)
r
=
r
.
map
(
&->
(
k
,
v
){
"
#{
k
}
=
#{
v
}
"
}).
sort!
.
join
(
'&'
)
result
<<
r
end
signature
=
OpenSSL
::
HMAC
.
digest
(
'SHA256'
,
app
.
app_secret
,
result
.
join
(
"
\n
"
))
headers
.
merge!
'X-Hmac-Auth-Signature'
:
Base64
.
strict_encode64
(
signature
)
end
...
...
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