Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dingtalk-sdk
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
open-source
dingtalk-sdk
Commits
153f3d43
Commit
153f3d43
authored
Oct 27, 2020
by
Francis Zhou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reject nil args when sending request
parent
04d34fee
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
core.rb
lib/dingtalk_sdk/core.rb
+9
-3
No files found.
lib/dingtalk_sdk/core.rb
View file @
153f3d43
...
...
@@ -11,7 +11,9 @@ require 'dingtalk_sdk'
module
DingtalkSdk
module
Core
class
RequestBuilder
attr_reader
:query_args
,
:body_args
,
:query_const
,
:body_const
,
:required_args
attr_reader
:query_args
,
:body_args
,
\
:query_const
,
:body_const
,
\
:required_args
,
:allow_nil_args
def
initialize
@format
=
nil
...
...
@@ -19,6 +21,7 @@ module DingtalkSdk
@body_args
=
[]
@query_args
=
[]
@required_args
=
[]
@allow_nil_args
=
[]
@body_const
=
{}
@query_const
=
{}
...
...
@@ -69,6 +72,7 @@ module DingtalkSdk
end
@required_args
<<
arg_name
if
option
[
:required
]
@allow_nil_args
<<
arg_name
if
option
[
:allow_nil
]
end
def
add_const
(
arg_name
,
value
,
option
)
...
...
@@ -103,10 +107,12 @@ module DingtalkSdk
builder
.
send
(
:"
#{
arg_pos
}
_args"
).
each
do
|
arg_name
|
arg_value
=
method_args
[
arg_name
]
next
if
arg_pos
==
:query
&&
arg_value
.
nil?
if
arg_value
.
nil?
h
[
arg_pos
][
arg_name
]
=
arg_value
if
builder
.
allow_nil_args
.
include?
(
arg_name
)
else
h
[
arg_pos
][
arg_name
]
=
arg_value
end
end
builder
.
send
(
:"
#{
arg_pos
}
_const"
).
each
do
|
arg_name
,
arg_value
|
h
[
arg_pos
][
arg_name
]
=
if
arg_value
.
respond_to?
(
:call
)
...
...
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