From a1596c3217ab5402ce5024bbada95f91f4ebc932 Mon Sep 17 00:00:00 2001 From: Matthew Baggett Date: Tue, 8 Jan 2013 21:09:17 +0000 Subject: [PATCH 01/13] Sorting out scopes for userinfo and latitude --- library/eden/google/oauth.php | 124 +++++++++++++++++++--------------- 1 file changed, 68 insertions(+), 56 deletions(-) diff --git a/library/eden/google/oauth.php b/library/eden/google/oauth.php index 1214499..f01ec9e 100644 --- a/library/eden/google/oauth.php +++ b/library/eden/google/oauth.php @@ -21,34 +21,40 @@ class Eden_Google_Oauth extends Eden_Oauth2_Client { const REQUEST_URL = 'https://accounts.google.com/o/oauth2/auth'; const ACCESS_URL = 'https://accounts.google.com/o/oauth2/token'; - const SCOPE_ANALYTICS = 'https://www.googleapis.com/auth/analytics.readonly'; - const SCOPE_BASE = 'https://www.google.com/base/feeds/'; - const SCOPE_BUZZ = 'https://www.googleapis.com/auth/buzz'; - const SCOPE_BOOK = 'https://www.google.com/books/feeds/'; - const SCOPE_BLOGGER = 'https://www.blogger.com/feeds/'; - const SCOPE_CALENDAR = 'https://www.google.com/calendar/feeds/'; - const SCOPE_CONTACTS = 'https://www.google.com/m8/feeds/'; - const SCOPE_CHROME = 'https://www.googleapis.com/auth/chromewebstore.readonly'; - const SCOPE_DOCUMENTS = 'https://docs.google.com/feeds/'; - const SCOPE_DRIVE = 'https://www.googleapis.com/auth/drive'; - const SCOPE_FINANCE = 'https://finance.google.com/finance/feeds/'; - const SCOPE_GMAIL = 'https://mail.google.com/mail/feed/atom'; - const SCOPE_HEALTH = 'https://www.google.com/health/feeds/'; - const SCOPE_H9 = 'https://www.google.com/h9/feeds/'; - const SCOPE_MAPS = 'https://maps.google.com/maps/feeds/'; - const SCOPE_MODERATOR = 'https://www.googleapis.com/auth/moderator'; - const SCOPE_OPENSOCIAL = 'https://www-opensocial.googleusercontent.com/api/people/'; - const SCOPE_ORKUT = 'https://www.googleapis.com/auth/orkut'; - const SCOPE_PLUS = 'https://www.googleapis.com/auth/plus.me'; - const SCOPE_PICASA = 'https://picasaweb.google.com/data/'; - const SCOPE_SIDEWIKI = 'https://www.google.com/sidewiki/feeds/'; - const SCOPE_SITES = 'https://sites.google.com/feeds/'; - const SCOPE_SREADSHEETS = 'https://spreadsheets.google.com/feeds/'; - const SCOPE_TASKS = 'https://www.googleapis.com/auth/tasks'; - const SCOPE_SHORTENER = 'https://www.googleapis.com/auth/urlshortener'; - const SCOPE_WAVE = 'http://wave.googleusercontent.com/api/rpc'; - const SCOPE_WEBMASTER = 'https://www.google.com/webmasters/tools/feeds/'; - const SCOPE_YOUTUBE = 'https://gdata.youtube.com'; + const SCOPE_ANALYTICS = 'https://www.googleapis.com/auth/analytics.readonly'; + const SCOPE_BASE = 'https://www.google.com/base/feeds/'; + const SCOPE_BUZZ = 'https://www.googleapis.com/auth/buzz'; + const SCOPE_BOOK = 'https://www.google.com/books/feeds/'; + const SCOPE_BLOGGER = 'https://www.blogger.com/feeds/'; + const SCOPE_CALENDAR = 'https://www.google.com/calendar/feeds/'; + const SCOPE_CONTACTS = 'https://www.google.com/m8/feeds/'; + const SCOPE_CHROME = 'https://www.googleapis.com/auth/chromewebstore.readonly'; + const SCOPE_DOCUMENTS = 'https://docs.google.com/feeds/'; + const SCOPE_DRIVE = 'https://www.googleapis.com/auth/drive'; + const SCOPE_FINANCE = 'https://finance.google.com/finance/feeds/'; + const SCOPE_GMAIL = 'https://mail.google.com/mail/feed/atom'; + const SCOPE_HEALTH = 'https://www.google.com/health/feeds/'; + const SCOPE_H9 = 'https://www.google.com/h9/feeds/'; + const SCOPE_LATITUDE_ALL_BEST = 'https://www.googleapis.com/auth/latitude.all.best'; + const SCOPE_LATITUDE_ALL_CITY = 'https://www.googleapis.com/auth/latitude.all.city'; + const SCOPE_LATITUDE_CURRENT_BEST = 'https://www.googleapis.com/auth/latitude.current.best'; + const SCOPE_LATITUDE_CURRENT_CITY = 'https://www.googleapis.com/auth/latitude.current.city'; + const SCOPE_MAPS = 'https://maps.google.com/maps/feeds/'; + const SCOPE_MODERATOR = 'https://www.googleapis.com/auth/moderator'; + const SCOPE_OPENSOCIAL = 'https://www-opensocial.googleusercontent.com/api/people/'; + const SCOPE_ORKUT = 'https://www.googleapis.com/auth/orkut'; + const SCOPE_PLUS = 'https://www.googleapis.com/auth/plus.me'; + const SCOPE_PICASA = 'https://picasaweb.google.com/data/'; + const SCOPE_SIDEWIKI = 'https://www.google.com/sidewiki/feeds/'; + const SCOPE_SITES = 'https://sites.google.com/feeds/'; + const SCOPE_SREADSHEETS = 'https://spreadsheets.google.com/feeds/'; + const SCOPE_TASKS = 'https://www.googleapis.com/auth/tasks'; + const SCOPE_SHORTENER = 'https://www.googleapis.com/auth/urlshortener'; + const SCOPE_USERINFO = 'https://www.googleapis.com/auth/userinfo.profile'; + const SCOPE_WAVE = 'http://wave.googleusercontent.com/api/rpc'; + const SCOPE_WEBMASTER = 'https://www.google.com/webmasters/tools/feeds/'; + const SCOPE_YOUTUBE = 'https://gdata.youtube.com'; + /* Public Properties -------------------------------*/ @@ -56,34 +62,40 @@ class Eden_Google_Oauth extends Eden_Oauth2_Client { -------------------------------*/ protected $_apiKey = NULL; protected $_scopes = array( - 'analytics' => self::SCOPE_ANALYTICS, - 'base' => self::SCOPE_BASE, - 'buzz' => self::SCOPE_BUZZ, - 'book' => self::SCOPE_BOOK, - 'blogger' => self::SCOPE_BLOGGER, - 'calendar' => self::SCOPE_CALENDAR, - 'contacts' => self::SCOPE_CONTACTS, - 'chrome' => self::SCOPE_CHROME, - 'documents' => self::SCOPE_DOCUMENTS, - 'drive' => self::SCOPE_DRIVE, - 'finance' => self::SCOPE_FINANCE, - 'gmail' => self::SCOPE_GMAIL, - 'health' => self::SCOPE_HEALTH, - 'h9' => self::SCOPE_H9, - 'maps' => self::SCOPE_MAPS, - 'moderator' => self::SCOPE_MODERATOR, - 'opensocial' => self::SCOPE_OPENSOCIAL, - 'orkut' => self::SCOPE_ORKUT, - 'plus' => self::SCOPE_PLUS, - 'picasa' => self::SCOPE_PICASA, - 'sidewiki' => self::SCOPE_SIDEWIKI, - 'sites' => self::SCOPE_SITES, - 'spreadsheets' => self::SCOPE_SREADSHEETS, - 'tasks' => self::SCOPE_TASKS, - 'shortener' => self::SCOPE_SHORTENER, - 'wave' => self::SCOPE_WAVE, - 'webmaster' => self::SCOPE_WEBMASTER, - 'youtube' => self::SCOPE_YOUTUBE); + 'analytics' => self::SCOPE_ANALYTICS, + 'base' => self::SCOPE_BASE, + 'buzz' => self::SCOPE_BUZZ, + 'book' => self::SCOPE_BOOK, + 'blogger' => self::SCOPE_BLOGGER, + 'calendar' => self::SCOPE_CALENDAR, + 'contacts' => self::SCOPE_CONTACTS, + 'chrome' => self::SCOPE_CHROME, + 'documents' => self::SCOPE_DOCUMENTS, + 'drive' => self::SCOPE_DRIVE, + 'finance' => self::SCOPE_FINANCE, + 'gmail' => self::SCOPE_GMAIL, + 'health' => self::SCOPE_HEALTH, + 'h9' => self::SCOPE_H9, + 'latitude_all_best' => self::SCOPE_LATITUDE_ALL_BEST, + 'latitude_all_city' => self::SCOPE_LATITUDE_ALL_CITY, + 'latitude_current_best' => self::SCOPE_LATITUDE_CURRENT_BEST, + 'latitude_current_city' => self::SCOPE_LATITUDE_CURRENT_CITY, + 'maps' => self::SCOPE_MAPS, + 'moderator' => self::SCOPE_MODERATOR, + 'opensocial' => self::SCOPE_OPENSOCIAL, + 'orkut' => self::SCOPE_ORKUT, + 'plus' => self::SCOPE_PLUS, + 'picasa' => self::SCOPE_PICASA, + 'sidewiki' => self::SCOPE_SIDEWIKI, + 'sites' => self::SCOPE_SITES, + 'spreadsheets' => self::SCOPE_SREADSHEETS, + 'tasks' => self::SCOPE_TASKS, + 'shortener' => self::SCOPE_SHORTENER, + 'userinfo' => self::SCOPE_USERINFO, + 'wave' => self::SCOPE_WAVE, + 'webmaster' => self::SCOPE_WEBMASTER, + 'youtube' => self::SCOPE_YOUTUBE + ); /* Private Properties -------------------------------*/ From bd9d80a0ab679914c3e686c6c30ebcac2a2d6636 Mon Sep 17 00:00:00 2001 From: Matthew Baggett Date: Tue, 8 Jan 2013 21:38:59 +0000 Subject: [PATCH 02/13] Adding reverse geolocation support, making address & sensor optional --- library/eden/google/maps/geocoding.php | 63 +++++++++++++++++++++----- 1 file changed, 52 insertions(+), 11 deletions(-) diff --git a/library/eden/google/maps/geocoding.php b/library/eden/google/maps/geocoding.php index 9e06918..2a1f7e4 100644 --- a/library/eden/google/maps/geocoding.php +++ b/library/eden/google/maps/geocoding.php @@ -37,7 +37,7 @@ public static function i() { * The bounding box of the viewport within which to bias geocode results more prominently. * * @param string - * @return this + * @return Eden_Google_Maps_Geocoding */ public function setBounds($bounds) { //argument 1 must be a string @@ -47,11 +47,27 @@ public function setBounds($bounds) { return $this; } + /** + * Specify the Latitude & Longitude of the location to geocode + * + * @param float Latitude + * @param float Longitude + * @return Eden_Google_Maps_Geocoding + */ + public function setLatLng($lat,$lng){ + // arguments 1 & 2 must be floats + Eden_Google_Error::i() + ->argument(1, 'float') + ->argument(2, 'float'); + $this->_query['latlng'] = "{$lat},{$lng}"; + return $this; + } + /** * The language in which to return results. * * @param string - * @return this + * @return Eden_Google_Maps_Geocoding */ public function setLanguage($language) { //argument 1 must be a string @@ -65,7 +81,7 @@ public function setLanguage($language) { * The region code * * @param string - * @return this + * @return Eden_Google_Maps_Geocoding */ public function setRegion($region) { //argument 1 must be a string @@ -75,6 +91,32 @@ public function setRegion($region) { return $this; } + /** + * Set the address to geocode + * + * @param string $address + * @return Eden_Google_Maps_Geocoding + */ + public function setAddress($address){ + // argument 1 must be a string + Eden_Google_Error::i()->argument(1, 'string'); + $this->_query['address'] = $address; + return $this; + } + + /** + * Set the state of the sensor flag + * + * @param string $sensor 'true'|'false' + * @return Eden_Google_Maps_Geocoding + */ + public function setSensor($sensor = 'false'){ + // argument 1 must be a string + Eden_Google_Error::i()->argument(1, 'string'); + $this->_query['sensor'] = $sensor; + return $this; + } + /** * Returns geocode information * @@ -82,14 +124,13 @@ public function setRegion($region) { * @param string * @return array */ - public function getResponse($address, $sensor = 'false') { - //argument test - Eden_Google_Error::i() - ->argument(1, 'string') //argument 1 must be a string - ->argument(2, 'string'); //argument 2 must be a string - - $this->_query['address'] = $address; - $this->_query['sensor'] = $sensor; + public function getResponse($address = null, $sensor = null) { + if($address){ + $this->setAddress($address); + } + if($sensor){ + $this->setSensor($sensor); + } return $this->_getResponse(self::URL_MAP_GEOCODING, $this->_query); } From 5aab1235352c6b8be268e785b38e6d6172f86dcb Mon Sep 17 00:00:00 2001 From: Matthew Baggett Date: Tue, 8 Jan 2013 22:10:56 +0000 Subject: [PATCH 03/13] Geocoding support - sensor is mandatory --- library/eden/google/maps/geocoding.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/eden/google/maps/geocoding.php b/library/eden/google/maps/geocoding.php index 2a1f7e4..effbb83 100644 --- a/library/eden/google/maps/geocoding.php +++ b/library/eden/google/maps/geocoding.php @@ -131,7 +131,11 @@ public function getResponse($address = null, $sensor = null) { if($sensor){ $this->setSensor($sensor); } - + + if(!isset($this->_query['sensor'])){ + throw Eden_Google_Error::i("Cannot make google maps api request without sensor parameter"); + } + return $this->_getResponse(self::URL_MAP_GEOCODING, $this->_query); } /* Protected Methods From e3fd17a94040dcb8752b1935b94ee68881bf9c6b Mon Sep 17 00:00:00 2001 From: geusebio Date: Fri, 18 Jan 2013 02:53:54 +0000 Subject: [PATCH 04/13] I have changed how it finds which ec2 endpoint it is seeking. --- library/eden/amazon.php | 4 +- library/eden/amazon/ec2/ami.php | 12 ++-- library/eden/amazon/ec2/base.php | 70 +++++++++++++++++-- library/eden/amazon/ec2/customergateway.php | 6 +- library/eden/amazon/ec2/devpay.php | 2 +- library/eden/amazon/ec2/dhcp.php | 6 +- library/eden/amazon/ec2/elasticbookstore.php | 30 ++++---- library/eden/amazon/ec2/elasticipaddress.php | 10 +-- library/eden/amazon/ec2/general.php | 2 +- library/eden/amazon/ec2/instances.php | 51 +++++++++++--- library/eden/amazon/ec2/internetgateway.php | 10 +-- library/eden/amazon/ec2/keypairs.php | 8 +-- library/eden/amazon/ec2/monitoring.php | 4 +- library/eden/amazon/ec2/networkacl.php | 24 +++---- library/eden/amazon/ec2/networkinterface.php | 16 ++--- library/eden/amazon/ec2/placementgroups.php | 6 +- library/eden/amazon/ec2/reservedinstances.php | 6 +- library/eden/amazon/ec2/routetables.php | 18 ++--- library/eden/amazon/ec2/securitygroups.php | 10 +-- library/eden/amazon/ec2/spotinstances.php | 10 +-- library/eden/amazon/ec2/subnets.php | 6 +- library/eden/amazon/ec2/tags.php | 6 +- .../amazon/ec2/virtualprivategateways.php | 10 +-- library/eden/amazon/ec2/vmexport.php | 8 +-- library/eden/amazon/ec2/vmimport.php | 6 +- library/eden/amazon/ec2/vpc.php | 6 +- library/eden/amazon/ec2/vpnconnections.php | 6 +- library/eden/amazon/ec2/windows.php | 8 +-- 28 files changed, 229 insertions(+), 132 deletions(-) diff --git a/library/eden/amazon.php b/library/eden/amazon.php index fa94c41..157003d 100644 --- a/library/eden/amazon.php +++ b/library/eden/amazon.php @@ -33,12 +33,12 @@ require_once dirname(__FILE__).'/amazon/ec2/virtualprivategateways.php'; require_once dirname(__FILE__).'/amazon/ec2/vmexport.php'; require_once dirname(__FILE__).'/amazon/ec2/vmimport.php'; -require_once dirname(__FILE__).'/amazon/ec2/vnpconnections.php'; +require_once dirname(__FILE__).'/amazon/ec2/vpnconnections.php'; require_once dirname(__FILE__).'/amazon/ec2/vpc.php'; require_once dirname(__FILE__).'/amazon/ec2/windows.php'; require_once dirname(__FILE__).'/amazon/ecs.php'; require_once dirname(__FILE__).'/amazon/s3.php'; -require_once dirname(__FILE__).'/amazon/ses.php'; +#require_once dirname(__FILE__).'/amazon/ses.php'; require_once dirname(__FILE__).'/amazon/sns.php'; /** diff --git a/library/eden/amazon/ec2/ami.php b/library/eden/amazon/ec2/ami.php index 653987b..6b79606 100644 --- a/library/eden/amazon/ec2/ami.php +++ b/library/eden/amazon/ec2/ami.php @@ -49,7 +49,7 @@ public function registerImage($name) { $this->_query['Action'] = 'RegisterImage'; $this->_query['Name'] = $name; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } @@ -72,7 +72,7 @@ public function createImage($imageName, $instanceId) { $this->_query['Name'] = $imageName; $this->_query['InstanceId'] = $instanceId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -88,7 +88,7 @@ public function deregisterImage($imageId) { $this->_query['Action'] = 'DeregisterImage'; $this->_query['ImageId'] = $ImageId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -118,7 +118,7 @@ public function describeImageAttribute($imageId, $attribute) { $this->_query['ImageId'] = $imageId; $this->_query['Attribute'] = $attribute; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -133,7 +133,7 @@ public function describeImages() { $this->_query['Action'] = 'DescribeImages'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -149,7 +149,7 @@ public function modifyImageAttribute() { $this->_query['Action'] = 'ModifyImageAttribute'; $this->_query['ImageId'] = $imageId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** diff --git a/library/eden/amazon/ec2/base.php b/library/eden/amazon/ec2/base.php index 2d41959..31fac3d 100644 --- a/library/eden/amazon/ec2/base.php +++ b/library/eden/amazon/ec2/base.php @@ -17,8 +17,16 @@ class Eden_Amazon_Ec2_Base extends Eden_Class { /* Constants -------------------------------*/ - const AMAZON_EC2_URL = 'https://ec2.amazonaws.com/'; - const AMAZON_EC2_HOST = 'ec2.amazonaws.com'; + const AMAZON_EC2_URL = 'https://ec2.amazonaws.com/'; + const AMAZON_EC2_HOST = 'ec2.amazonaws.com'; + const AMAZON_EC2_HOST_US_VIRGINIA = 'ec2.us-east-1.amazonaws.com'; + const AMAZON_EC2_HOST_US_OREGON = 'ec2.us-west-2.amazonaws.com'; + const AMAZON_EC2_HOST_US_CALIFORNIA = 'ec2.us-west-1.amazonaws.com'; + const AMAZON_EC2_HOST_EU_IRELAND = 'ec2.eu-west-1.amazonaws.com'; + const AMAZON_EC2_HOST_ASIA_SIGNAPORE = 'ec2.ap-southeast-1.amazonaws.com'; + const AMAZON_EC2_HOST_ASIA_SYDNEY = 'ec2.ap-southeast-2.amazonaws.com'; + const AMAZON_EC2_HOST_ASIA_TOKYO = 'ec2.ap-northeast-1.amazonaws.com'; + const AMAZON_EC2_HOST_SA_SAOPAULO = 'ec2.sa-east-1.amazonaws.com'; const VERSION_DATE = '2012-07-20'; const VERSION = 'Version'; @@ -32,8 +40,9 @@ class Eden_Amazon_Ec2_Base extends Eden_Class { -------------------------------*/ /* Protected Properties -------------------------------*/ - protected $_meta = NULL; - protected $_versionDate = self::VERSION_DATE; + protected $_meta = NULL; + protected $_versionDate = self::VERSION_DATE; + static protected $_selected_ec2_host = self::AMAZON_EC2_HOST; /* Private Properties -------------------------------*/ @@ -55,6 +64,47 @@ public function __construct($accessKey, $accessSecret) { /* Public Methods -------------------------------*/ + + /** + * Change the EC2 region + * @param string $region + */ + public function setRegion($region){ + switch($region){ + case 'virginia': + self::$_selected_ec2_host = self::AMAZON_EC2_HOST_US_VIRGINIA; + break; + case 'oregon': + self::$_selected_ec2_host = self::AMAZON_EC2_HOST_US_OREGON; + break; + case 'california': + self::$_selected_ec2_host = self::AMAZON_EC2_HOST_US_CALIFORNIA; + break; + case 'ireland': + self::$_selected_ec2_host = self::AMAZON_EC2_HOST_EU_IRELAND; + break; + case 'signapore': + self::$_selected_ec2_host = self::AMAZON_EC2_HOST_ASIA_SIGNAPORE; + break; + case 'sydney': + self::$_selected_ec2_host = self::AMAZON_EC2_HOST_ASIA_SYDNEY; + break; + case 'tokyo': + self::$_selected_ec2_host = self::AMAZON_EC2_HOST_ASIA_TOKYO; + break; + case 'sao paulo': + self::$_selected_ec2_host = self::AMAZON_EC2_HOST_SA_SAOPAULO; + break; + default: + throw new Exception("Sadly, {$region} is not an available region"); + + } + return $this; + } + + public function getRegion(){ + return self::$_selected_ec2_host; + } /** * The name of a filter. * @@ -198,31 +248,43 @@ protected function _formatQuery($rawQuery) { protected function _getResponse($host, $rawQuery) { //prevent sending null values $rawQuery = $this->_accessKey($rawQuery); + //sort the raw query ksort($rawQuery); + //format array query $query = $this->_formatQuery($rawQuery); + // Build out the variables $domain = "https://$host/"; + //set parameters for generating request $query[self::ACCESS_KEY] = $this->_accessKey; $query[self::TIMESTAMP] = date('c'); $query[self::VERSION] = $this->_versionDate; $query[self::SIGNATURE_METHOD] = 'HmacSHA256'; $query[self::SIGNATURE_VERSION] = 2; + //create a request signature for security access $query[self::SIGNATURE] = $this->_generateSignature($host, $query); + //build a http query $url = $domain.'?'.http_build_query($query); + //set curl $curl = Eden_Curl::i() ->setUrl($url) ->verifyHost(false) ->verifyPeer(false) ->setTimeout(60); + //get response from curl $response = $curl->getResponse(); + /*echo $url."\n"; + var_dump($response); + echo "\n\n\n";*/ + //if result is in xml format if($this->isXml($response)){ //convert it to string diff --git a/library/eden/amazon/ec2/customergateway.php b/library/eden/amazon/ec2/customergateway.php index fa641e2..a088eaa 100644 --- a/library/eden/amazon/ec2/customergateway.php +++ b/library/eden/amazon/ec2/customergateway.php @@ -56,7 +56,7 @@ public function createCustomerGateway($type, $ipAddress, $bgpAsn) { $this->_query['IpAddress'] = $ipAddress; $this->_query['BgpAsn'] = $bgpAsn; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } @@ -74,7 +74,7 @@ public function deleteCustomerGateway($customerGatewayId) { $this->_query['Action'] = 'DeleteCustomerGateway'; $this->_query['CustomerGatewayId'] = $customerGatewayId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } @@ -91,7 +91,7 @@ public function describeCustomerGateway() { $this->_query['Action'] = 'DescribeCustomerGateways'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } diff --git a/library/eden/amazon/ec2/devpay.php b/library/eden/amazon/ec2/devpay.php index f905bf6..9f23c09 100644 --- a/library/eden/amazon/ec2/devpay.php +++ b/library/eden/amazon/ec2/devpay.php @@ -54,7 +54,7 @@ public function confirmProductInstance($productCode, $instanceId) { 'ProductCode' => $productCode, 'InstanceId' => $instanceId); - return $this->_getResponse(self::AMAZON_EC2_HOST, $query); + return $this->_getResponse(self::getRegion(), $query); } /* Protected Methods diff --git a/library/eden/amazon/ec2/dhcp.php b/library/eden/amazon/ec2/dhcp.php index ef8d192..c39498f 100644 --- a/library/eden/amazon/ec2/dhcp.php +++ b/library/eden/amazon/ec2/dhcp.php @@ -50,7 +50,7 @@ public function associateDhcpOptions($dhcpOptionsId, $vpcId) { $this->_query['DhcpOptionsId'] = $dhcpOptionsId; $this->_query['VpcId'] = $vpcId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } @@ -66,7 +66,7 @@ public function createDhcpOptions() { $this->_query['Action'] = 'CreateDhcpOptions'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } @@ -86,7 +86,7 @@ public function deleteDhcpOptions($dhcpOptionsId) { $this->_query['Action'] = 'DeleteDhcpOptions'; $this->_query['DhcpOptionsId'] = $dhcpOptionsId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** diff --git a/library/eden/amazon/ec2/elasticbookstore.php b/library/eden/amazon/ec2/elasticbookstore.php index 068cfd1..baa62b8 100644 --- a/library/eden/amazon/ec2/elasticbookstore.php +++ b/library/eden/amazon/ec2/elasticbookstore.php @@ -52,7 +52,7 @@ public function attachVolume($volumeId, $instanceId, $device) { $this->_query['InstanceId'] = $instanceId; $this->_query['Device'] = $device; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } @@ -75,7 +75,7 @@ public function createSnapShot($volumeId, $description) { $this->_query['VolumeId'] = $volumeId; $this->_query['Description'] = $description; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } @@ -95,7 +95,7 @@ public function createVolume($availabilityZone) { $this->_query['Action'] = 'CreateVolume'; $this->_query['AvailabilityZone'] = $availabilityZone; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } @@ -112,7 +112,7 @@ public function deleteSnapshot($snapshotId) { $this->_query['Action'] = 'DeleteSnapshot'; $this->_query['SnapshotId'] = $snapshotId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -129,7 +129,7 @@ public function deleteVolume($volumeId) { $this->_query['Action'] = 'DeleteSnapshot'; $this->_query['VolumeId'] = $volumeId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -150,7 +150,7 @@ public function describeSnapshotAttribute($snapshotId, $attribute) { $this->_query['SnapshotId'] = $snapshotId; $this->_query['Attribute'] = $attribute; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -166,7 +166,7 @@ public function describeSnapshots() { $this->_query['Action'] = 'DescribeSnapshots'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -178,7 +178,7 @@ public function describeVolumes() { $this->_query['Action'] = 'DescribeVolumes'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -198,7 +198,7 @@ public function describeVolumeAttribute($volumeId, $attribute) { $this->_query['VolumeId'] = $volumeId; $this->_query['Attribute'] = $attribute; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -210,7 +210,7 @@ public function describeVolumeStatus() { $this->_query['Action'] = 'DescribeVolumeStatus'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -226,7 +226,7 @@ public function detachVolume($volumeId) { $this->_query['Action'] = 'DetachVolume'; $this->_query['VolumeId'] = $volumeId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -243,7 +243,7 @@ public function enableVolumeIO($volumeId) { $this->_query['Action'] = 'EnableVolumeIO'; $this->_query['VolumeId'] = $volumeId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -271,7 +271,7 @@ public function importVolume($imageFormat, $imageBytes, $url, $volumeSize) { $this->_query['Image.ImportManifestUrl'] = $url; $this->_query['Volume.Size'] = $volumeSize; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -291,7 +291,7 @@ public function modifyVolumeAttribute($volumeId, $autoEnableIO = false) { $this->_query['VolumeId'] = $imageFormat; $this->_query['AutoEnableIO.Value'] = $autoEnableIO; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -312,7 +312,7 @@ public function resetSnapshotAttribute($snapshotId, $attribute) { $this->_query['SnapshotId'] = $snapshotId; $this->_query['Attribute'] = $attribute; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** diff --git a/library/eden/amazon/ec2/elasticipaddress.php b/library/eden/amazon/ec2/elasticipaddress.php index 04e2e29..466488f 100644 --- a/library/eden/amazon/ec2/elasticipaddress.php +++ b/library/eden/amazon/ec2/elasticipaddress.php @@ -41,7 +41,7 @@ public function allocateAddress() { $this->_query['Action'] = 'AllocateAddress'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -56,7 +56,7 @@ public function associateAddress() { $this->_query['Action'] = 'AssociateAddress'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -69,7 +69,7 @@ public function describeAddresses() { $this->_query['Action'] = 'DescribeAddresses'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -81,7 +81,7 @@ public function disassociateAddress() { $this->_query['Action'] = 'DisassociateAddress'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -93,7 +93,7 @@ public function releaseAddress() { $this->_query['Action'] = 'ReleaseAddress'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** diff --git a/library/eden/amazon/ec2/general.php b/library/eden/amazon/ec2/general.php index 0faeace..9bccc2c 100644 --- a/library/eden/amazon/ec2/general.php +++ b/library/eden/amazon/ec2/general.php @@ -44,7 +44,7 @@ public function getConsoleOutput($instanceId) { $this->_query['Action'] = 'GetConsoleOutput'; $this->_query['InstanceId'] = $instanceId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /* Protected Methods diff --git a/library/eden/amazon/ec2/instances.php b/library/eden/amazon/ec2/instances.php index e627762..11b1be2 100644 --- a/library/eden/amazon/ec2/instances.php +++ b/library/eden/amazon/ec2/instances.php @@ -48,7 +48,7 @@ public function describeInstanceAttribute($instanceId, $attribute) { $this->_query['InstanceId'] = $instanceId; $this->_query['Attribute'] = $attribute; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -60,7 +60,7 @@ public function describeInstances() { $this->_query['Action'] = 'DescribeInstances'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -72,7 +72,7 @@ public function describeInstanceStatus() { $this->_query['Action'] = 'DescribeInstanceStatus'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -87,7 +87,7 @@ public function rebootInstances() { $this->_query['Action'] = 'RebootInstances'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -106,7 +106,7 @@ public function reportInstanceStatus() { $this->_query['Action'] = 'ReportInstanceStatus'; $this->_query['Status'] = $status; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -128,7 +128,7 @@ public function resetInstanceAttribute($instanceId, $attribute) { $this->_query['InstanceId'] = $instanceId; $this->_query['Attribute'] = $attribute; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -153,7 +153,7 @@ public function runInstances($instanceId, $attribute) { $this->_query['MinCount'] = $minCount; $this->_query['MaxCount'] = $maxCount; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -165,9 +165,44 @@ public function startInstances() { $this->_query['Action'] = 'StartInstances'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } + /** + * Stops an Amazon EBS-backed AMI that you've previously started. + * + * @return array + */ + public function stopInstances() { + + $this->_query['Action'] = 'StopInstances'; + + return $this->_getResponse(self::getRegion(), $this->_query); + } + + /** + * Terminates an Amazon EBS-backed AMI + * + * @return array + */ + public function terminateInstances() { + + $this->_query['Action'] = 'TerminateInstances'; + + return $this->_getResponse(self::getRegion(), $this->_query); + } + + public function createTags($key, $value){ + Eden_Amazon_Error::i()->argument(1, 'string'); + Eden_Amazon_Error::i()->argument(2, 'string'); + $this->_query['ResourceId_'] = $this->_query['InstanceId_']; + unset($this->_query['InstanceId_']); + $this->_query['Action'] = 'CreateTags'; + $this->_query['Tag.1.Key'] = $key; + $this->_query['Tag.1.Value'] = $value; + + return $this->_getResponse(self::getRegion(), $this->_query); + } /** * One or more instance IDs. * diff --git a/library/eden/amazon/ec2/internetgateway.php b/library/eden/amazon/ec2/internetgateway.php index aa6290a..9257fd5 100644 --- a/library/eden/amazon/ec2/internetgateway.php +++ b/library/eden/amazon/ec2/internetgateway.php @@ -49,7 +49,7 @@ public function attachInternetGateway($internetGatewayId, $vpcId) { $this->_query['InternetGatewayId'] = $internetGatewayId; $this->_query['VpcId'] = $vpcId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -62,7 +62,7 @@ public function createInternetGateway() { $this->_query['Action'] = 'CreateInternetGateway'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -79,7 +79,7 @@ public function deleteInternetGateway($internetGatewayId) { $this->_query['Action'] = 'DeleteInternetGateway'; $this->_query['InternetGatewayId'] = $internetGatewayId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -91,7 +91,7 @@ public function describeInternetGateways() { $this->_query['Action'] = 'DescribeInternetGateways'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -113,7 +113,7 @@ public function detachInternetGateway($vpcId, $internetGatewayId) { $this->_query['VpcId'] = $vpcId; $this->_query['InternetGatewayId'] = $internetGatewayId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** diff --git a/library/eden/amazon/ec2/keypairs.php b/library/eden/amazon/ec2/keypairs.php index 7c27451..da721a9 100644 --- a/library/eden/amazon/ec2/keypairs.php +++ b/library/eden/amazon/ec2/keypairs.php @@ -47,7 +47,7 @@ public function createKeyPair($keyName) { $this->_query['Action'] = 'CreateKeyPair'; $this->_query['KeyName'] = $keyName; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -64,7 +64,7 @@ public function deleteKeyPair($keyName) { $this->_query['Action'] = 'DeleteKeyPair'; $this->_query['KeyName'] = $keyName; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -76,7 +76,7 @@ public function describeKeyPairs() { $this->_query['Action'] = 'DescribeKeyPairs'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -98,7 +98,7 @@ public function importKeyPair($keyName, $publicKeyMaterial) { $this->_query['KeyName'] = $keyName; $this->_query['PublicKeyMaterial'] = base64_encode($publicKeyMaterial); - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** diff --git a/library/eden/amazon/ec2/monitoring.php b/library/eden/amazon/ec2/monitoring.php index 17dd599..bddd4c3 100644 --- a/library/eden/amazon/ec2/monitoring.php +++ b/library/eden/amazon/ec2/monitoring.php @@ -40,7 +40,7 @@ public function monitorInstances() { $this->_query['Action'] = 'MonitorInstances'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -52,7 +52,7 @@ public function unmonitorInstances() { $this->_query['Action'] = 'UnmonitorInstances'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** diff --git a/library/eden/amazon/ec2/networkacl.php b/library/eden/amazon/ec2/networkacl.php index 8f2170c..a1388e4 100644 --- a/library/eden/amazon/ec2/networkacl.php +++ b/library/eden/amazon/ec2/networkacl.php @@ -44,7 +44,7 @@ public function createNetworkAcl($VpcId) { $this->_query['Action'] = 'CreateNetworkAcl'; $this->_query['VpcId'] = $vpcId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -73,7 +73,7 @@ public function createNetworkAclEntry($networkAclId, $ruleNumber, $protocol, $ru $this->_query['RuleAction'] = $ruleAction; $this->_query['CidrBlock'] = $cidrBlock; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -90,7 +90,7 @@ public function deleteNetworkAcl($networkAclId) { $this->_query['Action'] = 'DeleteNetworkAcl'; $this->_query['NetworkAclId'] = $networkAclId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -110,7 +110,7 @@ public function deleteNetworkAclEntry($networkAclId, $ruleNumber) { $this->_query['NetworkAclId'] = $networkAclId; $this->_query['RuleNumber'] = $ruleNumber; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -122,7 +122,7 @@ public function describeNetworkAcls() { $this->_query['Action'] = 'DescribeNetworkAcls'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -143,7 +143,7 @@ public function replaceNetworkAclAssociation($networkAclId, $associationId) { $this->_query['NetworkAclId'] = $networkAclId; $this->_query['AssociationId'] = $associationId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -172,7 +172,7 @@ public function replaceNetworkAclEntry($networkAclId, $ruleNumber, $protocol, $r $this->_query['RuleAction'] = $ruleAction; $this->_query['CidrBlock'] = $cidrBlock; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -188,7 +188,7 @@ public function setEgress($egress) { $this->_query['Egress'] = $egress; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -204,7 +204,7 @@ public function setIcmpCode($code) { $this->_query['Icmp.Code'] = $code; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -219,7 +219,7 @@ public function setIcmpType($code) { $this->_query['Icmp.Type'] = $code; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -235,7 +235,7 @@ public function setPortRangeFrom($firstPort) { $this->_query['PortRange.From'] = $firstPort; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -251,7 +251,7 @@ public function setPortRangeTo($lastPort) { $this->_query['PortRange.To'] = $lastPort; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** diff --git a/library/eden/amazon/ec2/networkinterface.php b/library/eden/amazon/ec2/networkinterface.php index d81df65..19eacca 100644 --- a/library/eden/amazon/ec2/networkinterface.php +++ b/library/eden/amazon/ec2/networkinterface.php @@ -51,7 +51,7 @@ public function attachNetworkInterface($networkInterfaceId, $instanceId, $device $this->_query['InstanceId'] = $instanceId; $this->_query['DeviceIndex'] = $deviceIndex; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -67,7 +67,7 @@ public function detachNetworkInterface($attachmentId) { $this->_query['Action'] = 'DetachNetworkInterface'; $this->_query['AttachmentId'] = $attachmentId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -83,7 +83,7 @@ public function createNetworkInterface($subnetId) { $this->_query['Action'] = 'CreateNetworkInterface'; $this->_query['SubnetId'] = $subnetId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -99,7 +99,7 @@ public function deleteNetworkInterface($networkInterfaceId) { $this->_query['Action'] = 'DeleteNetworkInterface'; $this->_query['NetworkInterfaceId'] = $networkInterfaceId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -115,7 +115,7 @@ public function describeNetworkInterfaces($networkInterfaceId) { $this->_query['Action'] = 'DescribeNetworkInterfaces'; $this->_query['NetworkInterfaceId'] = $networkInterfaceId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -136,7 +136,7 @@ public function describeNetworkInterfaceAttribute($networkInterfaceId, $attribut $this->_query['NetworkInterfaceId'] = $networkInterfaceId; $this->_query['Attribute'] = $attribute; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -157,7 +157,7 @@ public function resetNetworkInterfaceAttribute($networkInterfaceId, $attribute) $this->_query['NetworkInterfaceId'] = $networkInterfaceId; $this->_query['Attribute'] = $attribute; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -227,7 +227,7 @@ public function setPrimaryPrivateIpAddress($primaryPrivateIpAddress) { /** * The number of secondary private IP addresses to assign to a network interface. * When you specify a number of secondary IP addresses, AWS automatically assigns - * these IP addresses within the subnet’s range. + * these IP addresses within the subnet�s range. * * @param integer * @return array diff --git a/library/eden/amazon/ec2/placementgroups.php b/library/eden/amazon/ec2/placementgroups.php index ff83c1a..fce7ba1 100644 --- a/library/eden/amazon/ec2/placementgroups.php +++ b/library/eden/amazon/ec2/placementgroups.php @@ -49,7 +49,7 @@ public function createPlacementGroup($groupName, $strategy) { $this->_query['GroupName'] = $groupName; $this->_query['Strategy'] = $strategy; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -66,7 +66,7 @@ public function deletePlacementGroup($groupName) { $this->_query['Action'] = 'DeletePlacementGroup'; $this->_query['GroupName'] = $groupName; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -78,7 +78,7 @@ public function describePlacementGroups() { $this->_query['Action'] = 'DescribePlacementGroups'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** diff --git a/library/eden/amazon/ec2/reservedinstances.php b/library/eden/amazon/ec2/reservedinstances.php index 8bc3c80..432e817 100644 --- a/library/eden/amazon/ec2/reservedinstances.php +++ b/library/eden/amazon/ec2/reservedinstances.php @@ -40,7 +40,7 @@ public function DescribeReservedInstances() { $this->_query['Action'] = 'DescribeReservedInstances'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -52,7 +52,7 @@ public function describeReservedInstancesOfferings() { $this->_query['Action'] = 'DescribeReservedInstancesOfferings'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -68,7 +68,7 @@ public function purchaseReservedInstancesOffering($reservedInstancesOfferingId) $this->_query['Action'] = 'PurchaseReservedInstancesOffering'; $this->_query['ReservedInstancesOfferingId'] = $reservedInstancesOfferingId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** diff --git a/library/eden/amazon/ec2/routetables.php b/library/eden/amazon/ec2/routetables.php index b40c057..761dbe7 100644 --- a/library/eden/amazon/ec2/routetables.php +++ b/library/eden/amazon/ec2/routetables.php @@ -49,7 +49,7 @@ public function associateRouteTable($routeTableId, $subnetId) { $this->_query['RouteTableId'] = $routeTableId; $this->_query['SubnetId'] = $subnetId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -70,7 +70,7 @@ public function createRoute($routeTableId, $destinationCidrBlock) { $this->_query['RouteTableId'] = $routeTableId; $this->_query['DestinationCidrBlock'] = $destinationCidrBlock; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -87,7 +87,7 @@ public function createRouteTable($vpcId) { $this->_query['Action'] = 'CreateRouteTable'; $this->_query['VpcId'] = $vpcId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -107,7 +107,7 @@ public function deleteRoute($routeTableId, $destinationCidrBlock) { $this->_query['RouteTableId'] = $routeTableId; $this->_query['DestinationCidrBlock'] = $destinationCidrBlock; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -124,7 +124,7 @@ public function deleteRouteTable($routeTableId) { $this->_query['Action'] = 'DeleteRouteTable'; $this->_query['RouteTableId'] = $routeTableId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -136,7 +136,7 @@ public function describeRouteTables() { $this->_query['Action'] = 'DescribeRouteTables'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -153,7 +153,7 @@ public function disassociateRouteTable($associationId) { $this->_query['Action'] = 'DisassociateRouteTable'; $this->_query['AssociationId'] = $associationId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } @@ -176,7 +176,7 @@ public function replaceRoute($routeTableId, $destinationCidrBlock) { $this->_query['RouteTableId'] = $routeTableId; $this->_query['DestinationCidrBlock'] = $destinationCidrBlock; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -197,7 +197,7 @@ public function replaceRouteTableAssociation($routeTableId, $associationId) { $this->_query['RouteTableId'] = $routeTableId; $this->_query['AssociationId'] = $associationId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** diff --git a/library/eden/amazon/ec2/securitygroups.php b/library/eden/amazon/ec2/securitygroups.php index d367f03..645e281 100644 --- a/library/eden/amazon/ec2/securitygroups.php +++ b/library/eden/amazon/ec2/securitygroups.php @@ -46,7 +46,7 @@ public function authorizeSecurityGroupEgress($groupId) { $this->_query['Action'] = 'AuthorizeSecurityGroupEgress'; $this->_query['GroupId'] = $groupId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -68,7 +68,7 @@ public function createSecurityGroup($groupId) { $this->_query['GroupName'] = $groupName; $this->_query['GroupDescription'] = $groupDescription; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -92,7 +92,7 @@ public function deleteSecurityGroup($securityGroup) { $this->_query['Action'] = 'DeleteSecurityGroup'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -104,7 +104,7 @@ public function describeSecurityGroups() { $this->_query['Action'] = 'DescribeSecurityGroups'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -120,7 +120,7 @@ public function revokeSecurityGroupEgress($groupId) { $this->_query['Action'] = 'RevokeSecurityGroupEgress'; $this->_query['GroupId'] = $groupId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** diff --git a/library/eden/amazon/ec2/spotinstances.php b/library/eden/amazon/ec2/spotinstances.php index 38ae17a..1d3f8d2 100644 --- a/library/eden/amazon/ec2/spotinstances.php +++ b/library/eden/amazon/ec2/spotinstances.php @@ -43,7 +43,7 @@ public function cancelSpotInstanceRequests() { $this->_query['Action'] = 'CancelSpotInstanceRequests'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -60,7 +60,7 @@ public function createSpotDatafeedSubscription($bucket) { $this->_query['Action'] = 'CreateSpotDatafeedSubscription'; $this->_query['Bucket'] = $bucket; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -72,7 +72,7 @@ public function deleteSpotDatafeedSubscription() { $this->_query['Action'] = 'DeleteSpotDatafeedSubscription'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -87,7 +87,7 @@ public function describeSpotInstanceRequests() { $this->_query['Action'] = 'DescribeSpotInstanceRequests'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -102,7 +102,7 @@ public function describeSpotPriceHistory() { $this->_query['Action'] = 'DescribeSpotPriceHistory'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** diff --git a/library/eden/amazon/ec2/subnets.php b/library/eden/amazon/ec2/subnets.php index 61aef12..2caf377 100644 --- a/library/eden/amazon/ec2/subnets.php +++ b/library/eden/amazon/ec2/subnets.php @@ -48,7 +48,7 @@ public function createSubnet($vpcId, $cidrBlock) { $this->_query['VpcId'] = $vpcId; $this->_query['CidrBlock'] = $cidrBlock; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -65,7 +65,7 @@ public function deleteSubnet($subnetId) { $this->_query['Action'] = 'DeleteSubnet'; $this->_query['SubnetId'] = $subnetId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -78,7 +78,7 @@ public function describeSubnets() { $this->_query['Action'] = 'DescribeSubnets'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** diff --git a/library/eden/amazon/ec2/tags.php b/library/eden/amazon/ec2/tags.php index c3b340d..43c7871 100644 --- a/library/eden/amazon/ec2/tags.php +++ b/library/eden/amazon/ec2/tags.php @@ -40,7 +40,7 @@ public function createTags() { $this->_query['Action'] = 'CreateTags'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -55,7 +55,7 @@ public function deleteTags() { $this->_query['Action'] = 'DeleteTags'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -67,7 +67,7 @@ public function describeTags() { $this->_query['Action'] = 'DescribeTags'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** diff --git a/library/eden/amazon/ec2/virtualprivategateways.php b/library/eden/amazon/ec2/virtualprivategateways.php index 3f83f47..9ea8099 100644 --- a/library/eden/amazon/ec2/virtualprivategateways.php +++ b/library/eden/amazon/ec2/virtualprivategateways.php @@ -48,7 +48,7 @@ public function attachVpnGateway($vpnGatewayId, $vpcId) { $this->_query['VpnGatewayId'] = $vpnGatewayId; $this->_query['VpcId'] = $vpcId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -65,7 +65,7 @@ public function createVpnGateway($type) { $this->_query['Action'] = 'CreateVpnGateway'; $this->_query['Type'] = $type; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -85,7 +85,7 @@ public function deleteVpnGateway($vpnGatewayId) { $this->_query['Action'] = 'DeleteVpnGateway'; $this->_query['VpnGatewayId'] = $vpnGatewayId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -97,7 +97,7 @@ public function describeVpnGateways($vpnGatewayId) { $this->_query['Action'] = 'DescribeVpnGateways'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -117,7 +117,7 @@ public function detachVpnGateway($vpnGatewayId, $vpcId) { $this->_query['VpnGatewayId'] = $vpnGatewayId; $this->_query['VpcId'] = $vpcId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** diff --git a/library/eden/amazon/ec2/vmexport.php b/library/eden/amazon/ec2/vmexport.php index 43e890a..c0c84e4 100644 --- a/library/eden/amazon/ec2/vmexport.php +++ b/library/eden/amazon/ec2/vmexport.php @@ -46,7 +46,7 @@ public function cancelExportTask($exportTaskId) { $this->_query['Action'] = 'CancelExportTask'; $this->_query['ExportTaskId'] = $exportTaskId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -70,7 +70,7 @@ public function createInstanceExportTask($instanceId, $targetEnvironment, $s3Buc $this->_query['TargetEnvironment'] = $targetEnvironment; $this->_query['ExportToS3.S3Bucket'] = $s3Bucket; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -83,7 +83,7 @@ public function describeExportTasks() { $this->_query['Action'] = 'DescribeExportTasks'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -134,7 +134,7 @@ public function setContainerFormat($containerFormat) { /** * The image is written to a single object in the Amazon S3 bucket at the - * S3 key s3prefix + exportTaskId + ‘.’ +diskImageFormat. + * S3 key s3prefix + exportTaskId + �.� +diskImageFormat. * * @param string * @return array diff --git a/library/eden/amazon/ec2/vmimport.php b/library/eden/amazon/ec2/vmimport.php index 874380f..4e2d003 100644 --- a/library/eden/amazon/ec2/vmimport.php +++ b/library/eden/amazon/ec2/vmimport.php @@ -47,7 +47,7 @@ public function cancelConversionTask($conversionTaskId) { $this->_query['Action'] = 'CancelConversionTask'; $this->_query['ConversionTaskId'] = $conversionTaskId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -59,7 +59,7 @@ public function describeConversionTasks() { $this->_query['Action'] = 'DescribeConversionTasks'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -90,7 +90,7 @@ public function importVolume($conversionTaskId) { $this->_query['Image.ImportManifestUrl'] = $importManifestUrl; $this->_query['Volume.Size'] = $size; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** diff --git a/library/eden/amazon/ec2/vpc.php b/library/eden/amazon/ec2/vpc.php index 909dba5..51d8040 100644 --- a/library/eden/amazon/ec2/vpc.php +++ b/library/eden/amazon/ec2/vpc.php @@ -48,7 +48,7 @@ public function createVpc($cidrBlock, $instanceTenancy = NULL) { $this->_query['CidrBlock'] = $cidrBlock; $this->_query['instanceTenancy'] = $instanceTenancy; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -65,7 +65,7 @@ public function deleteVpc($vpcId) { $this->_query['Action'] = 'DeleteVpc'; $this->_query['VpcId'] = $vpcId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -77,7 +77,7 @@ public function describeVpcs() { $this->_query['Action'] = 'DescribeVpcs'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** diff --git a/library/eden/amazon/ec2/vpnconnections.php b/library/eden/amazon/ec2/vpnconnections.php index 5b4825b..5d24bbf 100644 --- a/library/eden/amazon/ec2/vpnconnections.php +++ b/library/eden/amazon/ec2/vpnconnections.php @@ -52,7 +52,7 @@ public function createVpnConnection($type, $customerGatewayId, $vpnGatewayId) { $this->_query['CustomerGatewayId'] = $customerGatewayId; $this->_query['VpnGatewayId'] = $vpnGatewayId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -68,7 +68,7 @@ public function deleteVpnConnection($vpnConnectionId) { $this->_query['Action'] = 'DeleteVpnConnection'; $this->_query['VpnConnectionId'] = $vpnConnectionId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -80,7 +80,7 @@ public function describeVpnConnections() { $this->_query['Action'] = 'DescribeVpnConnections'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** diff --git a/library/eden/amazon/ec2/windows.php b/library/eden/amazon/ec2/windows.php index b1274e5..202ce71 100644 --- a/library/eden/amazon/ec2/windows.php +++ b/library/eden/amazon/ec2/windows.php @@ -58,7 +58,7 @@ public function bundleInstance($instancesId, $bucket, $prefix, $uploadPolicy, $s $this->_query['Storage.S3.UploadPolicySignature'] = $signature; $this->_query['Storage.S3.AWSAccessKeyId'] = $this->_accessKey; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -74,7 +74,7 @@ public function cancelBundleTask($bundleId) { $this->_query['Action'] = 'CancelBundleTask'; $this->_query['BundleId'] = $bundleId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -86,7 +86,7 @@ public function describeBundleTasks() { $this->_query['Action'] = 'DescribeBundleTasks'; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** @@ -102,7 +102,7 @@ public function getPasswordData($instanceId) { $this->_query['Action'] = 'GetPasswordData'; $this->_query['InstanceId'] = $instanceId; - return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query); + return $this->_getResponse(self::getRegion(), $this->_query); } /** From dd4b515b2bd9f533ab9c9bea34e0568dd3f28253 Mon Sep 17 00:00:00 2001 From: geusebio Date: Fri, 18 Jan 2013 03:05:02 +0000 Subject: [PATCH 05/13] Removing a troublesome space --- library/eden/amazon/ec2/ami.php | 1 - 1 file changed, 1 deletion(-) diff --git a/library/eden/amazon/ec2/ami.php b/library/eden/amazon/ec2/ami.php index 6b79606..8750854 100644 --- a/library/eden/amazon/ec2/ami.php +++ b/library/eden/amazon/ec2/ami.php @@ -1,4 +1,3 @@ - /* * This file is part of the Eden package. From 34fdfad9daf99e6de4c03be98dabb68c005a2f07 Mon Sep 17 00:00:00 2001 From: Alex Gaspar Date: Thu, 28 Feb 2013 00:38:04 +0100 Subject: [PATCH 06/13] modified: oauth.php --- library/eden/twitter/oauth.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/eden/twitter/oauth.php b/library/eden/twitter/oauth.php index 3fa1531..9a76799 100644 --- a/library/eden/twitter/oauth.php +++ b/library/eden/twitter/oauth.php @@ -20,7 +20,8 @@ class Eden_Twitter_Oauth extends Eden_Class { const REQUEST_URL = 'https://api.twitter.com/oauth/request_token'; const AUTHORIZE_URL = 'https://api.twitter.com/oauth/authorize'; const ACCESS_URL = 'https://api.twitter.com/oauth/access_token'; - + const AUTHENTICATE_URL = 'https://api.twitter.com/oauth/authenticate'; + /* Public Properties -------------------------------*/ /* Protected Properties @@ -120,4 +121,4 @@ public function getRequestToken() { -------------------------------*/ /* Private Methods -------------------------------*/ -} \ No newline at end of file +} From 89920782ae51cf6b94f75a59a6d2a222de26d4b9 Mon Sep 17 00:00:00 2001 From: Matthew Baggett Date: Sat, 23 Mar 2013 00:47:55 +0000 Subject: [PATCH 07/13] Adding eclipse ignores --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5b1c645 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.project +.buildpath +.settings \ No newline at end of file From f9fad754197427aa9845ff27fbc60d8e14e12743 Mon Sep 17 00:00:00 2001 From: Matteo Magni Date: Fri, 9 Aug 2013 10:57:35 +0200 Subject: [PATCH 08/13] improvement - Foursquare venue class added method getVenue by id Signed-off-by: Matteo Magni --- library/eden/foursquare/venue.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/library/eden/foursquare/venue.php b/library/eden/foursquare/venue.php index 1a47937..2f7a7c7 100644 --- a/library/eden/foursquare/venue.php +++ b/library/eden/foursquare/venue.php @@ -352,6 +352,18 @@ public function addVenue($venueName, $latitude, $longtitude) { return $this->_post(self::URL_VENUE_ADD, $this->_query); } + /** + * Returns details of venue. + * + * @param string The venue id for which venue are being requested. + * @return array + */ + public function getVenue($venueId) { + //argument test + Eden_Foursquare_Error::i()->argument(1, 'string'); + return $this->_getResponse(sprintf(self::URL_VENUE, $venueId)); + } + /** * Returns a hierarchical list of categories applied to venues. * From 07a221d653b93598e0b0a5152e955cfc51b82500 Mon Sep 17 00:00:00 2001 From: Matteo Magni Date: Wed, 14 Aug 2013 15:19:41 +0200 Subject: [PATCH 09/13] Added the ability to enter a list of categoryId in foursquare venue search Signed-off-by: Matteo Magni --- library/eden/foursquare/venue.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/library/eden/foursquare/venue.php b/library/eden/foursquare/venue.php index 1a47937..07055fb 100644 --- a/library/eden/foursquare/venue.php +++ b/library/eden/foursquare/venue.php @@ -379,17 +379,22 @@ public function getManagedVenues() { * @param string|null Required unless longtitude and latitude is provided * @param string|integer|float|null Required unless near is provided * @param string|integer|float|null Required unless near is provided + * @param array|null List of categories id * @return array */ - public function search($near = NULL, $latitude = NULL, $longtitude = NULL) { + public function search($near = NULL, $latitude = NULL, $longtitude = NULL, $categories = NULL) { //argument test Eden_Foursquare_Error::i() ->argument(1, 'string', 'null') //argument 1 must be a string or null ->argument(2, 'string', 'int', 'float', 'null') //argument 2 must be a string, integer, float or null - ->argument(3, 'string', 'int', 'float', 'null'); //argument 3 must be a string, integer, float or null + ->argument(3, 'string', 'int', 'float', 'null') //argument 3 must be a string, integer, float or null + ->argument(4, 'array', 'null'); //argument 3 must be an array or null $this->_query['near'] = $near; $this->_query['ll'] = $latitude.','.$longtitude; + if(is_array($categories)) { + $this->_query['categoryId'] = implode(',', $categories); + } return $this->_getResponse(self::URL_VENUE_SEARCH, $this->_query); } From 7c0ef9c6a0462b3444699c7878033c58fdb40d64 Mon Sep 17 00:00:00 2001 From: runfan Date: Thu, 15 Aug 2013 11:14:21 +0800 Subject: [PATCH 10/13] Update post.php there is a error --- library/eden/authorizenet/block/post.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/library/eden/authorizenet/block/post.php b/library/eden/authorizenet/block/post.php index 9fa9fe0..885af86 100644 --- a/library/eden/authorizenet/block/post.php +++ b/library/eden/authorizenet/block/post.php @@ -45,17 +45,17 @@ class Eden_Authorizenet_Block_Post extends Eden_Block { protected $_state = NULL; protected $_zip = NULL; protected $_country = NULL; - protected $_cardNumberLabel = self::CARD_NUMBER, - protected $_expirationLabel = self::EXPIRATION, - protected $_cvvLabel = self::CVV, - protected $_firstNameLabel = self::FIRST_NAME, - protected $_lastNameLabel = self::LAST_NAME, - protected $_addressLabel = self::ADDRESS, - protected $_cityLabel = self::CITY, - protected $_stateLabel = self::STATE, - protected $_zipLabel = self::ZIP, - protected $_countryLabel = self::COUNTRY, - protected $_submitButton = self::SUBMIT, + protected $_cardNumberLabel = self::CARD_NUMBER; + protected $_expirationLabel = self::EXPIRATION; + protected $_cvvLabel = self::CVV;, + protected $_firstNameLabel = self::FIRST_NAME; + protected $_lastNameLabel = self::LAST_NAME; + protected $_addressLabel = self::ADDRESS; + protected $_cityLabel = self::CITY; + protected $_stateLabel = self::STATE; + protected $_zipLabel = self::ZIP; + protected $_countryLabel = self::COUNTRY; + protected $_submitButton = self::SUBMIT; /* Private Properties -------------------------------*/ @@ -427,4 +427,4 @@ public function setZipLabel($zipLabel) { -------------------------------*/ /* Private Methods -------------------------------*/ -} \ No newline at end of file +} From 265901f17fce41f787aa82a37549290140478f8c Mon Sep 17 00:00:00 2001 From: runfan Date: Thu, 15 Aug 2013 11:15:02 +0800 Subject: [PATCH 11/13] Update groups.php --- library/eden/zendesk/groups.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/eden/zendesk/groups.php b/library/eden/zendesk/groups.php index d24a3fd..daf50f0 100644 --- a/library/eden/zendesk/groups.php +++ b/library/eden/zendesk/groups.php @@ -116,10 +116,10 @@ public function setName($name) { $this->_query['group']['name'] = $name; return $this; - }1 + } /* Protected Methods -------------------------------*/ /* Private Methods -------------------------------*/ -} \ No newline at end of file +} From 792ef8d1b8f8fc35facf58fd94c480758634bc7a Mon Sep 17 00:00:00 2001 From: Christophe Date: Fri, 16 Aug 2013 14:03:42 +0200 Subject: [PATCH 12/13] Fix bug parameter must be a int --- library/eden/twitter/search.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/library/eden/twitter/search.php b/library/eden/twitter/search.php index 2b3f39e..44c358a 100644 --- a/library/eden/twitter/search.php +++ b/library/eden/twitter/search.php @@ -172,8 +172,7 @@ public function setPopularResultType() { */ public function setRpp($rpp) { //Argument 1 must be a string - Eden_Twitter_Error::i()->argument(1, 'string'); - + Eden_Twitter_Error::i()->argument(1, 'int'); //if it is greater than 100 if($rpp > 100) { //set it to 100 From 7aaa901b7eb231a1306a174e2b3d07771688d9ae Mon Sep 17 00:00:00 2001 From: Christophe Date: Fri, 16 Aug 2013 14:08:00 +0200 Subject: [PATCH 13/13] API fix rpp is deprecated (twitter) rpp become count API version 1.1 --- library/eden/twitter/search.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/library/eden/twitter/search.php b/library/eden/twitter/search.php index 44c358a..70f152a 100644 --- a/library/eden/twitter/search.php +++ b/library/eden/twitter/search.php @@ -170,17 +170,18 @@ public function setPopularResultType() { * @param int * @return this */ - public function setRpp($rpp) { + public function setCount($count) { //Argument 1 must be a string Eden_Twitter_Error::i()->argument(1, 'int'); + //if it is greater than 100 - if($rpp > 100) { + if($count > 100) { //set it to 100 - $rpp = 100; + $count = 100; } - - $this->_query['rpp'] = $rpp; - + + $this->_query['count'] = $count; + return $this; }