Skip to content

Commit 4a9e1b7

Browse files
Updated for region bases
1 parent 7b898e2 commit 4a9e1b7

14 files changed

Lines changed: 14 additions & 17 deletions

.gitignore

100644100755
File mode changed.

LICENSE.txt

100644100755
File mode changed.

examples/index.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
ini_set('display_errors', 'On');
1111
use Contentstack\Contentstack;
1212
include_once "../src/index.php";
13-
$stack = Contentstack::Stack('<API_KEY>', '<ACCESS_TOKEN>', '<ENVIRONMENT>', 'REGION');
13+
include_once "../src/contentstackregion.php";
14+
$stack = Contentstack::Stack('', '', '');
1415
try {
1516
// \Contentstack\Utility\debug($stack);
1617
//$result = $stack->ContentType('test')->Query()->IncludeReferenceContentTypeUID()->toJSON()->find();

src/config/index.php

100644100755
File mode changed.

src/contentstackregion.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
/*
3+
* Dependency loading
4+
* */
5+
6+
class ContentstackRegion {
7+
const EU= "eu";
8+
const US= "us";
9+
}

src/lib/models/assets.php

100644100755
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,5 @@ public function fetch() {
6363
$this->operation = __FUNCTION__;
6464
return \Contentstack\Utility\contentstackRequest($this, 'asset');
6565
}
66-
67-
6866
}
6967

src/lib/models/contentstackregion.php

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/lib/models/csexception.php

100644100755
File mode changed.

src/lib/models/stack.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77

88
require_once __DIR__."/content_type.php";
99
require_once __DIR__."/assets.php";
10-
//require_once __DIR__."/asset.php";
1110
require_once __DIR__."/../../config/index.php";
12-
require_once __DIR__."/contentstackregion.php";
1311

1412
/*
1513
* Stack Class to initialize the provided parameter Stack
@@ -31,9 +29,8 @@ class Stack {
3129
* */
3230
public function __construct($api_key = '', $access_token = '', $environment = '', $region = '') {
3331

34-
35-
if($region && $region =="EU") {
36-
$this->host = EU.'-'.HOST;
32+
if($region && $region =="eu" && $region !== "undefined") {
33+
$this->host = $region.'-'.HOST;
3734
}
3835
$this->header = Utility\validateInput('stack', array('api_key' => $api_key, 'access_token' => $access_token, 'environment' => $environment, 'region' => $region));
3936
$this->environment = $this->header['environment'];

test/AssetsTest.php

100644100755
File mode changed.

0 commit comments

Comments
 (0)