Search code examples
coldfusionvimeocoldbox

Vimeo API using Coldfusion


I am trying to utilize a library i found on github

https://github.com/dannyrich/CFVimeoAPIWrapper

Here is my init code

        CLIENT_ID = "the id string";
        CLIENT_SECRET = "the secret string";
        ACCESS_TOKEN = "token";
        ACCESS_TOKEN_SECRET = "token secret";
        PER_PAGE = 10;
        vimeo = createObject("component", "models.vimeoService").init(CLIENT_ID, CLIENT_SECRET);
    //error occurs here
        vimeo.setToken(ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
    data = vimeo.call( "vimeo.albums.getVideos", 
  { 
    "album_id"="1682859", 
    "full_response"="Y",
    "sort"="date", 
    "page"="1", 
    "per_page"=PER_PAGE 
  }

and I am getting the following error

Variable VIMEO is undefined.

not sure why exactly I am getting this, i mean even with the compnent being created it should define the variable

i know its a stretch, but any help on this at all would be greatly appreciated


Solution

  • <cffunction name="init" access="public" returntype="void">

    No, because that particular init() function is a bit atypical, in that it returns void instead of an object. So the captured result becomes null or undefined.

    Take another look at the example on the GitHub page. It creates an instance, but does not capture the result of init():

    <cfset vimeo = createObject("component", "VimeoComponent")>
    <cfset vimeo.init(CLIENT_ID, CLIENT_SECRET)>