mirror of
https://github.com/apigy/selfstarter.git
synced 2026-01-09 14:27:55 -05:00
Merge branch 'rails4'
This commit is contained in:
9
Gemfile
9
Gemfile
@@ -1,8 +1,8 @@
|
|||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
ruby '1.9.3'
|
ruby '2.0.0'
|
||||||
|
|
||||||
gem 'rails', '3.2.13'
|
gem 'rails', '4.0.0'
|
||||||
gem 'json', '~> 1.7.7'
|
gem 'json', '~> 1.7.7'
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
@@ -18,8 +18,8 @@ end
|
|||||||
# Gems used only for assets and not required
|
# Gems used only for assets and not required
|
||||||
# in production environments by default.
|
# in production environments by default.
|
||||||
group :assets do
|
group :assets do
|
||||||
gem 'sass-rails', '~> 3.2.3'
|
gem 'sass-rails', '~> 4.0.0'
|
||||||
gem 'coffee-rails', '~> 3.2.1'
|
gem 'coffee-rails', '~> 4.0.0'
|
||||||
gem 'uglifier', '>= 1.0.3'
|
gem 'uglifier', '>= 1.0.3'
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -30,6 +30,7 @@ end
|
|||||||
|
|
||||||
# jQuery
|
# jQuery
|
||||||
gem 'jquery-rails'
|
gem 'jquery-rails'
|
||||||
|
gem 'jquery-ui-rails'
|
||||||
|
|
||||||
# Kickstarter's awesome Amazon Flexible Payments gem
|
# Kickstarter's awesome Amazon Flexible Payments gem
|
||||||
gem 'amazon_flex_pay'
|
gem 'amazon_flex_pay'
|
||||||
|
|||||||
211
Gemfile.lock
211
Gemfile.lock
@@ -1,151 +1,141 @@
|
|||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
actionmailer (3.2.13)
|
actionmailer (4.0.0)
|
||||||
actionpack (= 3.2.13)
|
actionpack (= 4.0.0)
|
||||||
mail (~> 2.4.4)
|
mail (~> 2.5.3)
|
||||||
actionpack (3.2.13)
|
actionpack (4.0.0)
|
||||||
activemodel (= 3.2.13)
|
activesupport (= 4.0.0)
|
||||||
activesupport (= 3.2.13)
|
builder (~> 3.1.0)
|
||||||
builder (~> 3.0.0)
|
|
||||||
erubis (~> 2.7.0)
|
erubis (~> 2.7.0)
|
||||||
journey (~> 1.0.4)
|
rack (~> 1.5.2)
|
||||||
rack (~> 1.4.5)
|
rack-test (~> 0.6.2)
|
||||||
rack-cache (~> 1.2)
|
activemodel (4.0.0)
|
||||||
rack-test (~> 0.6.1)
|
activesupport (= 4.0.0)
|
||||||
sprockets (~> 2.2.1)
|
builder (~> 3.1.0)
|
||||||
activemodel (3.2.13)
|
activerecord (4.0.0)
|
||||||
activesupport (= 3.2.13)
|
activemodel (= 4.0.0)
|
||||||
builder (~> 3.0.0)
|
activerecord-deprecated_finders (~> 1.0.2)
|
||||||
activerecord (3.2.13)
|
activesupport (= 4.0.0)
|
||||||
activemodel (= 3.2.13)
|
arel (~> 4.0.0)
|
||||||
activesupport (= 3.2.13)
|
activerecord-deprecated_finders (1.0.3)
|
||||||
arel (~> 3.0.2)
|
activesupport (4.0.0)
|
||||||
tzinfo (~> 0.3.29)
|
i18n (~> 0.6, >= 0.6.4)
|
||||||
activeresource (3.2.13)
|
minitest (~> 4.2)
|
||||||
activemodel (= 3.2.13)
|
multi_json (~> 1.3)
|
||||||
activesupport (= 3.2.13)
|
thread_safe (~> 0.1)
|
||||||
activesupport (3.2.13)
|
tzinfo (~> 0.3.37)
|
||||||
i18n (= 0.6.1)
|
|
||||||
multi_json (~> 1.0)
|
|
||||||
amazon_flex_pay (0.10.0)
|
amazon_flex_pay (0.10.0)
|
||||||
activesupport (>= 3.0.14)
|
activesupport (>= 3.0.14)
|
||||||
multi_xml (>= 0.5.2)
|
multi_xml (>= 0.5.2)
|
||||||
rest-client (~> 1.6.1)
|
rest-client (~> 1.6.1)
|
||||||
arel (3.0.2)
|
arel (4.0.1)
|
||||||
bourne (1.1.2)
|
atomic (1.1.14)
|
||||||
mocha (= 0.10.5)
|
builder (3.1.4)
|
||||||
builder (3.0.4)
|
coderay (1.1.0)
|
||||||
coderay (1.0.8)
|
coffee-rails (4.0.1)
|
||||||
coffee-rails (3.2.2)
|
|
||||||
coffee-script (>= 2.2.0)
|
coffee-script (>= 2.2.0)
|
||||||
railties (~> 3.2.0)
|
railties (>= 4.0.0, < 5.0)
|
||||||
coffee-script (2.2.0)
|
coffee-script (2.2.0)
|
||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.4.0)
|
coffee-script-source (1.6.3)
|
||||||
daemons (1.1.9)
|
daemons (1.1.9)
|
||||||
diff-lcs (1.1.3)
|
diff-lcs (1.2.5)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
eventmachine (1.0.0)
|
eventmachine (1.0.3)
|
||||||
execjs (1.4.0)
|
execjs (2.0.2)
|
||||||
multi_json (~> 1.0)
|
hike (1.2.3)
|
||||||
hike (1.2.1)
|
i18n (0.6.5)
|
||||||
i18n (0.6.1)
|
jquery-rails (3.0.4)
|
||||||
journey (1.0.4)
|
|
||||||
jquery-rails (2.1.4)
|
|
||||||
railties (>= 3.0, < 5.0)
|
railties (>= 3.0, < 5.0)
|
||||||
thor (>= 0.14, < 2.0)
|
thor (>= 0.14, < 2.0)
|
||||||
|
jquery-ui-rails (4.1.0)
|
||||||
|
railties (>= 3.1.0)
|
||||||
json (1.7.7)
|
json (1.7.7)
|
||||||
mail (2.4.4)
|
mail (2.5.4)
|
||||||
i18n (>= 0.4.0)
|
|
||||||
mime-types (~> 1.16)
|
mime-types (~> 1.16)
|
||||||
treetop (~> 1.4.8)
|
treetop (~> 1.4.8)
|
||||||
metaclass (0.0.1)
|
method_source (0.8.2)
|
||||||
method_source (0.8.1)
|
mime-types (1.25)
|
||||||
mime-types (1.22)
|
minitest (4.7.5)
|
||||||
mocha (0.10.5)
|
multi_json (1.8.2)
|
||||||
metaclass (~> 0.0.1)
|
multi_xml (0.5.5)
|
||||||
multi_json (1.7.2)
|
pg (0.17.0)
|
||||||
multi_xml (0.5.3)
|
|
||||||
pg (0.14.1)
|
|
||||||
polyglot (0.3.3)
|
polyglot (0.3.3)
|
||||||
pry (0.9.10)
|
pry (0.9.12.3)
|
||||||
coderay (~> 1.0.5)
|
coderay (~> 1.0)
|
||||||
method_source (~> 0.8)
|
method_source (~> 0.8)
|
||||||
slop (~> 3.3.1)
|
slop (~> 3.4)
|
||||||
pry-rails (0.2.2)
|
pry-rails (0.3.2)
|
||||||
pry (>= 0.9.10)
|
pry (>= 0.9.10)
|
||||||
rack (1.4.5)
|
rack (1.5.2)
|
||||||
rack-cache (1.2)
|
|
||||||
rack (>= 0.4)
|
|
||||||
rack-ssl (1.3.3)
|
|
||||||
rack
|
|
||||||
rack-test (0.6.2)
|
rack-test (0.6.2)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
rails (3.2.13)
|
rails (4.0.0)
|
||||||
actionmailer (= 3.2.13)
|
actionmailer (= 4.0.0)
|
||||||
actionpack (= 3.2.13)
|
actionpack (= 4.0.0)
|
||||||
activerecord (= 3.2.13)
|
activerecord (= 4.0.0)
|
||||||
activeresource (= 3.2.13)
|
activesupport (= 4.0.0)
|
||||||
activesupport (= 3.2.13)
|
bundler (>= 1.3.0, < 2.0)
|
||||||
bundler (~> 1.0)
|
railties (= 4.0.0)
|
||||||
railties (= 3.2.13)
|
sprockets-rails (~> 2.0.0)
|
||||||
rails_config (0.3.2)
|
rails_config (0.3.3)
|
||||||
activesupport (>= 3.0)
|
activesupport (>= 3.0)
|
||||||
railties (3.2.13)
|
railties (4.0.0)
|
||||||
actionpack (= 3.2.13)
|
actionpack (= 4.0.0)
|
||||||
activesupport (= 3.2.13)
|
activesupport (= 4.0.0)
|
||||||
rack-ssl (~> 1.3.2)
|
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
rdoc (~> 3.4)
|
thor (>= 0.18.1, < 2.0)
|
||||||
thor (>= 0.14.6, < 2.0)
|
rake (10.1.0)
|
||||||
rake (10.0.3)
|
|
||||||
rdoc (3.12)
|
|
||||||
json (~> 1.4)
|
|
||||||
rest-client (1.6.7)
|
rest-client (1.6.7)
|
||||||
mime-types (>= 1.16)
|
mime-types (>= 1.16)
|
||||||
rspec-core (2.12.2)
|
rspec-core (2.14.7)
|
||||||
rspec-expectations (2.12.1)
|
rspec-expectations (2.14.4)
|
||||||
diff-lcs (~> 1.1.3)
|
diff-lcs (>= 1.1.3, < 2.0)
|
||||||
rspec-mocks (2.12.1)
|
rspec-mocks (2.14.4)
|
||||||
rspec-rails (2.12.1)
|
rspec-rails (2.14.0)
|
||||||
actionpack (>= 3.0)
|
actionpack (>= 3.0)
|
||||||
activesupport (>= 3.0)
|
activesupport (>= 3.0)
|
||||||
railties (>= 3.0)
|
railties (>= 3.0)
|
||||||
rspec-core (~> 2.12.0)
|
rspec-core (~> 2.14.0)
|
||||||
rspec-expectations (~> 2.12.0)
|
rspec-expectations (~> 2.14.0)
|
||||||
rspec-mocks (~> 2.12.0)
|
rspec-mocks (~> 2.14.0)
|
||||||
sass (3.2.5)
|
sass (3.2.12)
|
||||||
sass-rails (3.2.5)
|
sass-rails (4.0.1)
|
||||||
railties (~> 3.2.0)
|
railties (>= 4.0.0, < 5.0)
|
||||||
sass (>= 3.1.10)
|
sass (>= 3.1.10)
|
||||||
tilt (~> 1.3)
|
sprockets-rails (~> 2.0.0)
|
||||||
shoulda (3.3.2)
|
shoulda (3.5.0)
|
||||||
shoulda-context (~> 1.0.1)
|
shoulda-context (~> 1.0, >= 1.0.1)
|
||||||
shoulda-matchers (~> 1.4.1)
|
shoulda-matchers (>= 1.4.1, < 3.0)
|
||||||
shoulda-context (1.0.2)
|
shoulda-context (1.1.6)
|
||||||
shoulda-matchers (1.4.2)
|
shoulda-matchers (2.4.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
bourne (~> 1.1.2)
|
slop (3.4.7)
|
||||||
slop (3.3.3)
|
sprockets (2.10.0)
|
||||||
sprockets (2.2.2)
|
|
||||||
hike (~> 1.2)
|
hike (~> 1.2)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
rack (~> 1.0)
|
rack (~> 1.0)
|
||||||
tilt (~> 1.1, != 1.3.0)
|
tilt (~> 1.1, != 1.3.0)
|
||||||
sqlite3 (1.3.6)
|
sprockets-rails (2.0.1)
|
||||||
thin (1.5.0)
|
actionpack (>= 3.0)
|
||||||
|
activesupport (>= 3.0)
|
||||||
|
sprockets (~> 2.8)
|
||||||
|
sqlite3 (1.3.8)
|
||||||
|
thin (1.6.1)
|
||||||
daemons (>= 1.0.9)
|
daemons (>= 1.0.9)
|
||||||
eventmachine (>= 0.12.6)
|
eventmachine (>= 1.0.0)
|
||||||
rack (>= 1.0.0)
|
rack (>= 1.0.0)
|
||||||
thor (0.16.0)
|
thor (0.18.1)
|
||||||
tilt (1.3.3)
|
thread_safe (0.1.3)
|
||||||
treetop (1.4.12)
|
atomic
|
||||||
|
tilt (1.4.1)
|
||||||
|
treetop (1.4.15)
|
||||||
polyglot
|
polyglot
|
||||||
polyglot (>= 0.3.1)
|
polyglot (>= 0.3.1)
|
||||||
tzinfo (0.3.35)
|
tzinfo (0.3.38)
|
||||||
uglifier (1.3.0)
|
uglifier (2.2.1)
|
||||||
execjs (>= 0.3.0)
|
execjs (>= 0.3.0)
|
||||||
multi_json (~> 1.0, >= 1.0.2)
|
multi_json (~> 1.0, >= 1.0.2)
|
||||||
|
|
||||||
@@ -154,15 +144,16 @@ PLATFORMS
|
|||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
amazon_flex_pay
|
amazon_flex_pay
|
||||||
coffee-rails (~> 3.2.1)
|
coffee-rails (~> 4.0.0)
|
||||||
jquery-rails
|
jquery-rails
|
||||||
|
jquery-ui-rails
|
||||||
json (~> 1.7.7)
|
json (~> 1.7.7)
|
||||||
pg
|
pg
|
||||||
pry-rails
|
pry-rails
|
||||||
rails (= 3.2.13)
|
rails (= 4.0.0)
|
||||||
rails_config
|
rails_config
|
||||||
rspec-rails (~> 2.0)
|
rspec-rails (~> 2.0)
|
||||||
sass-rails (~> 3.2.3)
|
sass-rails (~> 4.0.0)
|
||||||
shoulda
|
shoulda
|
||||||
sqlite3
|
sqlite3
|
||||||
thin
|
thin
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
//= require html5shiv-printshiv
|
//= require html5shiv-printshiv
|
||||||
//= require jquery
|
//= require jquery
|
||||||
//= require jquery_ujs
|
//= require jquery_ujs
|
||||||
//= require jquery-ui
|
//= require jquery.ui.all
|
||||||
//= require jquery.details
|
//= require jquery.details
|
||||||
//= require jquery.textchange
|
//= require jquery.textchange
|
||||||
//= require preorder
|
//= require preorder
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
*= require_self
|
*= require_self
|
||||||
*= require reset
|
*= require reset
|
||||||
*= require main
|
*= require main
|
||||||
|
*= require jquery.ui.all
|
||||||
*/
|
*/
|
||||||
.hidden
|
.hidden
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class PreorderController < ApplicationController
|
class PreorderController < ApplicationController
|
||||||
skip_before_filter :verify_authenticity_token, :only => :ipn
|
skip_before_action :verify_authenticity_token, :only => :ipn
|
||||||
|
|
||||||
def index
|
def index
|
||||||
end
|
end
|
||||||
@@ -8,7 +8,7 @@ class PreorderController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def prefill
|
def prefill
|
||||||
@user = User.find_or_create_by_email!(params[:email])
|
@user = User.find_or_create_by(:email => params[:email])
|
||||||
|
|
||||||
if Settings.use_payment_options
|
if Settings.use_payment_options
|
||||||
payment_option_id = params['payment_option']
|
payment_option_id = params['payment_option']
|
||||||
@@ -46,7 +46,7 @@ class PreorderController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def share
|
def share
|
||||||
@order = Order.find_by_uuid(params[:uuid])
|
@order = Order.find_by(:uuid => params[:uuid])
|
||||||
end
|
end
|
||||||
|
|
||||||
def ipn
|
def ipn
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
class Order < ActiveRecord::Base
|
class Order < ActiveRecord::Base
|
||||||
attr_accessible :address_one, :address_two, :city, :country, :number, :state, :status, :token, :transaction_id, :zip,
|
|
||||||
:shipping, :tracking_number, :name, :price, :phone, :expiration, :payment_option
|
|
||||||
attr_readonly :uuid
|
|
||||||
before_validation :generate_uuid!, :on => :create
|
before_validation :generate_uuid!, :on => :create
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :payment_option
|
belongs_to :payment_option
|
||||||
scope :completed, where("token != ? OR token != ?", "", nil)
|
scope :completed, -> { where("token != ? OR token != ?", "", nil) }
|
||||||
self.primary_key = 'uuid'
|
self.primary_key = 'uuid'
|
||||||
|
|
||||||
# This is where we create our Caller Reference for Amazon Payments, and prefill some other information.
|
# This is where we create our Caller Reference for Amazon Payments, and prefill some other information.
|
||||||
@@ -23,7 +20,7 @@ class Order < ActiveRecord::Base
|
|||||||
|
|
||||||
# After authenticating with Amazon, we get the rest of the details
|
# After authenticating with Amazon, we get the rest of the details
|
||||||
def self.postfill!(options = {})
|
def self.postfill!(options = {})
|
||||||
@order = Order.find_by_uuid!(options[:callerReference])
|
@order = Order.find_by!(:uuid => options[:callerReference])
|
||||||
@order.token = options[:tokenID]
|
@order.token = options[:tokenID]
|
||||||
if @order.token.present?
|
if @order.token.present?
|
||||||
@order.address_one = options[:addressLine1]
|
@order.address_one = options[:addressLine1]
|
||||||
@@ -52,7 +49,7 @@ class Order < ActiveRecord::Base
|
|||||||
def generate_uuid!
|
def generate_uuid!
|
||||||
begin
|
begin
|
||||||
self.uuid = SecureRandom.hex(16)
|
self.uuid = SecureRandom.hex(16)
|
||||||
end while Order.find_by_uuid(self.uuid).present?
|
end while Order.find_by(:uuid => self.uuid).present?
|
||||||
end
|
end
|
||||||
|
|
||||||
# goal is a dollar amount, not a number of backers, beause you may be using the multiple payment options component
|
# goal is a dollar amount, not a number of backers, beause you may be using the multiple payment options component
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
class PaymentOption < ActiveRecord::Base
|
class PaymentOption < ActiveRecord::Base
|
||||||
attr_accessible :amount, :amount_display, :delivery_desc, :description, :limit, :shipping_desc
|
|
||||||
has_many :orders
|
has_many :orders
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
class User < ActiveRecord::Base
|
class User < ActiveRecord::Base
|
||||||
attr_accessible :email
|
|
||||||
has_many :orders
|
has_many :orders
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
Selfstarter::Application.routes.draw do
|
Selfstarter::Application.routes.draw do
|
||||||
root :to => 'preorder#index'
|
root :to => 'preorder#index'
|
||||||
match '/preorder' => 'preorder#index'
|
match '/preorder' => 'preorder#index', :via => [:get,:post]
|
||||||
get 'preorder/checkout'
|
get 'preorder/checkout'
|
||||||
match '/preorder/share/:uuid' => 'preorder#share', :via => :get
|
match '/preorder/share/:uuid' => 'preorder#share', :via => :get
|
||||||
match '/preorder/ipn' => 'preorder#ipn', :via => :post
|
match '/preorder/ipn' => 'preorder#ipn', :via => :post
|
||||||
match '/preorder/prefill' => 'preorder#prefill'
|
match '/preorder/prefill' => 'preorder#prefill', :via => [:get,:post]
|
||||||
match '/preorder/postfill' => 'preorder#postfill'
|
match '/preorder/postfill' => 'preorder#postfill', :via => [:get,:post]
|
||||||
end
|
end
|
||||||
|
|||||||
22
db/schema.rb
22
db/schema.rb
@@ -9,11 +9,11 @@
|
|||||||
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
||||||
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20130107010733) do
|
ActiveRecord::Schema.define(version: 20130107010733) do
|
||||||
|
|
||||||
create_table "orders", :id => false, :force => true do |t|
|
create_table "orders", id: false, force: true do |t|
|
||||||
t.string "token"
|
t.string "token"
|
||||||
t.string "transaction_id"
|
t.string "transaction_id"
|
||||||
t.string "address_one"
|
t.string "address_one"
|
||||||
@@ -32,26 +32,26 @@ ActiveRecord::Schema.define(:version => 20130107010733) do
|
|||||||
t.string "phone"
|
t.string "phone"
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.date "expiration"
|
t.date "expiration"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at"
|
||||||
t.integer "payment_option_id"
|
t.integer "payment_option_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "payment_options", :force => true do |t|
|
create_table "payment_options", force: true do |t|
|
||||||
t.decimal "amount"
|
t.decimal "amount"
|
||||||
t.string "amount_display"
|
t.string "amount_display"
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.string "shipping_desc"
|
t.string "shipping_desc"
|
||||||
t.string "delivery_desc"
|
t.string "delivery_desc"
|
||||||
t.integer "limit"
|
t.integer "limit"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "users", :force => true do |t|
|
create_table "users", force: true do |t|
|
||||||
t.string "email"
|
t.string "email"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user