Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Removed namespace. Changed the API_ENDPOINT to a constant. Changed it…
… to use static, instead of self.
  • Loading branch information
Adam Meech committed Feb 4, 2015
commit fc707c43d903006e10a7434aee34c3f469268509
11 changes: 6 additions & 5 deletions src/Wheniwork.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php namespace Wheniwork;
<?php

/**
* Client library for the When I Work scheduling and attendance platform.
Expand All @@ -23,10 +23,11 @@ class Wheniwork {
const METHOD_PATCH = 'patch';
const METHOD_DELETE = 'delete';

const API_ENDPOINT = 'https://api.wheniwork.com/2';

private $api_key;
private $api_token;
protected $verify_ssl = false;
protected $api_endpoint = 'https://api.wheniwork.com/2';
protected $verify_ssl = false;

/**
* Create a new instance
Expand Down Expand Up @@ -128,7 +129,7 @@ public function delete($method, $params = [], $headers = []) {
*/
private function makeRequest($method, $request, $params = [], $headers = []) {

$url = $this->api_endpoint.'/'.$method;
$url = static::API_ENDPOINT.'/'.$method;

if ($params && ($request == self::METHOD_GET || $request == self::METHOD_DELETE)) {
$url .= '?'.http_build_query($params);
Expand Down Expand Up @@ -185,7 +186,7 @@ public static function login($key, $email, $password) {
'W-Key' => $key
];

$login = new self();
$login = new static;
$response = $login->makeRequest("login", self::METHOD_POST, $params, $headers);

return $response;
Expand Down