Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
refineriaweb-public
sharpspring-client
Commits
cc897bef
Commit
cc897bef
authored
2 years ago
by
Josep Salvà
Browse files
Options
Download
Email Patches
Plain Diff
Minor fixes
parent
98fc65a5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Exceptions/ResponseException.php
+9
-1
src/Exceptions/ResponseException.php
src/Models/Lead.php
+1
-0
src/Models/Lead.php
src/Response.php
+12
-9
src/Response.php
with
22 additions
and
10 deletions
+22
-10
src/Exceptions/ResponseException.php
+
9
-
1
View file @
cc897bef
...
...
@@ -19,9 +19,17 @@ class ResponseException extends SharpspringException
{
$this
->
response
=
$response
;
$error
=
$response
->
getError
()[
0
];
$error
=
$response
->
getError
();
if
(
is_array
(
$response
->
getError
()))
{
$error
=
$response
->
getError
()[
0
];
}
$this
->
data
=
$error
->
data
;
if
(
str_contains
(
$error
->
message
,
'Invalid parameters'
))
{
dd
(
$this
->
data
);
}
parent
::
__construct
(
$error
->
message
,
$error
->
code
,
$previous
);
}
...
...
This diff is collapsed.
Click to expand it.
src/Models/Lead.php
+
1
-
0
View file @
cc897bef
...
...
@@ -51,6 +51,7 @@ class Lead extends ModelWithCustom
'description'
,
'industry'
,
'isUnsubscribed'
,
'isOptedIn'
,
'updateTimestamp'
,
'createTimestamp'
];
...
...
This diff is collapsed.
Click to expand it.
src/Response.php
+
12
-
9
View file @
cc897bef
<?php
namespace
Rw\SharpspringApi
;
use
Exception
;
use
Illuminate\Support\Facades\Log
;
use
Rw\SharpspringApi\Exceptions\ResponseException
;
/**
...
...
@@ -47,20 +49,21 @@ class Response
public
function
getResult
()
{
return
$this
->
getBody
()
->
result
;
try
{
return
$this
->
getBody
()
->
result
;
}
catch
(
Exception
$e
)
{
Log
::
error
(
$e
->
getMessage
());
return
null
;
}
}
public
function
getError
()
{
if
(
!
is_null
(
$this
->
getBody
()))
{
if
(
isset
(
$this
->
getBody
()
->
error
))
{
return
(
array
)
$this
->
getBody
()
->
error
;
}
return
(
array
)
$this
->
getBody
();
if
(
!
is_null
(
$this
->
getBody
())
&&
(
isset
(
$this
->
getBody
()
->
error
)
&&
!
empty
(
$this
->
getBody
()
->
error
)))
{
return
$this
->
getBody
()
->
error
;
}
return
[]
;
return
null
;
}
public
function
getId
()
...
...
@@ -85,7 +88,7 @@ class Response
public
function
isError
()
{
return
!
empty
(
$this
->
getError
());
return
!
is_null
(
$this
->
getError
());
}
public
function
makeException
()
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets