Code Monkey home page Code Monkey logo

pintlabs_service_untappd's Introduction

PHP library to interact with the public Untappd API version 4, patterned
after other service libraries in Zend Framework.

Information on the API can be found on Untappd's website.
http://untappd.com/api/dashboard

A client ID and client secret is required.  An access token is required for
certain method calls, such as myFriendFeed.  Contact Untappd to attain your
credentials.

This library also contains 2 helper methods to generate the correct authenticate
URI for OAuth2 authentication, as well as a method to exchange a "code" from your
redirect URI for an access token.  Examples are below.

==============================================

Installation:

Using composer:

Add the repository to your composer.json file

    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/PintLabs/Pintlabs_Service_Untappd.git"
        }
    ],

Add the library to your requirements list:

    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.2.*",
        "fabpot/goutte": "^3.1",
        "PintLabs/Pintlabs_Service_Untappd": "*@dev"
    },

Add the Untappd dir to your autoload list:

    "autoload": {
        "classmap": [
            "vendor/Pintlabs/Pintlabs_Service_Untappd/library/Pintlabs/Service/"
        ],
    }


Run `composer update`

==============================================

Usage:

<?php

// Setup Untappd
$config = array(
    'clientId'     => $clientId,
    'clientSecret' => $clientSecret,
    'accessToken'  => $accessToken,
    'redirectUri'  => $redirectUri,
);

$untappd = new Pintlabs_Service_Untappd($config);


// Example 1:  Basic method call
try {
    $result = $untappd->myFriendFeed();
} catch (Pintlabs_Service_Untappd_Exception $e) {
    die($e->getMessage());
}


// Example 2:  Redirecting to Untappd OAuth2 authentication URI
header('Location: ' . $untappd->authenticateUri());


// Example 3:  Exchanging code argument for access token
$accessToken = $untappd->getAccessToken($_GET['code']);

pintlabs_service_untappd's People

Contributors

farrelley avatar gplocke avatar gregavola avatar jarlskov avatar jeroenlammerts avatar jfaustin avatar mvogelgesang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pintlabs_service_untappd's Issues

breweryFeed function arguments

The "since" and "offset" arguments are not valid for the /brewery/checkins api call. The proper arguments are "min_id" and "max_id" respectively.

Untappd Service Error 500: The authenticated user has reached their API limit for the hour. Please wait before making another call.

Hi,

Is there a way to cache requests? I'm using this on the footer of my website and got stuck really quickly with this error. Not good at caching json data like this, so could you give me a hint what to do?

What should I do to this part of the code to not requesting on every refresh? I've tried something with php functions apc_store and apc_fetch but they won't work.

$untappd = new Pintlabs_Service_Untappd($config);

try {
$feed = $untappd->userFeed($username = 'rolle', '1', '');
} catch (Exception $e) {
die($e->getMessage());
';
}

foreach ($feed->response->checkins->items as $i) {

foreach ($i->media->items as $media) {
if(isset($media->photo->photo_img_md)) {
echo $media->photo->photo_img_md;
} else {
echo 'fallback.jpg';
}

echo '

'.$i->beer->beer_name.'

';
echo '

'.$i->beer->beer_style.'

';
}

Composer autoload issue

Hi,

I've encountered an issue with the include paths under a composer install:

Autoload tries:
vendor/Pintlabs/Pintlabs_Service_Untappd/library/Pintlabs/Service

Whereas the file is actually:
vendor/PintLabs/Pintlabs_Service_Untappd/library/Pintlabs/Service

Note the highly subtle Pintlabs vs PintLabs immediately after 'vendor'.

Is this an easy fix?

Thanks

Incorrect params for Venue Activity Feed

The docs specify the following:

max_id (int, optional) - The checkin ID that you want the results to start with
min_id (int, optional) - Returns only checkins that are newer than this value
limit (int, optional) - The number of results to return, max of 25, default is 25

While the code passes along:

    $args = array(
        'since'    => $since,
        'offset'   => $offset,
        'limit'    => $limit,
    );

Issue with arguments sent to service

First off, awesome little library, made my work much quicker thanks!

I did run into an issue when running methods which sent parameters to the service. add_to_wish and remove_from_wish are the only ones I've tested so far that required the bid param be sent as POST. It seems Untappd requires only the api key be in the querystring and the rest need to be sent as POST.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.