Permalink
Browse files

#860574 by fago, Hugo Wetterberg, klausi, voxpelli: Port to Drupal 7

by fago: Change to use drupal_json_encode(), breaking change
  • Loading branch information...
1 parent 3684444 commit 1ce6b4761db805a69aa46e0f8de6fc30dae438fa Pelle Wessman committed Nov 19, 2010
Showing with 13 additions and 33 deletions.
  1. +3 −1 CHANGELOG
  2. +1 −5 README
  3. +6 −3 http_client.info
  4. +1 −22 http_client.module
  5. +2 −2 includes/HttpClient.inc
View
@@ -1,7 +1,9 @@
// $Id$
-Http Client 6.x-2.2, XXXX-XX-XX
+Http Client 7.x-2.2, XXXX-XX-XX
------------------------------
+by fago, Hugo Wetterberg, klausi, voxpelli: Port to Drupal 7
+by fago: Change to use drupal_json_encode(), breaking change
by klausi: Coding style fixes
Http Client 6.x-2.1, 2010-09-25
View
6 README
@@ -4,10 +4,6 @@ Comes with support for authenticating with OAuth.module version 3.x for easy to
Http Client has extensible support for different request and response body formats. That lets you send PHP data structures and have them serialized and deserialized automatically. JSON and serialized PHP is supported out of the box. This makes it a good companion to REST servers and very well suited for use with the version 2+ of the REST Server.
-Required modules
-
-* Autoload
-
Optional modules
-* OAuth 3.x
+* OAuth 3.x (Not ported to Drupal 7 yet)
View
@@ -1,8 +1,11 @@
; $Id$
name = Http Client
description = Provides a Http client for use with the services Http server
-dependencies[] = autoload
+
+files[] = http_client.module
+files[] = includes/HttpClient.inc
+files[] = includes/HttpClientXMLFormatter.inc
+files[] = includes/HttpClientCurlDelegate.inc
package = Services - clients
-core = 6.x
-php = 5.x
+core = 7.x
View
@@ -1,19 +1,5 @@
<?php
-/**
- * Implementation hook_autoload_info().
- */
-function http_client_autoload_info() {
- return array(
- 'HttpClient' => array('file' => 'includes/HttpClient.inc'),
- 'HttpClientAuthentication' => array('file' => 'includes/HttpClient.inc'),
- 'HttpClientRequest' => array('file' => 'includes/HttpClient.inc'),
- 'HttpClientBaseFormatter' => array('file' => 'includes/HttpClient.inc'),
- 'HttpClientCurlDelegate' => array('file' => 'includes/HttpClientCurlDelegate.inc'),
- 'HttpClientXMLFormatter' => array('file' => 'includes/HttpClientXMLFormatter.inc'),
- );
-}
-
/**
* Factory method for the HttpClient. Use this if you don't want to select a
* Http client delegate yourself.
@@ -43,7 +29,7 @@ function http_client($authentication = NULL, $formatter = NULL, $request_alter =
}
/**
- * Implementation of hook_http_client_delegates().
+ * Implements hook_http_client_delegates().
*/
function http_client_http_client_delegates() {
$delegates = array();
@@ -52,10 +38,3 @@ function http_client_http_client_delegates() {
}
return $delegates;
}
-
-/**
- * Implementation of hook_enable().
- */
-function http_client_enable() {
- autoload_flush_caches();
-}
View
@@ -319,7 +319,7 @@ class HttpClientBaseFormatter implements HttpClientFormatter {
return serialize($data);
break;
case self::FORMAT_JSON:
- return json_encode($data);
+ return drupal_json_encode($data);
break;
case self::FORMAT_FORM:
return http_build_query($data, NULL, '&');
@@ -346,7 +346,7 @@ class HttpClientBaseFormatter implements HttpClientFormatter {
}
break;
case self::FORMAT_JSON:
- $response = json_decode($data);
+ $response = drupal_json_decode($data);
if ($response === NULL) {
throw new Exception(t('Unserialization of response body failed.'), 1);
}

0 comments on commit 1ce6b47

Please sign in to comment.