Zend_Service_SlideShare.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.service.slideshare">
  4. <title>Introduction</title>
  5. <para>
  6. The <classname>Zend_Service_SlideShare</classname> component is used to interact with the
  7. <ulink url="http://www.slideshare.net/">slideshare.net</ulink> web services for hosting
  8. slide shows online. With this component, you can embed slide shows which are hosted on this
  9. web site within a web site and even upload new slide shows to your account.
  10. </para>
  11. <sect2 id="zend.service.slideshare.basicusage">
  12. <title>Getting Started with Zend_Service_SlideShare</title>
  13. <para>
  14. In order to use the <classname>Zend_Service_SlideShare</classname> component you must first create an account
  15. on the slideshare.net servers (more information can be found
  16. <ulink url="http://www.slideshare.net/developers/">here</ulink>) in order to receive an
  17. API key, username, password and shared secret value -- all of which are needed in order
  18. to use the <classname>Zend_Service_SlideShare</classname> component.
  19. </para>
  20. <para>
  21. Once you have setup an account, you can begin using the
  22. <classname>Zend_Service_SlideShare</classname> component by creating a new instance of the
  23. <classname>Zend_Service_SlideShare</classname> object and providing these values as shown below:
  24. </para>
  25. <programlisting language="php"><![CDATA[
  26. // Create a new instance of the component
  27. $ss = new Zend_Service_SlideShare('APIKEY',
  28. 'SHAREDSECRET',
  29. 'USERNAME',
  30. 'PASSWORD');
  31. ]]></programlisting>
  32. </sect2>
  33. <sect2 id="zend.service.slideshare.slideshowobj">
  34. <title>The SlideShow object</title>
  35. <para>
  36. All slide shows in the <classname>Zend_Service_SlideShare</classname> component are represented
  37. using the <classname>Zend_Service_SlideShare_SlideShow</classname> object (both when retrieving
  38. and uploading new slide shows). For your reference a pseudo-code version of this class
  39. is provided below.
  40. </para>
  41. <programlisting language="php"><![CDATA[
  42. class Zend_Service_SlideShare_SlideShow {
  43. /**
  44. * Retrieves the location of the slide show
  45. */
  46. public function getLocation() {
  47. return $this->_location;
  48. }
  49. /**
  50. * Gets the transcript for this slide show
  51. */
  52. public function getTranscript() {
  53. return $this->_transcript;
  54. }
  55. /**
  56. * Adds a tag to the slide show
  57. */
  58. public function addTag($tag) {
  59. $this->_tags[] = (string)$tag;
  60. return $this;
  61. }
  62. /**
  63. * Sets the tags for the slide show
  64. */
  65. public function setTags(Array $tags) {
  66. $this->_tags = $tags;
  67. return $this;
  68. }
  69. /**
  70. * Gets all of the tags associated with the slide show
  71. */
  72. public function getTags() {
  73. return $this->_tags;
  74. }
  75. /**
  76. * Sets the filename on the local filesystem of the slide show
  77. * (for uploading a new slide show)
  78. */
  79. public function setFilename($file) {
  80. $this->_slideShowFilename = (string)$file;
  81. return $this;
  82. }
  83. /**
  84. * Retrieves the filename on the local filesystem of the slide show
  85. * which will be uploaded
  86. */
  87. public function getFilename() {
  88. return $this->_slideShowFilename;
  89. }
  90. /**
  91. * Gets the ID for the slide show
  92. */
  93. public function getId() {
  94. return $this->_slideShowId;
  95. }
  96. /**
  97. * Retrieves the HTML embed code for the slide show
  98. */
  99. public function getEmbedCode() {
  100. return $this->_embedCode;
  101. }
  102. /**
  103. * Retrieves the Thumbnail URi for the slide show
  104. */
  105. public function getThumbnailUrl() {
  106. return $this->_thumbnailUrl;
  107. }
  108. /**
  109. * Sets the title for the Slide show
  110. */
  111. public function setTitle($title) {
  112. $this->_title = (string)$title;
  113. return $this;
  114. }
  115. /**
  116. * Retrieves the Slide show title
  117. */
  118. public function getTitle() {
  119. return $this->_title;
  120. }
  121. /**
  122. * Sets the description for the Slide show
  123. */
  124. public function setDescription($desc) {
  125. $this->_description = (string)$desc;
  126. return $this;
  127. }
  128. /**
  129. * Gets the description of the slide show
  130. */
  131. public function getDescription() {
  132. return $this->_description;
  133. }
  134. /**
  135. * Gets the numeric status of the slide show on the server
  136. */
  137. public function getStatus() {
  138. return $this->_status;
  139. }
  140. /**
  141. * Gets the textual description of the status of the slide show on
  142. * the server
  143. */
  144. public function getStatusDescription() {
  145. return $this->_statusDescription;
  146. }
  147. /**
  148. * Gets the permanent link of the slide show
  149. */
  150. public function getPermaLink() {
  151. return $this->_permalink;
  152. }
  153. /**
  154. * Gets the number of views the slide show has received
  155. */
  156. public function getNumViews() {
  157. return $this->_numViews;
  158. }
  159. }
  160. ]]></programlisting>
  161. <note>
  162. <para>
  163. The above pseudo-class only shows those methods which should be used by end-user
  164. developers. Other available methods are internal to the component.
  165. </para>
  166. </note>
  167. <para>
  168. When using the <classname>Zend_Service_SlideShare</classname> component, this data class will be
  169. used frequently to browse or add new slide shows to or from the web service.
  170. </para>
  171. </sect2>
  172. <sect2 id="zend.service.slideshare.getslideshow">
  173. <title>Retrieving a single slide show</title>
  174. <para>
  175. The simplest usage of the <classname>Zend_Service_SlideShare</classname> component is the
  176. retrieval of a single slide show by slide show ID provided by the slideshare.net
  177. application and is done by calling the <code>getSlideShow()</code> method of a
  178. <classname>Zend_Service_SlideShare</classname> object and using the resulting
  179. <classname>Zend_Service_SlideShare_SlideShow</classname> object as shown.
  180. </para>
  181. <programlisting language="php"><![CDATA[
  182. // Create a new instance of the component
  183. $ss = new Zend_Service_SlideShare('APIKEY',
  184. 'SHAREDSECRET',
  185. 'USERNAME',
  186. 'PASSWORD');
  187. $slideshow = $ss->getSlideShow(123456);
  188. print "Slide Show Title: {$slideshow->getTitle()}<br/>\n";
  189. print "Number of views: {$slideshow->getNumViews()}<br/>\n";
  190. ]]></programlisting>
  191. </sect2>
  192. <sect2 id="zend.service.slideshare.getslideshowlist">
  193. <title>Retrieving Groups of Slide Shows</title>
  194. <para>
  195. If you do not know the specific ID of a slide show you are interested in retrieving,
  196. you can retrieving groups of slide shows by using one of three methods:
  197. </para>
  198. <itemizedlist mark="opencircle">
  199. <listitem>
  200. <para>
  201. <emphasis>Slide shows from a specific account</emphasis>
  202. </para>
  203. <para>
  204. You can retrieve slide shows from a specific account by using the
  205. <code>getSlideShowsByUsername()</code> method and providing the username from
  206. which the slide shows should be retrieved
  207. </para>
  208. </listitem>
  209. <listitem>
  210. <para>
  211. <emphasis>Slide shows which contain specific tags</emphasis>
  212. </para>
  213. <para>
  214. You can retrieve slide shows which contain one or more specific tags by using
  215. the <code>getSlideShowsByTag</code> method and providing one or more tags which
  216. the slide show must have assigned to it in order to be retrieved
  217. </para>
  218. </listitem>
  219. <listitem>
  220. <para>
  221. <emphasis>Slide shows by group</emphasis>
  222. </para>
  223. <para>
  224. You can retrieve slide shows which are a member of a specific group using the
  225. <code>getSlideShowsByGroup</code> method and providing the name of the group
  226. which the slide show must belong to in order to be retrieved
  227. </para>
  228. </listitem>
  229. </itemizedlist>
  230. <para>
  231. Each of the above methods of retrieving multiple slide shows a similar approach is
  232. used. An example of using each method is shown below:
  233. </para>
  234. <programlisting language="php"><![CDATA[
  235. // Create a new instance of the component
  236. $ss = new Zend_Service_SlideShare('APIKEY',
  237. 'SHAREDSECRET',
  238. 'USERNAME',
  239. 'PASSWORD');
  240. $starting_offset = 0;
  241. $limit = 10;
  242. // Retrieve the first 10 of each type
  243. $ss_user = $ss->getSlideShowsByUser('username', $starting_offset, $limit);
  244. $ss_tags = $ss->getSlideShowsByTag('zend', $starting_offset, $limit);
  245. $ss_group = $ss->getSlideShowsByGroup('mygroup', $starting_offset, $limit);
  246. // Iterate over the slide shows
  247. foreach($ss_user as $slideshow) {
  248. print "Slide Show Title: {$slideshow->getTitle}<br/>\n";
  249. }
  250. ]]></programlisting>
  251. </sect2>
  252. <sect2 id="zend.service.slideshare.caching">
  253. <title>Zend_Service_SlideShare Caching policies</title>
  254. <para>
  255. By default, <classname>Zend_Service_SlideShare</classname> will cache any request against the web
  256. service automatically to the filesystem (default path <code>/tmp</code>) for 12 hours.
  257. If you desire to change this behavior, you must provide your own
  258. <xref linkend="zend.cache" /> object using the <code>setCacheObject</code> method as
  259. shown:
  260. </para>
  261. <programlisting language="php"><![CDATA[
  262. $frontendOptions = array(
  263. 'lifetime' => 7200,
  264. 'automatic_serialization' => true);
  265. $backendOptions = array(
  266. 'cache_dir' => '/webtmp/');
  267. $cache = Zend_Cache::factory('Core',
  268. 'File',
  269. $frontendOptions,
  270. $backendOptions);
  271. $ss = new Zend_Service_SlideShare('APIKEY',
  272. 'SHAREDSECRET',
  273. 'USERNAME',
  274. 'PASSWORD');
  275. $ss->setCacheObject($cache);
  276. $ss_user = $ss->getSlideShowsByUser('username', $starting_offset, $limit);
  277. ]]></programlisting>
  278. </sect2>
  279. <sect2 id="zend.service.slideshare.httpclient">
  280. <title>Changing the behavior of the HTTP Client</title>
  281. <para>
  282. If for whatever reason you would like to change the behavior of the HTTP client when
  283. making the web service request, you can do so by creating your own instance of the
  284. <classname>Zend_Http_Client</classname> object (see <xref linkend="zend.http" />). This is useful
  285. for instance when it is desirable to set the timeout for the connection to something
  286. other then default as shown:
  287. </para>
  288. <programlisting language="php"><![CDATA[
  289. $client = new Zend_Http_Client();
  290. $client->setConfig(array('timeout' => 5));
  291. $ss = new Zend_Service_SlideShare('APIKEY',
  292. 'SHAREDSECRET',
  293. 'USERNAME',
  294. 'PASSWORD');
  295. $ss->setHttpClient($client);
  296. $ss_user = $ss->getSlideShowsByUser('username', $starting_offset, $limit);
  297. ]]></programlisting>
  298. </sect2>
  299. </sect1>