Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add flickr support … gem install:

flickraw

I find this to be *extremely* slow. Hopefully I can speed it up a bit in the future.
  • Loading branch information...
commit 81a8a38a7b6b4d2c7efb2ab5c7fb4f34eb15da19 1 parent aaddf89
@JamesChevalier authored
View
1  Gemfile
@@ -12,6 +12,7 @@ end
gem 'rails_autolink'
gem 'feedzirra'
+gem 'flickraw'
gem 'foursquare2'
gem 'instagram'
gem 'jquery-rails'
View
2  Gemfile.lock
@@ -62,6 +62,7 @@ GEM
rake (>= 0.9.2)
rdoc (~> 3.8)
sax-machine (~> 0.0.20)
+ flickraw (0.9.6)
foursquare2 (1.9.1)
faraday (~> 0.8)
faraday_middleware (>= 0.8)
@@ -189,6 +190,7 @@ DEPENDENCIES
coffee-rails (~> 3.2.1)
compass-rails
feedzirra
+ flickraw
foursquare2
instagram
jquery-rails
View
16 README.md
@@ -8,6 +8,7 @@ Compatible Services
* Blog (via RSS)
* Delicious
+* Flickr
* Foursquare
* GitHub
* Google Analytics
@@ -45,6 +46,21 @@ How To Get It Going
The sections below describe how to enable each individual service. Some of the steps in each section might duplicate steps you completed in the `Complete initial configuration`, above. If you aren't enabling one of them, just skip that section.
+#### Flickr
+* Register your application at [http://www.flickr.com/services/apps/create/apply/](http://www.flickr.com/services/apps/create/apply/)
+ * Set the Name of your app to "Little-Corner" (or something similar, if they require unique names)
+ * Enter a description for your app, or copy this: "I'm setting up Little Corner. https://github.com/JamesChevalier/Little-Corner Little Corner is a website that is used to pull your entire web presence into one place. It runs on Ruby on Rails, doesn't use a database, and is Heroku-ready."
+* You can get your User ID through [http://idgettr.com/](http://idgettr.com/)
+* Edit the `/config/environment.rb` file:
+ * Set the value for `ENABLE_FLICKR` to true
+ * Set the value for `FLICKR_API_KEY`
+ * Set the value for `FLICKR_API_SECRET`
+ * Set the value for `FLICKR_USER_ID` to your user ID
+ * Set the value for `FLICKR_USER_NAME` to your user name
+* Commit your changes with `git add .; git commit -m "Configure Flickr"`
+* Deploy Little-Corner to Heroku with `git push heroku master`
+
+
#### Foursquare
* Register your application at https://foursquare.com/developers/apps
View
10 app/controllers/flickr_controller.rb
@@ -0,0 +1,10 @@
+class FlickrController < ApplicationController
+
+ def index
+ FlickRaw.api_key = FLICKR_API_KEY
+ FlickRaw.shared_secret = FLICKR_API_SECRET
+
+ @flickr_photos = flickr.people.getPublicPhotos(:user_id => FLICKR_USER_ID, :per_page => 20)
+ end
+
+end
View
2  app/helpers/flickr_helper.rb
@@ -0,0 +1,2 @@
+module FlickrHelper
+end
View
25 app/views/flickr/index.html.erb
@@ -0,0 +1,25 @@
+<div class="row">
+
+ <%= render "shared/menu" %>
+
+ <div class="nine mobile-four columns">
+ <div class="panel">
+ <h1 style="text-align:center;">Flickr</h1>
+
+ <h3>Recent Photos</h3>
+ <p style="text-align:center;">
+ <% @flickr_photos.each do |f| %>
+ <% info = flickr.photos.getInfo :photo_id => f.id, :secret => f.secret %>
+ <% sizes = flickr.photos.getSizes :photo_id => f.id %>
+
+ <%= link_to image_tag(sizes.find {|s| s.label == 'Small'}.source, :border=>0, :title => info.title), sizes.find {|s| s.label == 'Medium 640' }.source, :rel => "lightbox", :title => "#{info.title}" %>
+
+ <% end %>
+ </p>
+
+ <h6><a href="http://www.flickr.com/photos/<%= FLICKR_USER_NAME %>" target="_blank"><%= YOUR_NAME %> @ Flickr</a></h6>
+
+ </div>
+ </div>
+
+</div>
View
1  app/views/shared/_menu.html.erb
@@ -10,6 +10,7 @@
<%= raw ENABLE_DELICIOUS == true ? "#{params[:controller] == 'delicious' ? "<li class=\"active\">" : "<li>"}<a href=\"/delicious\">Delicious</a></li>" : "" %>
<%= raw ENABLE_FOURSQUARE == true ? "#{params[:controller] == 'foursquare' ? "<li class=\"active\">" : "<li>"}<a href=\"/foursquare\">Foursquare</a></li>" : "" %>
<%= raw ENABLE_GITHUB == true ? "#{params[:controller] == 'github' ? "<li class=\"active\">" : "<li>"}<a href=\"/github\">GitHub</a></li>" : "" %>
+ <%= raw ENABLE_FLICKR == true ? "#{params[:controller] == 'flickr' ? "<li class=\"active\">" : "<li>"}<a href=\"/flickr\">Flickr</a></li>" : "" %>
<%= raw ENABLE_INSTAGRAM == true ? "#{params[:controller] == 'instagram' ? "<li class=\"active\">" : "<li>"}<a href=\"/instagram\">Instagram</a></li>" : "" %>
<%= raw ENABLE_LAST_FM == true ? "#{params[:controller] == 'lastfm' ? "<li class=\"active\">" : "<li>"}<a href=\"/lastfm\">Last.FM</a></li>" : "" %>
<%= raw ENABLE_PROJECTS == true ? "#{params[:controller] == 'projects' ? "<li class=\"active\">" : "<li>"}<a href=\"/projects\">Projects</a></li>" : "" %>
View
7 config/environment.rb
@@ -29,6 +29,13 @@
ENABLE_DELICIOUS = false
DELICIOUS_USER_NAME = ""
+# Flickr Config
+ENABLE_FLICKR = false
+FLICKR_API_KEY = ""
+FLICKR_API_SECRET = ""
+FLICKR_USER_ID = ""
+FLICKR_USER_NAME = ""
+
# Foursquare Config
ENABLE_FOURSQUARE = false
FOURSQUARE_CLIENT_ID = ""
View
1  config/routes.rb
@@ -4,6 +4,7 @@
match "blog" => "blog#index"
match "delicious" => "delicious#index"
match "contact" => "contact#index"
+ match "flickr" => "flickr#index"
match "foursquare" => "foursquare#index"
match "foursquare/callback"
match "foursquare/connect"
View
7 test/functional/flickr_controller_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class FlickrControllerTest < ActionController::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
View
4 test/unit/helpers/flickr_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class FlickrHelperTest < ActionView::TestCase
+end
Please sign in to comment.
Something went wrong with that request. Please try again.