Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
trade74 committed Jan 10, 2024
1 parent d31bbe3 commit 6a958eb
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 21 deletions.
16 changes: 13 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
{
"name": "craftyfm/craft-feedme-filemaker",
"description": "Enable Filemaker Data API to be used with the Feed-Me plugin",
"description": "A plugin to allow Claris Filemaker Data API v2 to work with the Feed Me plugin",
"type": "craft-plugin",
"keywords": [
"craft",
"cms",
"craftcms",
"craft-plugin",
"filemaker",
"claris",
"feed me"
],
"license": "proprietary",
"support": {
"email": "[email protected]"
Expand All @@ -22,9 +31,10 @@
},
"extra": {
"handle": "feedme-filemaker",
"name": "feedme-filemaker",
"name": "Feed Me Filemaker",
"developer": "CraftyFm",
"documentationUrl": ""
"documentationUrl": "",
"class": "craftyfm\\craftfeedmefilemaker\\FeedmeFilemaker"
},
"scripts": {
"check-cs": "ecs check --ansi",
Expand Down
20 changes: 3 additions & 17 deletions src/FeedmeFilemaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ function(RegisterTemplateRootsEvent $event) {
$event->roots['something'] = __DIR__ . '/template-two';
}
);
// $this->createOverrideFolder();

// Defer most setup tasks until Craft is fully initialized
Craft::$app->onInit(function() {
Expand All @@ -75,7 +74,6 @@ function(RegisterTemplateRootsEvent $event) {
//create Basic Auth string
$basicAuthString = 'Basic ' . base64_encode($this->getSettings()->user .':'.$this->getSettings()->pass);


// Request token
$response = $client->request('POST', '', [
'headers' => [
Expand All @@ -87,28 +85,19 @@ function(RegisterTemplateRootsEvent $event) {
'debug' => true,
]);




//$data = json_decode($response->getBody()->getContents());
$json = $response->getBody()->getContents();
$data = json_decode($json);

$status = $response->getStatusCode();

$authtoken = $data->response->token;
// Craft::info(dd($data));
// Craft::info(dd($data->response->token));
// Craft::info((string)$data);


if ($status === 200) {
// $body = $data;

return $authtoken;
// return '147a30e2bcdd3b235672e7d5eecadb6d886e7f956421e15c6722';

} else {
return false;

}
}, 900);

Expand All @@ -124,16 +113,13 @@ function(RegisterTemplateRootsEvent $event) {
'requestOptions' => [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer ' . $token, //'c312f791d7eaf0425571d577f27ce0f2e0d339c355516a7bc213',
'Authorization' => 'Bearer ' . $token,
],
],
]
],
];




// Feed back to the plugin
FeedMe::getInstance()->setSettings((array) $settings);
});
Expand Down
17 changes: 17 additions & 0 deletions src/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/models/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Settings extends Model
{
public $user = 'admin';
public $pass = 'passw0rd123';
public $authURL = 'https://filemaker.com/';
public $authURL = 'https://fm.domain.com/fmi/data/v2/databases/mycooldb/sessions';

public function defineRules(): array
{
Expand Down

0 comments on commit 6a958eb

Please sign in to comment.