Permalink
Browse files

Added github_integration feature (untested).

  • Loading branch information...
1 parent 1019fee commit c2e5ff1d2674d68b0e79074dc3341ab10649f007 @patcon committed Aug 24, 2012
View
@@ -5,6 +5,7 @@ defaults[projects][subdir] = contrib
projects[connector][version] = 1.0-beta1
projects[ctools][version] = 1.2
+projects[features][version] = 1.0
projects[http_client][version] = 2.4
projects[oauth][version] = 3.0
projects[oauthconnector][version] = 1.0-beta1
View
@@ -4,3 +4,8 @@ version = VERSION
core = 7.x
dependencies[] = block
dependencies[] = dblog
+
+dependencies[] = oauthconnector_github
+
+; FEATURES
+dependencies[] = github_integration
@@ -0,0 +1,56 @@
+<?php
+/**
+ * @file
+ * github_integration..inc
+ */
+
+/**
+ * Implements hook_default_oauthconnector_provider().
+ */
+function github_integration_default_oauthconnector_provider() {
+ $export = array();
+
+ $provider = new stdClass();
+ $provider->disabled = FALSE; /* Edit this to true to make a default provider disabled initially */
+ $provider->name = 'github';
+ $provider->title = 'GitHub';
+ $provider->url = 'https://api.github.com';
+ $provider->consumer_advanced = array(
+ 'oauth2' => 1,
+ 'signature method' => 'HMAC-SHA1',
+ 'authentication realm' => '',
+ 'request token endpoint' => '/oauth/request_token',
+ 'authorization scope' => 'user,public_repo',
+ 'authorization endpoint' => 'https://github.com/login/oauth/authorize',
+ 'access token endpoint' => 'https://github.com/login/oauth/access_token',
+ );
+ $provider->mapping = array(
+ 'fields' => array(
+ 'uid' => array(
+ 'resource' => 'https://api.github.com/user',
+ 'method post' => 0,
+ 'field' => 'id',
+ 'querypath' => FALSE,
+ 'sync_with_field' => '',
+ ),
+ 'name' => array(
+ 'resource' => 'https://api.github.com/user',
+ 'method post' => 0,
+ 'field' => 'name',
+ 'querypath' => FALSE,
+ 'sync_with_field' => '',
+ ),
+ 'avatar' => array(
+ 'resource' => 'https://api.github.com/user',
+ 'method post' => 0,
+ 'field' => 'avatar_url',
+ 'querypath' => FALSE,
+ 'sync_with_field' => 'picture',
+ ),
+ ),
+ 'format' => 'json',
+ );
+ $export['github'] = $provider;
+
+ return $export;
+}
@@ -0,0 +1,15 @@
+<?php
+/**
+ * @file
+ * github_integration.features.inc
+ */
+
+/**
+ * Implements hook_ctools_plugin_api().
+ */
+function github_integration_ctools_plugin_api() {
+ list($module, $api) = func_get_args();
+ if ($module == "oauthconnector" && $api == "") {
+ return array("version" => "");
+ }
+}
@@ -0,0 +1,8 @@
+name = Github Integration
+core = 7.x
+package = Features
+dependencies[] = ctools
+dependencies[] = oauthconnector
+features[ctools][] = oauthconnector::
+features[features_api][] = api:1
+features[oauthconnector_provider][] = github
@@ -0,0 +1,7 @@
+<?php
+/**
+ * @file
+ * Code for the Github Integration feature.
+ */
+
+include_once 'github_integration.features.inc';

0 comments on commit c2e5ff1

Please sign in to comment.