Skip to content

Commit

Permalink
optimize : code
Browse files Browse the repository at this point in the history
  • Loading branch information
ekopras18 committed Apr 14, 2024
1 parent a15f985 commit 711d4e6
Showing 1 changed file with 32 additions and 5 deletions.
37 changes: 32 additions & 5 deletions src/Fhir/Onboarding/Organization.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,33 @@
use Ekopras18\Satusehat\Fhir;
use Ekopras18\Satusehat\Config\Environment;

/**
* Class Organization
*
* This class extends the Fhir class and provides methods to interact with the Organization resource.
*/
class Organization extends Fhir
{
/**
* Organization constructor.
*
* Initializes the base URL, path, and organization details from the environment.
*/
public function __construct()
{
// $this->model = new Organization();
$this->baseUrl = Environment::url()['baseUrl'];
$this->path = 'Organization';
$this->organitation_id = Environment::auth()['organizationId'];
$this->organitation_name = Environment::auth()['organizationName'];
}

public function GetById($uuid)
/**
* Get an organization by its UUID.
*
* @param string $uuid The UUID of the organization.
* @return mixed The response from the FHIR server.
*/
public function getById($uuid)
{
$method = 'GET';
$url = $this->baseUrl . '/' . $this->path . '/' . $uuid;
Expand All @@ -26,7 +41,13 @@ public function GetById($uuid)
return $this->fhir($url, $method, $body, $contentType);
}

public function GetByName($name)
/**
* Get an organization by its name.
*
* @param string $name The name of the organization.
* @return mixed The response from the FHIR server.
*/
public function getByName($name)
{
$method = 'GET';
$url = $this->baseUrl . '/' . $this->path . '?name='. urlencode($name);
Expand All @@ -36,7 +57,13 @@ public function GetByName($name)
return $this->fhir($url, $method, $body, $contentType);
}

public function GetByPartOf($uuid)
/**
* Get an organization by its partOf attribute.
*
* @param string $uuid The UUID of the organization that this organization is part of.
* @return mixed The response from the FHIR server.
*/
public function getByPartOf($uuid)
{
$method = 'GET';
$url = $this->baseUrl . '/' . $this->path . '?partof='. $uuid;
Expand All @@ -46,4 +73,4 @@ public function GetByPartOf($uuid)
return $this->fhir($url, $method, $body, $contentType);
}

}
}

0 comments on commit 711d4e6

Please sign in to comment.