Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit df9128a
Showing
307 changed files
with
11,621 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.loadpath | ||
.project | ||
config/database.yml | ||
log/*.log |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
BASE DATA | ||
----------------------------------- | ||
A simple Rails web app that eases the access to Google Base Data API as well as allows saving data. | ||
This application can be used to collect and store information about products, jobs, houses, etc. | ||
|
||
|
||
Data Feeds | ||
========== | ||
- Snippets Feed: The snippets feed is available to anyone without a need for authentication. The snippets feed provides access to all content in Google Base, but may return items with a shortened description. Snippets feed entries do not include private attributes. | ||
- Items Feed (next in line): The items feed contains a customer-specific subset of Google Base data. The items feed requires authentication. | ||
- Media Feed (for the future): The media feeds differ from the other Google Base feeds in that there is one media feed defined per Google Base item (rather than one global feed, as with the other feeds.) Each item's media feed manages binary attachments for that item. | ||
|
||
Metadata Feeds | ||
============== | ||
- Itemtypes Feed: The itemtypes feed contains a complete description of Google Base structures and allows you to query for different types of metadata. It provides a list of attributes associated with each of the Google Base item types. | ||
- Attributes Feed: The attibutes feed provides statistics about how an item type has been used and lists what values have been used frequently for its attributes. This feed can also show you how others have defined the item in existing entries. This information can be very helpful as you define new items to upload. | ||
- Locales Feed: The locales feed defines the permitted locales for Google Base. The locale value identifies the language, currency, and date formats used in a feed. | ||
|
||
Notes | ||
===== | ||
- Built for Ruby 1.8.7 and Rails 2.3.5 | ||
- Requires simple-rss |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Add your own tasks in files placed in lib/tasks ending in .rake, | ||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | ||
|
||
require(File.join(File.dirname(__FILE__), 'config', 'boot')) | ||
|
||
require 'rake' | ||
require 'rake/testtask' | ||
require 'rake/rdoctask' | ||
|
||
require 'tasks/rails' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
class AccountsController < ApplicationController | ||
|
||
# GET /accounts | ||
# GET /accounts.xml | ||
def index | ||
end | ||
|
||
# GET /accounts/1 | ||
# GET /accounts/1.xml | ||
def show | ||
@account = Account.find(params[:id]) | ||
@products = Product.find(:all, :conditions => {:account_id => @account.id}) | ||
|
||
respond_to do |format| | ||
format.html # show.html.erb | ||
format.xml { render :xml => @account } | ||
end | ||
end | ||
|
||
# GET /accounts/new | ||
# GET /accounts/new.xml | ||
def new | ||
@account = Account.new | ||
|
||
respond_to do |format| | ||
format.html # new.html.erb | ||
format.xml { render :xml => @account } | ||
end | ||
end | ||
|
||
# POST /accounts | ||
# POST /accounts.xml | ||
def create | ||
@account = Account.new(params[:account]) | ||
@account.password = Digest::SHA1.hexdigest(@account.password) | ||
confirm_password = Digest::SHA1.hexdigest(@account.confirm_password) | ||
|
||
@account.phone.gsub(/[^0-9]/, '') | ||
|
||
respond_to do |format| | ||
if @account.save && confirm_password == @account.password | ||
@user = User.new | ||
@user.name = "#{@account.first_name} #{@account.last_name}" | ||
@user.email = @account.email | ||
@user.password = @account.password | ||
@user.autosave = 0 | ||
@user.role = 'owner' | ||
@user.account_id = @account.id | ||
@user.save | ||
|
||
session[:user] = @user | ||
flash[:notice] = "Account was successfully created." | ||
|
||
format.html { redirect_to(:controller => "dashboard", :action => "index") } | ||
format.xml { render :xml => @account, :status => :created, :location => @account } | ||
else | ||
@account.password = nil | ||
|
||
flash[:error] = "Account could not be created. Please make sure all fields are filled out." | ||
format.html { render :action => "new" } | ||
format.xml { render :xml => @account.errors, :status => :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# GET /accounts/1/edit | ||
def edit | ||
@account = Account.find(params[:id]) | ||
end | ||
|
||
# PUT /accounts/1 | ||
# PUT /accounts/1.xml | ||
def update | ||
@account = Account.find(params[:id]) | ||
|
||
respond_to do |format| | ||
if @account.update_attributes(params[:account]) | ||
@activity = Activity.new | ||
@activity.user_id = session[:user].id | ||
@activity.account_id = @account.id | ||
@activity.action_taken = "updated account" | ||
@activity.save | ||
|
||
flash[:notice] = "Account #{@account.name} was successfully updated." | ||
format.html { redirect_to(:action=>:show, :id => @account) } | ||
format.xml { head :ok } | ||
else | ||
format.html { render :action => "edit" } | ||
format.xml { render :xml => @account.errors, :status => :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /accounts/1 | ||
# DELETE /accounts/1.xml | ||
def destroy | ||
@account = Account.find(params[:id]) | ||
@account.destroy | ||
|
||
@activity = Activity.new | ||
@activity.user_id = session[:user].id | ||
@activity.account_id = params[:id] | ||
@activity.action_taken = "deleted account" | ||
@activity.save | ||
|
||
respond_to do |format| | ||
format.html { redirect_to(accounts_url) } | ||
format.xml { head :ok } | ||
end | ||
end | ||
|
||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class ApplicationController < ActionController::Base | ||
helper :all # include all helpers, all the time | ||
#protect_from_forgery :secret => '8c3e099237e6366fd2f5366e9c430e79' | ||
|
||
require 'simple-rss' | ||
require 'open-uri' | ||
require 'net/http' | ||
require 'rubygems' | ||
require 'xmlsimple' | ||
|
||
# Scrub sensitive parameters from your log | ||
# filter_parameter_logging :password | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
class CollectionsController < ApplicationController | ||
|
||
# GET /collections | ||
# GET /collections.xml | ||
def index | ||
end | ||
|
||
# GET /collections/1 | ||
# GET /collections/1.xml | ||
def show | ||
@collection = Collection.find(params[:id]) | ||
@products = Product.find(:all, :conditions => {:collection_id => @collection.id}) | ||
|
||
@columns = Product.column_names | ||
@columns.delete("id") | ||
@columns.delete("upc") | ||
@columns.delete("ean") | ||
@columns.delete("model_number") | ||
@columns.delete("product_type") | ||
@columns.delete("url") | ||
@columns.delete("image_url") | ||
@columns.delete("country") | ||
@columns.delete("expiration") | ||
@columns.delete("collection_id") | ||
@columns.delete("created_at") | ||
@columns.delete("updated_at") | ||
|
||
respond_to do |format| | ||
format.html # show.html.erb | ||
format.xml { render :xml => @collection } | ||
end | ||
end | ||
|
||
# GET /collections/new | ||
# GET /collections/new.xml | ||
def new | ||
@collection = Collection.new | ||
|
||
respond_to do |format| | ||
format.html # new.html.erb | ||
format.xml { render :xml => @collection } | ||
end | ||
end | ||
|
||
# POST /collections | ||
# POST /collections.xml | ||
def create | ||
@collection = Collection.new(params[:collection]) | ||
@collection.user_id = session[:user].id | ||
@collection.account_id = session[:user].account_id | ||
|
||
respond_to do |format| | ||
if @collection.save | ||
@activity = Activity.new | ||
@activity.user_id = session[:user].id | ||
@activity.collection_id = @collection.id | ||
@activity.account_id = session[:user].account_id | ||
@activity.user_name = session[:user].name | ||
@activity.collection_name = @collection.name | ||
@activity.action_taken = "created collection" | ||
@activity.save | ||
|
||
flash[:notice] = "Collection #{@collection.name} was successfully created." | ||
format.html { redirect_to(:controller => "dashboard", :action => "index") } | ||
format.xml { render :xml => @collection, :status => :created, :location => @collection } | ||
else | ||
format.html { render :action => "new" } | ||
format.xml { render :xml => @collection.errors, :status => :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# GET /collections/1/edit | ||
def edit | ||
@collection = Collection.find(params[:id]) | ||
end | ||
|
||
# PUT /collections/1 | ||
# PUT /collections/1.xml | ||
def update | ||
@collection = Collection.find(params[:id]) | ||
|
||
respond_to do |format| | ||
if @collection.update_attributes(params[:collection]) | ||
@activity = Activity.new | ||
@activity.user_id = session[:user].id | ||
@activity.collection_id = @collection.id | ||
@activity.account_id = session[:user].account_id | ||
@activity.user_name = session[:user].name | ||
@activity.collection_name = @collection.name | ||
@activity.action_taken = "updated collection" | ||
@activity.save | ||
|
||
flash[:notice] = "Collection #{@collection.name} was successfully updated." | ||
format.html { redirect_to(:action=>:show, :id => @collection) } | ||
format.xml { head :ok } | ||
else | ||
format.html { render :action => "edit" } | ||
format.xml { render :xml => @collection.errors, :status => :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /collections/1 | ||
# DELETE /collections/1.xml | ||
def destroy | ||
@collection = Collection.find(params[:id]) | ||
|
||
Product.delete_all(:collection_id => @collection.id) | ||
|
||
@activity = Activity.new | ||
@activity.user_id = session[:user].id | ||
@activity.collection_id = @collection.id | ||
@activity.account_id = session[:user].account_id | ||
@activity.user_name = session[:user].name | ||
@activity.collection_name = @collection.name | ||
@activity.action_taken = "deleted collection" | ||
@activity.save | ||
|
||
@collection.destroy | ||
|
||
respond_to do |format| | ||
format.html { redirect_to(:controller => "dashboard", :action => "index") } | ||
format.xml { head :ok } | ||
end | ||
end | ||
|
||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class DashboardController < ApplicationController | ||
|
||
def welcome | ||
@user = User.new | ||
end | ||
|
||
def index | ||
@collections = Collection.find(:all, :conditions => {:account_id => session[:user].account_id}, :order => "created_at DESC") | ||
@activities = Activity.paginate(:all, :conditions => {:account_id => session[:user].account_id}, :limit => 9, :order => "created_at DESC", :page => params[:page]) | ||
end | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
class FeaturesController < ApplicationController | ||
def index | ||
end | ||
|
||
def data_collection | ||
end | ||
|
||
def data_mining | ||
end | ||
|
||
def trending | ||
end | ||
|
||
def seo | ||
end | ||
|
||
def ui | ||
end | ||
|
||
def use_cases | ||
end | ||
|
||
def support_and_api | ||
end | ||
|
||
def signup | ||
end | ||
|
||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
class ProductController < ApplicationController | ||
|
||
def index | ||
@collection_id = params[:collection_id] | ||
@query = params[:query].gsub('Results for ', '').gsub(/["\n\t]/, '') | ||
@mpn = params[:mpn] | ||
@price = params[:price].gsub(/[^\d\.]/, '') | ||
@currency = params[:price].gsub(/[^a-zA-Z]/, '') | ||
@seller = params[:seller] | ||
@condition = params[:condition] | ||
@brand = params[:brand] | ||
@upc = params[:upc] | ||
@ean = params[:ean] | ||
@model_number = params[:model_number] | ||
@type = params[:type] | ||
@url = params[:url] | ||
@image_url = params[:image_url] | ||
@country = params[:country] | ||
@expiration = params[:expiration] | ||
|
||
@product = Product.new | ||
@product.collection_id = @collection_id | ||
@product.mpn = @mpn | ||
@product.price = @price | ||
@product.currency = @currency | ||
@product.seller = @seller | ||
@product.condition = @condition | ||
@product.brand = @brand | ||
@product.upc = @upc | ||
@product.ean = @ean | ||
@product.model_number = @model_number | ||
@product.product_type = @type | ||
@product.url = @url | ||
@product.image_url = @image_url | ||
@product.country = @country | ||
@product.expiration = @expiration | ||
@product.save | ||
|
||
render :nothing => true | ||
end | ||
|
||
end |
Oops, something went wrong.