Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modification for twitter #26

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a1596c3
Sorting out scopes for userinfo and latitude
matthewbaggett Jan 8, 2013
bd9d80a
Adding reverse geolocation support, making address & sensor optional
matthewbaggett Jan 8, 2013
5aab123
Geocoding support - sensor is mandatory
matthewbaggett Jan 8, 2013
e3fd17a
I have changed how it finds which ec2 endpoint it is seeking.
matthewbaggett Jan 18, 2013
dd4b515
Removing a troublesome space
matthewbaggett Jan 18, 2013
34fdfad
modified: oauth.php
AlexGaspar Feb 27, 2013
8992078
Adding eclipse ignores
matthewbaggett Mar 23, 2013
f9fad75
improvement - Foursquare venue class added method getVenue by id
ilbonzo Aug 9, 2013
07a221d
Added the ability to enter a list of categoryId in foursquare venue s…
ilbonzo Aug 14, 2013
933f246
Merge branch 'improvement/foursquare-search-venue-categoryid' into ro…
ilbonzo Aug 14, 2013
7c0ef9c
Update post.php
runfan Aug 15, 2013
265901f
Update groups.php
runfan Aug 15, 2013
792ef8d
Fix bug parameter must be a int
Aug 16, 2013
7aaa901
API fix rpp is deprecated (twitter)
Aug 16, 2013
46fdaf5
Merge remote-tracking branch 'gweber/bugfix/mail-remove' into kaen25
Sep 19, 2013
a7a59c1
Merge remote-tracking branch 'Openovate/master' into kaen25
Sep 19, 2013
1d61411
Merge remote-tracking branch 'runfan/patch-1' into kaen25
Sep 19, 2013
cfc5fc2
Merge remote-tracking branch 'runfan/master' into kaen25
Sep 19, 2013
48ce353
Merge remote-tracking branch 'ilbonzo/roundtown' into kaen25
Sep 19, 2013
c5430dc
Merge remote-tracking branch 'matthewbaggett/master' into kaen25
Sep 19, 2013
db49ad8
Merge remote-tracking branch 'BaNzounet/master' into kaen25
Sep 19, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.project
.buildpath
.settings
4 changes: 2 additions & 2 deletions library/eden/amazon.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

/**
Expand Down
13 changes: 6 additions & 7 deletions library/eden/amazon/ec2/ami.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<?php //-->
/*
* This file is part of the Eden package.
Expand Down Expand Up @@ -49,7 +48,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);

}

Expand All @@ -72,7 +71,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);
}

/**
Expand All @@ -88,7 +87,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);
}

/**
Expand Down Expand Up @@ -118,7 +117,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);
}

/**
Expand All @@ -133,7 +132,7 @@ public function describeImages() {

$this->_query['Action'] = 'DescribeImages';

return $this->_getResponse(self::AMAZON_EC2_HOST, $this->_query);
return $this->_getResponse(self::getRegion(), $this->_query);
}

/**
Expand All @@ -149,7 +148,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);
}

/**
Expand Down
70 changes: 66 additions & 4 deletions library/eden/amazon/ec2/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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
-------------------------------*/
Expand All @@ -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.
*
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions library/eden/amazon/ec2/customergateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}

Expand All @@ -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);

}

Expand All @@ -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);

}

Expand Down
2 changes: 1 addition & 1 deletion library/eden/amazon/ec2/devpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions library/eden/amazon/ec2/dhcp.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}

Expand All @@ -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);

}

Expand All @@ -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);
}

/**
Expand Down
30 changes: 15 additions & 15 deletions library/eden/amazon/ec2/elasticbookstore.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}

Expand All @@ -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);

}

Expand All @@ -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);

}

Expand All @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand Down Expand Up @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand Down
Loading