Skip to content

Instantly share code, notes, and snippets.

View kiall's full-sized avatar

Kiall Mac Innes kiall

  • Microsoft
  • Dublin, Ireland
View GitHub Profile
<?php defined('SYSPATH') or die('No direct script access.');
/**
*
* @package API
* @category Library
* @author Managed I.T.
* @copyright (c) 2011 Managed I.T.
* @license https://github.com/managedit/kohana-api/blob/master/LICENSE.md
*/
#!/usr/bin/env ruby
require 'rubygems'
require 'oauth2'
require 'pp'
client = OAuth2::Client.new('test', 'test', :site => 'http://localhost/', :authorize_url => 'http://localhost/oauth2/authorize', :token_url => 'http://localhost/oauth2/token')
puts client.auth_code.authorize_url(:redirect_uri => 'http://localhost/')
puts "And the code is?"
@kiall
kiall / gist:1168513
Created August 24, 2011 16:49
Nasty -_-
<?php
$this->_response_links += array(
'create' => $this->_generate_link('POST', Route::url('api', array(
'controller' => $this->request->controller(),
'id' => NULL,
))),
'read' => $this->_generate_link('GET', Route::url('api', array(
'controller' => $this->request->controller(),
'id' => $this->request->param('id'),
@kiall
kiall / example.php
Created August 24, 2011 21:04 — forked from zeelot/example.php
Possible minion options definition
<?php
// 1 Property
class Minion_Task_Example extends Minion_Task {
protected $_options = array(
'force' => array(
'default' => NULL,
// Defaults to --{{key}} (--force in this case)
'alternate_names' => array('-f'),
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Test2 {
public function action_index()
{
// State can be used to bring the user back to where they originally were before the redirect..
$state = json_decode($this->request->query('state'));
// Load up the right consumer
$client = OAuth2_Consumer::factory('mip');
<?php
class ORM extends Kohana_ORM {
public function create(Validation $validation = NULL)
{
$this->_pre_create();
$return = parent::create($validation);
<?php defined('SYSPATH') or die('No direct script access.');
/**
*
*
* @package OAuth2
* @category Library
* @author Managed I.T.
* @copyright (c) 2011 Managed I.T.
* @license https://github.com/managedit/kohana-oauth2/blob/master/LICENSE.md
*/
.
./oauth2
./oauth2/provider.php
./oauth2/exception.php
./oauth2/exception
./oauth2/exception/invalidgrant.php
./oauth2/exception/insufficientscope.php
./oauth2/exception/invalidclient.php
./oauth2/exception/unsupportedgranttype.php
./oauth2/exception/invalidrequest.php
{
"metadata":{
"error":false,
"total":3,
"fetched":3,
"offset":0,
"limit":25,
"type":"job"
},
"actions":{
<?php defined('SYSPATH') or die('No direct script access.');
/**
*
*
* @package MIP Website
* @category Controller
* @author Managed I.T.
* @copyright (c) 2011 Managed I.T.
*/
class Controller_Test extends Controller {