In my last post I talked about getting my code published as a PEAR package. Well, I did talk to them and they asked me to change my code a bit, add some PHPunit test, and to organize my directory in a different fashion. But, vacations are over and I have been too busy to make those changes. Yes, its been long since my last post. But, my first update after GSoC is here. I have changed the way I used to POST using cURL. Now, I am using HTTP_REQUEST2 to POST and send headers. As it says on PEAR, HTTP_REAUEST2 “Provides an easy way to perform HTTP requests”, more information over here (http://pear.php.net/package/HTTP_Request2).
Some PHPunit test, and a new package name is what I aim to do next.
The openSRF-PHP Library is ready and can be used to get response from an openSRF service using the services and methods present. There are two examples present, which will tell how to use the library. A documentation has also been added (https://github.com/pranjal710/osrf/blob/master/docs/doc.md) . The first part of the documentation describes functions, classes and their member functions, parameters passed and their return values. The second part of the documentation briefly describes what happens when someone uses the library i.e. the role of each class/function. My github repo is mentioned in the github tab.
Someone who helped me throughout, this library would not have been what it is now had my mentor Lebbeous Fogle-Weekley not helped me. I thank him for helping me by breaking the project into small parts and guiding me whenever I got stuck. There are a lot of things (which might be small for him) but were new to me, and they will surely help me throughout. Thankyou Sir, for editing my code, which cleaned it made it a lot shorter and for everything.
The next thing I am looking forward is to get it published as a PEAR package. My next post will tell about the changes I have done to get it Published as a PEAR package.
I tested my code to work correctly for service open-ils.actor. It gives an array, which is printed. I am currently working on my next task, which is to remove errors shown by php-codesniffer. I have already started working on it, and will update my repo as soon as I get rid of all those errors.
Although I completed this a week back, but I think now is the time to put this post. Do take a look at the newly added “examples/” in my github repo. “index.php” shows how to put a title level hold. The newly added config.php allows user to put his choice for the classfieldmapper.php’s location. This is necessary because the file is being created dynamically and requires permissions to read/write. The location has to be chosen wisely. Another newly added option, although the same is present for other language binding (and I couldnt think of anything new), is to explicitly control the parsing of Fieldmapper IDL. It takes few seconds to parse fieldmapper idl, hence, to make things faster user is given the option to parse/not parse the IDL. If the xml file is changed/edited, the user can create a new, for other cases he an continue with the old copy.
The code has been currently tested for “title level hold” only. My next step will be to test it for various other cases.
The newly added files in my github repo correspond to the fieldmapper_IDL. The parse_xml_2_array.php picks relevant data from the /server/reports/fm_IDL.xml, and dynamically create an associative array. This array is then used by fieldmapper.php to create all classes dynamically and write it to classfieldmapper.php. classfieldmapper.php also includes an abstract class called fieldmapper_class_abstract.php. There is a function which encodes a fieldmapper class object to json, and another which does the opposite. Thus, now we can directly use the services and methods for all required functions.
I also tried to clean and indent my code.
After going through the login( ) from Open-ILS/src/python/oils/utils, I have come up with my open_ils_login( ). This does the same work. Although it returns an array, and, “textcode” describes about “SUCCESS or “login failed”.
My codes had a lot of includes/require with vague class names and file names. I worked on them as well.
Now a user, upon successfull login gets an authentication token. My next post will talk about placing a title-level hold on a bib record.
Code at https://github.com/pranjal710/osrf
Really sorry, since I missed a few very important things in my last update. I just briefed up everything, and forgot to mention work done by few people who helped me, and I accept, this was not at all good of me. Hence, here it comes, https://github.com/edoceo/osrfphp and https://github.com/tadl/opensrf-php were of great help. Also, a mail by Bob Wicksall to the firstname.lastname@example.org was a godsend.
Thankyou All :)