Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
salesforce-3257058
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
salesforce-3257058
Commits
96740398
Commit
96740398
authored
8 years ago
by
Aaron Bauman
Browse files
Options
Downloads
Patches
Plain Diff
string to bool
parent
2a714f93
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Rest/RestClient.php
+10
-6
10 additions, 6 deletions
src/Rest/RestClient.php
with
10 additions
and
6 deletions
src/Rest/RestClient.php
+
10
−
6
View file @
96740398
...
...
@@ -74,12 +74,16 @@ class RestClient {
* Parameters to provide.
* @param string $method
* Method to initiate the call, such as GET or POST. Defaults to GET.
* @param bool $returnObject
* If true, return a Drupal\salesforce\Rest\RestResponse;
* Otherwise, return json-decoded response body only.
* Defaults to FALSE for backwards compatibility.
*
* @return mixed
*
* @throws GuzzleHttp\Exception\RequestException
*/
public
function
apiCall
(
$path
,
array
$params
=
[],
$method
=
'GET'
,
$return
=
'data'
)
{
public
function
apiCall
(
$path
,
array
$params
=
[],
$method
=
'GET'
,
$return
Object
=
FALSE
)
{
if
(
!
$this
->
getAccessToken
())
{
$this
->
refreshToken
();
}
...
...
@@ -121,7 +125,7 @@ class RestClient {
throw
new
Exception
(
'Unknown error occurred during API call'
);
}
}
if
(
$return
==
'o
bject
'
)
{
if
(
$return
O
bject
)
{
return
$this
->
response
;
}
else
{
...
...
@@ -498,7 +502,7 @@ class RestClient {
return
$cache
->
data
;
}
else
{
$response
=
new
RestResponse_Describe
(
$this
->
apiCall
(
"sobjects/
{
$name
}
/describe"
,
[],
'GET'
,
'object'
));
$response
=
new
RestResponse_Describe
(
$this
->
apiCall
(
"sobjects/
{
$name
}
/describe"
,
[],
'GET'
,
TRUE
));
\Drupal
::
cache
()
->
set
(
'salesforce:object:'
.
$name
,
$response
,
0
,
[
'salesforce'
]);
return
$response
;
}
...
...
@@ -517,7 +521,7 @@ class RestClient {
* @addtogroup salesforce_apicalls
*/
public
function
objectCreate
(
$name
,
array
$params
)
{
$response
=
$this
->
apiCall
(
"sobjects/
{
$name
}
"
,
$params
,
'POST'
,
'object'
);
$response
=
$this
->
apiCall
(
"sobjects/
{
$name
}
"
,
$params
,
'POST'
,
TRUE
);
$data
=
$response
->
data
;
return
new
SFID
(
$data
[
'id'
]);
}
...
...
@@ -548,7 +552,7 @@ class RestClient {
unset
(
$params
[
$key
]);
}
$response
=
$this
->
apiCall
(
"sobjects/
{
$name
}
/
{
$key
}
/
{
$value
}
"
,
$params
,
'PATCH'
,
'object'
);
$response
=
$this
->
apiCall
(
"sobjects/
{
$name
}
/
{
$key
}
/
{
$value
}
"
,
$params
,
'PATCH'
,
TRUE
);
// On update, upsert method returns an empty body. Retreive object id, so that we can return a consistent response.
if
(
$this
->
response
->
getStatusCode
()
==
204
)
{
...
...
@@ -643,7 +647,7 @@ class RestClient {
* @addtogroup salesforce_apicalls
*/
public
function
listResources
()
{
return
new
RestResponse_Resources
(
$this
->
apiCall
(
''
,
[],
'GET'
,
'object'
));
return
new
RestResponse_Resources
(
$this
->
apiCall
(
''
,
[],
'GET'
,
TRUE
));
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment