This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var assets = new Chute.API.Assets(null, { album: 'ALBUM_SHORTCUT' }); | |
// To fetch assets from an album | |
assets.fetch({ | |
success: function(models) { // every model is an instance of Chute.Data.Model-based Chute.Models.Asset | |
// success | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var comments = new Chute.API.Comments({ album: 'ALBUM_SHORTCUT', asset: 'ASSET_SHORTCUT' }); | |
comments.fetch({ success: function(){ | |
_(comments.models).forEach(function(comment){ | |
// comment is an instance of Chute.API.Comment | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var comments = new Chute.API.Comments({ album: 'ALBUM_SHORTCUT', asset: 'ASSET_SHORTCUT' }); | |
comments.create({ | |
comment_text: 'This is a new comment', | |
email: '[email protected]', | |
name: 'Jack' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var comment = new Chute.API.Comment({ | |
comment_text: 'This is a new comment', | |
email: '[email protected]', | |
name: 'Jack' | |
}); | |
comment.save(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ "data" : { "created_at" : "2012-11-14T18:51:46Z", | |
"description" : null, | |
"id" : 2317900, | |
"links" : { "assets" : { "href" : "http://api.getchute.com/v2/albums/2317900/assets", | |
"title" : "Asset Listing" | |
}, | |
"parcels" : { "href" : "http://api.getchute.com/v2/albums/2317900/parcels", | |
"title" : "Parcel Listing" | |
}, | |
"self" : { "href" : "http://api.getchute.com/v2/albums/2317900", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ "data" : [ { "account" : { "avatar" : "http://a0.twimg.com/profile_images/3120757463/2c66a5b068c69409fcd8838d9c7aaedd_normal.jpeg", | |
"created_at" : "2013-01-23T01:45:35Z", | |
"id" : 23024887, | |
"name" : "FGIAtlanta", | |
"updated_at" : "2013-01-23T01:45:35Z", | |
"username" : "FGIATL" | |
}, | |
"caption" : "Great new members! #fashion #2013 http://t.co/2XjQSciI", | |
"chute_asset_id" : "313932282", | |
"created_at" : "2013-01-23T00:07:20Z", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ "data" : { "account" : { "avatar" : "http://a0.twimg.com/profile_images/3120757463/2c66a5b068c69409fcd8838d9c7aaedd_normal.jpeg", | |
"created_at" : "2013-01-23T01:45:35Z", | |
"id" : 23024887, | |
"name" : "FGIAtlanta", | |
"updated_at" : "2013-01-23T01:45:35Z", | |
"username" : "FGIATL" | |
}, | |
"caption" : "Great new members! #fashion #2013 http://t.co/2XjQSciI", | |
"chute_asset_id" : "313932282", | |
"created_at" : "2013-01-23T00:07:20Z", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = new Chute.API.Assets({ album: 'ALBUM_SHORTCUT', asset: 'ASSET_SHORTCUT' }).toData(); | |
data.on('before:load', function(){ | |
// Started loading | |
}); | |
data.on('load', function(){ | |
// Finished loading | |
var assets = data.items(); // alias to extract() method | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = new Chute.API.Assets({ album: 'ALBUM_SHORTCUT', asset: 'ASSET_SHORTCUT' }).toData({ page: 1, perPage: 15 }); | |
data.on('load', function(){ | |
// Finished loading | |
var assets = data.items(); | |
}); | |
data.load(); | |
// Switching to the next page |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var PopularAssetsFilter = Chute.Data.Filter.extend({ | |
initialize: function(data) { | |
this.data = data; // saving reference to Chute.Data object | |
this.filter(); | |
}, | |
filter: function() { | |
var assets = this.data; | |
var popularAssets = _.filter(assets, function(asset){ |