Added Photos on tumblr example api

This commit is contained in:
Sahat Yalkabov
2013-12-08 00:35:35 -05:00
parent 36048fe2f5
commit ced190e0af
3 changed files with 17 additions and 8 deletions

View File

@ -86,10 +86,11 @@ exports.getTumblr = function(req, res) {
token_secret: token.tokenSecret token_secret: token.tokenSecret
}); });
client.blogInfo('sahat.tumblr.com', function(err, data) { client.posts('goddess-of-imaginary-light.tumblr.com', { type: 'photo' }, function(err, data) {
res.render('api/tumblr', { res.render('api/tumblr', {
title: 'Tumblr API', title: 'Tumblr API',
blog: data.blog.title, blog: data.blog,
photos: _.flatten(_.pluck(data.posts, 'photos')),
user: req.user user: req.user
}); });
}); });
@ -160,7 +161,7 @@ exports.getGithub = function(req, res) {
} }
// TODO: Fix rate limit on passport-github token // TODO: Fix rate limit on passport-github token
var github = new Github({ token: token.token }); var github = new Github({ token: token.token });
var repo = github.getRepo('sahat', 'cloudbucket'); var repo = github.getRepo('sahat', 'requirejs-library');
repo.show(function(err, repo) { repo.show(function(err, repo) {
res.render('api/github', { res.render('api/github', {
title: 'GitHub API', title: 'GitHub API',

View File

@ -28,7 +28,7 @@ block content
a(href='#{repo.html_url}') #{repo.name} a(href='#{repo.html_url}') #{repo.name}
.btn.btn-sm.btn-primary-outline .btn.btn-sm.btn-primary-outline
i.fa.fa-eye-slash i.fa.fa-eye-slash
| Watchers: #{repo.watchers_count} | Subscribers: #{repo.subscribers_count}
.btn.btn-sm.btn-primary-outline .btn.btn-sm.btn-primary-outline
i.fa.fa-star i.fa.fa-star
| Starred: #{repo.stargazers_count} | Starred: #{repo.stargazers_count}
@ -38,6 +38,6 @@ block content
.btn.btn-sm.btn-primary-outline .btn.btn-sm.btn-primary-outline
i.fa.fa-code i.fa.fa-code
| #{repo.language} | #{repo.language}
.well br
strong DESCRIPTION strong DESCRIPTION
p= repo.description p= repo.description

View File

@ -16,4 +16,12 @@ block content
i.fa.fa-code-fork i.fa.fa-code-fork
| API Endpoints | API Endpoints
h2= blog h3.text-primary #{blog.name}'s blog
strong Blog Stats
p
.btn.btn-xs.btn-primary-outline
i.fa.fa-file-text-o
| #{blog.posts} posts
for photo in photos
img(src='#{photo.alt_sizes.slice(-3)[0].url}')