-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic Evidencio API communication class.
- Loading branch information
Showing
6 changed files
with
298 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
class EvidencioAPI | ||
{ | ||
public static function fetch($path, $params = []) | ||
{ | ||
$client = new \GuzzleHttp\Client(['base_uri' => 'https://www.evidencio.com/api/']); | ||
$res = $client->post($path, | ||
[ | ||
'headers' => [ | ||
'Accept' => 'application/json', | ||
'Authorization' => config('app.evidencio_key') | ||
], | ||
'form_params' => $params | ||
]); | ||
return json_decode($res->getBody()); | ||
} | ||
|
||
public static function overview() | ||
{ | ||
return self::fetch("overview"); | ||
} | ||
|
||
public static function search($query) | ||
{ | ||
return self::fetch("search",["query" => $query]); | ||
} | ||
|
||
public static function models() | ||
{ | ||
return self::fetch("models"); | ||
} | ||
|
||
public static function getModel($id) | ||
{ | ||
return self::fetch("model",["id" => "1222"]); | ||
} | ||
|
||
/* | ||
* @param $values array of key-value pairs for each variable where id is the key | ||
*/ | ||
public static function run($id,$values) | ||
{ | ||
$values["id"] = $id; | ||
return self::fetch("run",$values); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters