Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Vlad Bukhanets
/
immoscout24-api-php
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Merge Requests
0
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
247a7948
authored
2022-10-18 11:12:06 +0300
by
Aleksandr Korzhenko
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'protected' into 'master'
protected See merge request
!1
2 parents
9b36df06
4216c75a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
23 deletions
.gitlab-ci.yml → .1gitlab-ci.yml
src/ImmoScoutAPI.php
.gitlab-ci.yml
→
.
1
gitlab-ci.yml
View file @
247a794
File moved
src/ImmoScoutAPI.php
View file @
247a794
...
...
@@ -22,12 +22,12 @@ use Psr\Http\Message\ResponseInterface;
*/
abstract
class
ImmoScoutAPI
extends
GuzzleClient
{
pr
ivate
$consumerKey
;
pr
ivate
$consumerKeySecret
;
pr
ivate
$client
=
null
;
pr
otected
$consumerKey
;
pr
otected
$consumerKeySecret
;
pr
otected
$client
=
null
;
public
$history
=
null
;
pr
ivate
$user
=
'me'
;
pr
ivate
$isSandbox
=
true
;
pr
otected
$user
=
'me'
;
pr
otected
$isSandbox
=
true
;
/**
* should save the request token with tokenname + secret, the token can be temporarily saved within a session
...
...
@@ -72,7 +72,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
*
* @return void
*/
pr
ivate
function
validateToken
(
$tokenArray
)
pr
otected
function
validateToken
(
$tokenArray
)
{
if
(
!
is_array
(
$tokenArray
))
{
throw
new
InvalidTokenException
(
'restored Token is not an Array need to be of the form [token, token_secret]'
);
...
...
@@ -82,7 +82,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
}
}
pr
ivate
function
getValidatedRequestToken
()
pr
otected
function
getValidatedRequestToken
()
{
$token
=
$this
->
restoreRequestToken
();
$this
->
validateToken
(
$token
);
...
...
@@ -90,7 +90,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
return
$token
;
}
pr
ivate
function
getValidatedAccessToken
()
pr
otected
function
getValidatedAccessToken
()
{
$token
=
static
::
restoreAccessToken
();
$this
->
validateToken
(
$token
);
...
...
@@ -193,7 +193,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
*
* @return string base url
*/
pr
ivate
function
getBaseUrl
()
pr
otected
function
getBaseUrl
()
{
$domain
=
$this
->
getDomain
();
...
...
@@ -205,7 +205,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
*
* @return string current url
*/
pr
ivate
static
function
getSelfURI
()
pr
otected
static
function
getSelfURI
()
{
if
(
!
isset
(
$_SERVER
)
||
!
isset
(
$_SERVER
[
'HTTP_HOST'
])
||
!
isset
(
$_SERVER
[
'REQUEST_URI'
]))
{
throw
new
\Exception
(
"coudn't detect request uri for callback (please specify one)"
);
...
...
@@ -240,7 +240,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
*
* @return ResponseInterface
*/
pr
ivate
function
callOAuth
(
$uri
,
$oAuthData
)
pr
otected
function
callOAuth
(
$uri
,
$oAuthData
)
{
$oAuthData
[
'consumer_key'
]
=
$this
->
consumerKey
;
$oAuthData
[
'consumer_secret'
]
=
$this
->
consumerKeySecret
;
...
...
@@ -267,7 +267,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
*
* @return void
*/
pr
ivate
function
requestRequestToken
(
$callback
)
pr
otected
function
requestRequestToken
(
$callback
)
{
try
{
$res
=
static
::
callOAuth
(
'/restapi/security/oauth/request_token'
,
[
...
...
@@ -292,7 +292,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
*
* @return void
*/
pr
ivate
function
requestAccessToken
(
$verifier
)
pr
otected
function
requestAccessToken
(
$verifier
)
{
$requestToken
=
$this
->
getValidatedRequestToken
();
try
{
...
...
@@ -368,7 +368,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
*
* @return string url
*/
pr
ivate
function
getUrl
(
$methodUri
,
$withUser
=
true
)
pr
otected
function
getUrl
(
$methodUri
,
$withUser
=
true
)
{
$url
=
$this
->
getBaseUrl
();
$path
=
'api/offer/v1.0/'
;
...
...
@@ -394,7 +394,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
*
* @return array message array
*/
pr
ivate
function
parseMessages
(
$res
)
pr
otected
function
parseMessages
(
$res
)
{
$return
=
[
'parsed'
=>
[],
...
...
@@ -488,7 +488,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
*
* @return void
*/
pr
ivate
function
call
(
$method
,
$methodUri
,
$data
=
[],
$withUser
=
false
)
pr
otected
function
call
(
$method
,
$methodUri
,
$data
=
[],
$withUser
=
false
)
{
$methodUri
=
$this
->
getUrl
(
$methodUri
,
$withUser
);
try
{
...
...
@@ -501,7 +501,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
}
}
pr
ivate
function
callMethod
(
$methodUri
,
$method
=
'GET'
,
$jsonData
=
null
,
$useJson
=
true
,
$withUser
=
false
)
pr
otected
function
callMethod
(
$methodUri
,
$method
=
'GET'
,
$jsonData
=
null
,
$useJson
=
true
,
$withUser
=
false
)
{
$data
=
[];
if
(
$jsonData
&&
$useJson
)
{
...
...
@@ -515,7 +515,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
return
$this
->
call
(
$method
,
$methodUri
,
$data
,
$withUser
);
}
pr
ivate
function
callUserMethod
(
$methodUri
,
$method
=
'GET'
,
$jsonData
=
null
,
$useJson
=
true
)
pr
otected
function
callUserMethod
(
$methodUri
,
$method
=
'GET'
,
$jsonData
=
null
,
$useJson
=
true
)
{
return
$this
->
callMethod
(
$methodUri
,
$method
,
$jsonData
,
$useJson
,
true
);
}
...
...
@@ -528,7 +528,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
*
* @return bool
*/
pr
ivate
function
checkForResponse
(
$res
,
$expectedResponse
=
'MESSAGE_RESOURCE_CREATED'
)
pr
otected
function
checkForResponse
(
$res
,
$expectedResponse
=
'MESSAGE_RESOURCE_CREATED'
)
{
if
(
is_null
(
$res
))
{
throw
new
InvalidResponse
(
'Got empty response '
);
...
...
@@ -545,22 +545,22 @@ abstract class ImmoScoutAPI extends GuzzleClient
return
true
;
}
pr
ivate
function
checkForResponseCreated
(
$res
)
pr
otected
function
checkForResponseCreated
(
$res
)
{
return
$this
->
checkForResponse
(
$res
,
'MESSAGE_RESOURCE_CREATED'
);
}
pr
ivate
function
checkForResponseUpdated
(
$res
)
pr
otected
function
checkForResponseUpdated
(
$res
)
{
return
$this
->
checkForResponse
(
$res
,
'MESSAGE_RESOURCE_UPDATED'
);
}
pr
ivate
function
checkForResponseDeleted
(
$res
)
pr
otected
function
checkForResponseDeleted
(
$res
)
{
return
$this
->
checkForResponse
(
$res
,
'MESSAGE_RESOURCE_DELETED'
);
}
pr
ivate
function
parseGetResponse
(
$res
)
pr
otected
function
parseGetResponse
(
$res
)
{
try
{
return
json_decode
((
string
)
$res
->
getBody
(),
true
);
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment