Skip to content

Commit e41c492

Browse files
committed
Meta: Enhanced README.md, minor bug fixes
- Removed Under Construction Warning - Added package badges and Install and Example sections to README.md - Removed Namespacing SimpleXMLElement - Fixed default API_DoQuery options - Fixed API_DoQuery test
1 parent 5ce92ef commit e41c492

File tree

3 files changed

+57
-7
lines changed

3 files changed

+57
-7
lines changed

README.md

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,60 @@
1-
UNDER CONSTRUCTION - DO NOT USE
2-
===============================
3-
41
php-quickbase
52
=============
63

4+
[![License](https://poser.pugx.org/tflanagan/quickbase/license)](https://packagist.org/packages/tflanagan/quickbase) [![Latest Stable Version](https://poser.pugx.org/tflanagan/quickbase/version)](https://packagist.org/packages/tflanagan/quickbase) [![Total Downloads](https://poser.pugx.org/tflanagan/quickbase/downloads)](https://packagist.org/packages/tflanagan/quickbase) [![Build Status](https://travis-ci.org/tflanagan/php-quickbase.svg?branch=master)](https://travis-ci.org/tflanagan/php-quickbase)
5+
76
A lightweight, very flexible QuickBase API
87

8+
Install
9+
-------
10+
```
11+
$ composer require tflanagan/quickbase
12+
```
13+
14+
Example
15+
-------
16+
```php
17+
18+
try {
19+
$qb = new QuickBase(array(
20+
'realm' => 'www',
21+
'appToken' => '****'
22+
));
23+
24+
$qb->api('API_Authenticate', array(
25+
'username' => getenv('username'),
26+
'password' => getenv('password')
27+
));
28+
29+
$response = $qb->api('API_DoQuery', array(
30+
'dbid' => '*****',
31+
'clist' => '3.12',
32+
'options' => 'num-5'
33+
));
34+
35+
foreach($response['table']['records'] as $record){
36+
$qb->api('API_EditRecord', array(
37+
'dbid' => '*****',
38+
'rid' => $record[3],
39+
'fields' => array(
40+
array( 'fid' => 12, 'value' => $record[12])
41+
)
42+
));
43+
}
44+
45+
$response = $qb->api('API_DoQuery', array(
46+
'dbid' => '*****',
47+
'clist' => '3.12',
48+
'options' => 'num-5'
49+
));
50+
51+
var_dump($response['table']['records']);
52+
}catch(Exception $err){
53+
var_dump($err);
54+
}
55+
56+
```
57+
958
License
1059
-------
1160

quickbase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ protected function constructPayload(){
128128
$this->payload = '';
129129

130130
if($this->parent->settings['flags']['useXML']){
131-
$xmlDoc = new \SimpleXMLElement(implode('', array(
131+
$xmlDoc = new SimpleXMLElement(implode('', array(
132132
'<?xml version="1.0" encoding="',
133133
$this->options['encoding'],
134134
'"?>',
@@ -215,7 +215,7 @@ protected function transmit(){
215215
throw new QuickBaseError(curl_errno($ch), curl_error($ch));
216216
}
217217

218-
$this->xmlResponse = new \SimpleXmlIterator($response);
218+
$this->xmlResponse = new SimpleXmlIterator($response);
219219

220220
return $this;
221221
}
@@ -377,7 +377,7 @@ public static function API_DoQuery(&$query){
377377
}
378378

379379
if(!isset($query->options['fmt']) && isset($query->parent->settings['flags']['fmt'])){
380-
$query->options['returnPercentage'] = $query->parent->settings['flags']['fmt'];
380+
$query->options['fmt'] = $query->parent->settings['flags']['fmt'];
381381
}
382382

383383
if(!isset($query->options['includeRids']) && isset($query->parent->settings['flags']['includeRids'])){

tests/API_DoQuery.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818
$qb->api('API_DoQuery', array(
1919
'dbid' => getenv('dbid'),
20-
'query' => "{'3'.XEX.''}"
20+
'query' => "{'3'.XEX.''}",
21+
'clist' => '1.2.3.4.5'
2122
));
2223

2324
?>

0 commit comments

Comments
 (0)