-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from palpalani/bugfix/rules-images
Bugfix images
- Loading branch information
Showing
4 changed files
with
87 additions
and
0 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,51 @@ | ||
<?php | ||
|
||
namespace Palpalani\BayRewards\Requests\Store; | ||
|
||
use Palpalani\BayRewards\Objects\Action; | ||
use Palpalani\BayRewards\Responses\Store\GetActionResponse; | ||
use Saloon\Contracts\Body\HasBody; | ||
use Saloon\Enums\Method; | ||
use Saloon\Http\Request; | ||
use Saloon\Http\Response; | ||
use Saloon\Traits\Body\HasJsonBody; | ||
use Saloon\Traits\Plugins\AlwaysThrowOnErrors; | ||
|
||
final class UpdateActivityRequest extends Request implements HasBody | ||
{ | ||
use AlwaysThrowOnErrors; | ||
use HasJsonBody; | ||
|
||
protected Method $method = Method::POST; | ||
|
||
public function __construct(protected string $access_token, protected array $data = []) | ||
{ | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function resolveEndpoint(): string | ||
{ | ||
return '/action/update'; | ||
} | ||
|
||
protected function defaultHeaders(): array | ||
{ | ||
return [ | ||
'Content-Type' => 'application/json', | ||
'Accept' => 'application/json', | ||
'Store-Access-Token' => $this->access_token, | ||
]; | ||
} | ||
|
||
public function defaultBody(): array | ||
{ | ||
return $this->data; | ||
} | ||
|
||
public function createDtoFromResponse(Response $response): Action | ||
{ | ||
return GetActionResponse::make($response); | ||
} | ||
} |
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,17 @@ | ||
<?php | ||
|
||
namespace Palpalani\BayRewards\Resources; | ||
|
||
use Palpalani\BayRewards\Objects\UpdateActivity; | ||
use Palpalani\BayRewards\Requests\Store\UpdateActivityRequest; | ||
|
||
final class UpdateActivityResource extends Resource | ||
{ | ||
/** | ||
* @return mixed|UpdateActivity | ||
*/ | ||
public function post(string $access_token, array $data): mixed | ||
{ | ||
return $this->connector->send(new UpdateActivityRequest($access_token, $data))->dto(); | ||
} | ||
} |