Skip to content
This repository has been archived by the owner on Apr 5, 2019. It is now read-only.

Integrate with Joind.in #16

Closed
JonTheNiceGuy opened this issue Jul 18, 2012 · 7 comments
Closed

Integrate with Joind.in #16

JonTheNiceGuy opened this issue Jul 18, 2012 · 7 comments

Comments

@JonTheNiceGuy
Copy link
Member

Waiting on API availability from Joind.in team.

With this integration, when talks are fixed, they will be pushed to Joind.in, and the URL for that joind.in access will be automatically added to the talk on CFM2.

@JonTheNiceGuy
Copy link
Member Author

Lorna has confirmed today that she has code in the Joind.in code (albeit not pushed to live yet) which provides the API access we require. Awaiting confirmation of methods to implement....

@JonTheNiceGuy
Copy link
Member Author

Code provided is as follows (with minor tweaks for readability):

<?php

$oAuth_URL = 'http://api.joind.in';
$oAuth_UserSecret = ''; // See the "Authentication" section of this page: https://joind.in/api/v2docs to get this in.
$event_id = '1024'; // This is the event ID from the site - e.g. https://joind.in/event/view/1024 <- OggCamp '12

// set your own data as follows
$date = new DateTime('1st December 2012 8am', new DateTimeZone('Europe/Amsterdam'));
$talk_data = array(
    'talk_title' => 'THIS IS A TALK', 
    'talk_description' => 'THIS IS THE SUMMARY',
    'start_date' => $date->format('c'),
    'speakers' => array('THIS IS THE PRESENTER NAME'),
);
$path = '/v2.1/events/' . $event_id . '/talks';

$ch = curl_init(oAuth_URL . $path);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Authorization: OAuth ' . $oAuth_UserSecret));
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($talk_data));
curl_setopt($ch, CURLOPT_HEADER, true);
$curl = curl_exec($ch);
var_dump($curl);

I'll start looking at integrating this, maybe Sunday night?

@jgbreezer
Copy link

Do we have hooks/signals for this kind of functionality and the events that
need to fire off calls to code so it can be kept as a plugin? Or is that
something that would need to be looked at later?

On 10 August 2012 14:51, Jon The Nice Guy Spriggs
notifications@github.comwrote:

Code provided is as follows (with minor tweaks for readability):

'THIS IS A TALK', 'talk_description' => 'THIS IS THE SUMMARY', 'start_date' => $date->format('c'), 'speakers' => array('THIS IS THE PRESENTER NAME'), ); $path = '/v2.1/events/' . $event_id . '/talks'; $ch = curl_init(oAuth_URL . $path); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Authorization: OAuth ' . $oAuth_UserSecret)); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($talk_data)); curl_setopt($ch, CURLOPT_HEADER, true); $curl = curl_exec($ch); var_dump($curl); I'll start looking at integrating this, maybe Sunday night? — Reply to this email directly or view it on GitHubhttps://github.com/JonTheNiceGuy/cfm2/issues/16#issuecomment-7642489.

@JonTheNiceGuy
Copy link
Member Author

Create a new class in /classes/Plugin/<somedir>/hook_loader.php (there are historic reasons for that structure) called Plugin_<somedir> with a public function called hook_talkFixed. That will be called whenever a talk is fixed.

For an example, see this file:

https://github.com/JonTheNiceGuy/cfm2/blob/master/classes/Plugin/GlueBroadcaster/hook_loader.php#L67

@JonTheNiceGuy
Copy link
Member Author

I should add, the AutoLoader will break directory structures by _'s, so avoid calling the dir anything with underscores in.

Once the plugin is created, add it to /config/plugins.php. I would suggest using the Object_SecureConfig class (see this line for an example: https://github.com/JonTheNiceGuy/cfm2/blob/master/classes/Glue/TwitterAPI.php#L92) to store and retrieve the user secret, and probably the API URL and eventID as well (although they don't need to be kept secret, it's probably a good idea to keep them all in the same place).

Depending on what the output is from the curl call, you might be able to update the talk object with the joind.in URL for that talk off the back of the request.

@JonTheNiceGuy
Copy link
Member Author

@jgbreezer Are you considering working on this? If not I'll look to get this in tonight.

@JonTheNiceGuy
Copy link
Member Author

Pull #88 resolves this request.

JonTheNiceGuy added a commit that referenced this issue Aug 14, 2012
Resolves Issue #16: "Integrate with Joind.in"
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants