Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.php.net/repository/pear/packages/Services_Hatena/trunk@209881 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
Makoto Tanaka committed Mar 22, 2006
1 parent 6638b7c commit 09d1979
Show file tree
Hide file tree
Showing 5 changed files with 172 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/IDEAS
@@ -0,0 +1,6 @@
Hatena FotoLife Atom API (Makoto Tanaka)
---------------------------------------
Get the list of fotograph contributed recently.

How to Request
GET /atom/feed
3 changes: 3 additions & 0 deletions docs/MAINTAINERS
@@ -0,0 +1,3 @@
Maintainers for Services_Hatena:

all : Makoto Tanaka <tanaka.makoto@gmail.com>
27 changes: 27 additions & 0 deletions docs/STATUS
@@ -0,0 +1,27 @@
STATUS OF THE PEAR SERVICEs_HATENA PACKAGE
=============================

$Id$
------------------------------------------------------------------------

DB Driver Feature Matrix
------------------------
Symbols:
x = implemented, but without tests
t = implemented, but one or more tests fail
T = implemented, passing all tests
e = emulated, without tests
l = emulated, but one or more tests fail
E = emulated, passing all tests
n = returns "not capable"
- = no implementation of this feature or status unknown

FEATURE STATUS
asin T
autolink T
bookmark T
bookmarknum T
exist T
foto T
search T
similar T
76 changes: 76 additions & 0 deletions docs/TESTERS
@@ -0,0 +1,76 @@
================================
HOW TO TEST PEAR SERVICES_HATENA
================================

$Id$


INTRODUCTION
============

These are instructions for testing PEAR Services_Hatena on a Windows
machine using a Cygwin Bash shell.
Adjust the paths and commands to match your system.
This configuration is used because these precise steps are known to work.

NOTE: You must log on as a user which has permissions to modify the
contents of your PHP executable's directory. This is necessary for both
configuring AND running the test system.

INSTALLATION
============

Obtain PHP's Test Framework
---------------------------
If you don't have PHP's test framework, you need to obtain it. These
steps include changing the working directory, downloading run-tests.php
via CVS and copying the file into place. Change the revision flag in the
CVS command as appropriate for your present version of PHP.

cd c:/progra~1/php
cvs -d :pserver:cvsread@cvs.php.net:/repository login # password is phpfi
cvs -d :pserver:cvsread@cvs.php.net:/repository co -r PHP_4_3 \
-d test php-src/run-tests.php
cp test/run-tests.php .
rm -rf test

Obtain Sevices_Hatena and its Test Framework
--------------------------------------------
* IF PEAR SERVICES_HATENA IS ALREADY INSTALLED:

If you have PEAR Services_Hatena installed already, good. The test suite
is in place. Open up a command/shell prompt and move into
the test directory.

cd <path to pear insall>/tests/Services_Hatena/tests

We assume you already have the PEAR base package installed. If
you don't, you will need to do so, but the instructions for
doing that are beyond the scope of this document. See
http://pear.php.net/manual/en/installation.php for more info.

Move to the test directory.

cd pear/Services_Hatena/tests

Copy the Starter Shell Script and Edit the Paths
------------------------------------------------
Please, check README.TESTING, run-tests.php.
[INFO] http://qa.php.net/running-tests.php


Results and What To Do With Them
--------------------------------
Each test that fails generates a .php (which you can execute), a .exp
(the expected output), a .out (the test output) and a .diff (a diff -u
from the .exp and .out files).

If you run the tests, please report or fill the TEST CONFORMANCE table
in the STATUS document. Before any commit to CVS be sure to run the
tests and nothing got broken with the change.

SERVICES_HATENA TESTER MATRIX
=============================

TESTER asin autolink bookmark bookmarknum exist foto search similar
Makoto Tanaka X X - X X - X X
60 changes: 60 additions & 0 deletions examples/Hatena_Services_Example_01.php
@@ -0,0 +1,60 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
* Test Script
*
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category Services
* @package Services_Hatena
* @author Makoto Tanaka
* @copyright 2006 Makoto Tanaka
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id$
*/

require_once 'Services/Hatena.php';

// $type = 'Search';
$type = 'Autolink';
// $type = 'Bookmarknum';
// $type = 'Asin';
// $type = 'Similar';
// $type = 'Exist';

$datum = array( 'Search' => 'PHP',
'Autolink' => 'I like PHP.',
'Bookmarknum' => 'http://www.yahoo.co.jp/',
'Asin' => '4774124966',
'Similar' => 'PHP',
'Exist' => 'http://www.yahoo.co.jp',
);
$data = $datum[$type];
$hatena = Services_Hatena::factory($type);

if (PEAR::isError($hatena)) {
print('i have an Error : ' . $hatena->getMessage());
exit();
}

/**
* @note
* only for autolink
*
$hatena->setScore(0);
$hatena->setCname(array('food', 'movie'));
$hatena->setTarget('_blank');
$hatena->setClass('keyword');
*/

$result = $hatena->execute($data);
var_dump($result);
?>

0 comments on commit 09d1979

Please sign in to comment.