mongoid_cart 0.0.1 → 0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/mongoid_cart/cart_controller.rb +31 -0
- data/app/models/mongoid_cart/cart.rb +86 -0
- data/app/models/mongoid_cart/cart_item.rb +27 -0
- data/app/models/mongoid_cart/validators/cart_item_duplicate_validator.rb +20 -0
- data/app/views/mongoid_cart/cart/show.html.erb +26 -0
- data/config/routes.rb +4 -0
- data/config/secrets.yml +22 -0
- data/lib/configuration/config_template.rb +5 -0
- data/lib/generators/initializer_generator.rb +11 -0
- data/lib/mongoid_cart.rb +21 -0
- data/lib/mongoid_cart/acts_as_customer.rb +27 -0
- data/lib/mongoid_cart/acts_as_product.rb +100 -0
- data/lib/mongoid_cart/controller.rb +13 -0
- data/lib/mongoid_cart/railtie.rb +19 -0
- data/lib/mongoid_cart/relation.rb +18 -0
- data/lib/mongoid_cart/version.rb +1 -1
- data/lib/mongoid_cart/view_helpers.rb +40 -0
- metadata +57 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ca5db1bd400ef29c2f945ec386030cc47eedda8
|
4
|
+
data.tar.gz: c8611f425925d692464f0aeb2d7ae04306ee45cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f8dd1ce578ce57bed8f83553710e434f30bdfc4969fae4ce6d269d248ed43432177bf4a74c553c9326142d627daa04f9ab2f2c2c19ff3e32ef3c62d5227eb58
|
7
|
+
data.tar.gz: 4a4220211ddc77636dc26dc4161e9ba46748c5095aa5f30be41dcee738393a67eef935a8598cced800029beb6cd094089e67e84faf800d3c6a675a6d2097c01a
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class MongoidCart::CartController < ActionController::Base
|
2
|
+
|
3
|
+
def show
|
4
|
+
@cart = MongoidCart::Cart.find(cart_id)
|
5
|
+
end
|
6
|
+
|
7
|
+
def add_item
|
8
|
+
class_name = item_params[:type]
|
9
|
+
item = class_name.constantize.find(item_params[:id])
|
10
|
+
unless item.add_to_cart.nil?
|
11
|
+
message = "Added to cart"
|
12
|
+
else
|
13
|
+
message = "Already in cart"
|
14
|
+
end
|
15
|
+
|
16
|
+
redirect_to :back, notice: message
|
17
|
+
end
|
18
|
+
|
19
|
+
def remove_item
|
20
|
+
class_name = item_params[:type]
|
21
|
+
item = class_name.constantize.find(item_params[:id])
|
22
|
+
current_cart.remove(item)
|
23
|
+
redirect_to :back
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def item_params
|
29
|
+
params.require(:item).permit([:id, :type, :amount, :unit])
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# Class for the MongoidCart
|
2
|
+
|
3
|
+
module MongoidCart
|
4
|
+
class Cart
|
5
|
+
include Mongoid::Document
|
6
|
+
|
7
|
+
field :user_id, type: String
|
8
|
+
|
9
|
+
belongs_to :customer, :inverse_of => :carts, :class_name => MongoidCart.configuration.customer_model_name
|
10
|
+
|
11
|
+
has_many :cart_items, :inverse_of => :cart, :class_name => 'MongoidCart::CartItem'
|
12
|
+
|
13
|
+
validates_with MongoidCart::Validators::CartItemDuplicateValidator
|
14
|
+
|
15
|
+
#
|
16
|
+
def net_sum
|
17
|
+
cart_items.map(&:net_sum).sum
|
18
|
+
end
|
19
|
+
|
20
|
+
# given Hash or MongoidCart::ActsAsProduct instance will be added to current_cart
|
21
|
+
# @return
|
22
|
+
def add(product_object, amount=nil, unit=nil)
|
23
|
+
product_object = (product_object)
|
24
|
+
product_object.amount = amount if amount
|
25
|
+
product_object.unit = unit if unit
|
26
|
+
|
27
|
+
cart_item_params = product_object.to_cart_item_params
|
28
|
+
existing_item = find_item(cart_item_params)
|
29
|
+
|
30
|
+
if existing_item
|
31
|
+
existing_item.inc(amount: cart_item_params[:amount])
|
32
|
+
else
|
33
|
+
cart_items.create!(cart_item_params)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def remove(product_object, amount=nil, unit=nil)
|
38
|
+
product_object = (product_object)
|
39
|
+
product_object.amount = amount if amount
|
40
|
+
product_object.unit = unit if unit
|
41
|
+
|
42
|
+
cart_item_params = product_object.to_cart_item_params
|
43
|
+
existing_item = find_item(cart_item_params)
|
44
|
+
|
45
|
+
if existing_item && amount
|
46
|
+
negative_amount = -amount
|
47
|
+
if ((existing_item.amount + negative_amount) <= 0)
|
48
|
+
existing_item.destroy
|
49
|
+
else
|
50
|
+
existing_item.inc(amount: negative_amount)
|
51
|
+
end
|
52
|
+
elsif existing_item && amount.nil?
|
53
|
+
existing_item.destroy
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# searches cart_items by a given Hash or MongoidCart::ActsAsProduct instance
|
58
|
+
def find_item(item)
|
59
|
+
return nil if cart_items.blank?
|
60
|
+
|
61
|
+
item = prepare_for_cart_item(item)
|
62
|
+
result = cart_items.detect do |ci|
|
63
|
+
ci.type == item.type && ci.unit == item.unit
|
64
|
+
end
|
65
|
+
return result.nil? ? false : result
|
66
|
+
end
|
67
|
+
|
68
|
+
# given Hash or MongoidCart::ActsAsProduct instance will be prepared to store as cart_item
|
69
|
+
# @return MongoidCart::ActsAsProduct instance
|
70
|
+
def prepare_for_cart_item(item)
|
71
|
+
is_a_hash = item.is_a? Hash
|
72
|
+
if is_a_hash
|
73
|
+
prepared_item = MongoidCart::CartItem.new item
|
74
|
+
|
75
|
+
elsif item.singleton_class.included_modules.include?(MongoidCart::ActsAsProduct)
|
76
|
+
prepared_item = item
|
77
|
+
|
78
|
+
else
|
79
|
+
raise StandardError, "Given object must be a Hash or include MongoidCart::ActsAsProduct: #{item.class}"
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
return prepared_item
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module MongoidCart
|
2
|
+
class CartItem
|
3
|
+
include Mongoid::Document
|
4
|
+
|
5
|
+
field :type, type: String
|
6
|
+
field :product_title, type: String
|
7
|
+
field :sku, type: String
|
8
|
+
field :amount, type: Integer
|
9
|
+
field :net_price, type: Float
|
10
|
+
field :unit, type: String
|
11
|
+
|
12
|
+
attr_accessor :units, :in_stock
|
13
|
+
|
14
|
+
belongs_to :cart, :class_name => 'MongoidCart::Cart', inverse_of: :cart_items
|
15
|
+
|
16
|
+
validates_presence_of :type, :product_title, :sku, :amount, :unit, :net_price
|
17
|
+
|
18
|
+
def related_product
|
19
|
+
self.send(self.type.underscore.to_sym)
|
20
|
+
end
|
21
|
+
|
22
|
+
def net_sum
|
23
|
+
net_price * amount
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module MongoidCart
|
2
|
+
module Validators
|
3
|
+
class CartItemDuplicateValidator < ActiveModel::Validator
|
4
|
+
|
5
|
+
def validate(record)
|
6
|
+
cart_items = record.cart_items
|
7
|
+
|
8
|
+
existing_duplicate = cart_items.detect do |ci|
|
9
|
+
ci.type == record.type && ci.unit == record.unit
|
10
|
+
end
|
11
|
+
|
12
|
+
if existing_duplicate
|
13
|
+
existing_duplicate
|
14
|
+
return false
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<h1>I am the cart</h1>
|
2
|
+
|
3
|
+
|
4
|
+
<table class="table table-hover">
|
5
|
+
<thead>
|
6
|
+
<tr>
|
7
|
+
<th>Amount</th>
|
8
|
+
<th>Units</th>
|
9
|
+
<th>Name</th>
|
10
|
+
<th>Type</th>
|
11
|
+
<th>Remove</th>
|
12
|
+
</tr>
|
13
|
+
</thead>
|
14
|
+
<% current_cart.each do |cart_item| %>
|
15
|
+
<tbody>
|
16
|
+
<tr>
|
17
|
+
<td><%= cart_item[:amount] %></td>
|
18
|
+
<td><%= cart_item[:units] %></td>
|
19
|
+
<td><%= cart_item.title %></td>
|
20
|
+
<td><%= cart_item.class %></td>
|
21
|
+
<td><%= add_or_remove_cart_link(cart_item) %></td>
|
22
|
+
</tr>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
</tbody>
|
26
|
+
</table>
|
data/config/routes.rb
CHANGED
data/config/secrets.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure the secrets in this file are kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
|
13
|
+
development:
|
14
|
+
secret_key_base: 5ac03fe0778745934c552599cc09083ebfbd25d3ecef6794557d1d2cce804e24ca90165fc86ec04e2eccfb919548a2ea89859fa6c0c8696ecdf2d2e397999129
|
15
|
+
|
16
|
+
test:
|
17
|
+
secret_key_base: 5a37a4392f8aad650df1faf2ef9ad5263760367358cae0dc5dd2bdc6715808770977ece13f6c6092f9a4e6cc3cc87a2ded9cc8cf54da69757dc450a5a6214266
|
18
|
+
|
19
|
+
# Do not keep production secrets in the repository,
|
20
|
+
# instead read values from the environment.
|
21
|
+
production:
|
22
|
+
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module MongoidCart
|
2
|
+
class InitializerGenerator < Rails::Generators::Base
|
3
|
+
|
4
|
+
desc "This generator creates an initializer file for MongoidCart"
|
5
|
+
|
6
|
+
def copy_initializer_file
|
7
|
+
copy_file "initializer.rb", "config/initializers/#{file_name}.rb"
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
11
|
+
end
|
data/lib/mongoid_cart.rb
CHANGED
@@ -1,4 +1,25 @@
|
|
1
1
|
require "mongoid_cart/engine"
|
2
|
+
require 'mongoid_cart/railtie' if defined?(Rails)
|
3
|
+
require "mongoid_cart/acts_as_product"
|
4
|
+
require "mongoid_cart/acts_as_customer"
|
5
|
+
require 'mongoid_cart/relation'
|
2
6
|
|
3
7
|
module MongoidCart
|
8
|
+
|
9
|
+
def self.configuration
|
10
|
+
@configuration ||= Configuration.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.configure
|
14
|
+
yield(configuration) if block_given?
|
15
|
+
end
|
16
|
+
|
17
|
+
class Configuration
|
18
|
+
attr_accessor :customer_model_name
|
19
|
+
|
20
|
+
def initialize
|
21
|
+
@customer_model_name = 'User'
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
4
25
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# This module should be included into your models via
|
2
|
+
# include into MongoidCart::ActsAsProduct
|
3
|
+
#
|
4
|
+
require 'active_support/concern'
|
5
|
+
|
6
|
+
module MongoidCart
|
7
|
+
module ActsAsCustomer
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
|
12
|
+
# a method which provides a customer_id
|
13
|
+
attr_accessor :current_cart
|
14
|
+
has_many :carts, :class_name => 'MongoidCart::Cart', inverse_of: :customer
|
15
|
+
|
16
|
+
def current_cart
|
17
|
+
carts.last || carts.create
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
module ClassMethods
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# This module should be included into your models via
|
2
|
+
# include into MongoidCart::ActsAsProduct
|
3
|
+
#
|
4
|
+
require 'active_support/concern'
|
5
|
+
|
6
|
+
module MongoidCart
|
7
|
+
module ActsAsProduct
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
|
12
|
+
# adds dynamic association to the CartItem to refer to the ActsAsProduct class
|
13
|
+
cart_item_relation_method = MongoidCart::Relation.cart_items_product_string(name)
|
14
|
+
MongoidCart::CartItem.class_eval(cart_item_relation_method)
|
15
|
+
|
16
|
+
product_relation_method = MongoidCart::Relation.cart_product_string(name)
|
17
|
+
MongoidCart::Cart.class_eval(product_relation_method)
|
18
|
+
|
19
|
+
# set relations
|
20
|
+
has_many :cart_items,
|
21
|
+
class_name: "MongoidCart::CartItem",
|
22
|
+
as: class_name_to_sym,
|
23
|
+
inverse_of: :product
|
24
|
+
|
25
|
+
def carts
|
26
|
+
MongoidCart::Cart.in(id: cart_items.pluck(:cart_id))
|
27
|
+
end
|
28
|
+
|
29
|
+
# sku
|
30
|
+
field :sku, type: String
|
31
|
+
|
32
|
+
# product_title / name of your product
|
33
|
+
field :product_title, type: String
|
34
|
+
|
35
|
+
# how many the item cost without any taxes
|
36
|
+
field :net_price, type: Float, default: 0.0
|
37
|
+
|
38
|
+
# how many products are in stock
|
39
|
+
field :in_stock, type: Float, default: 0
|
40
|
+
|
41
|
+
# returns an array with units
|
42
|
+
field :units, type: Array
|
43
|
+
|
44
|
+
attr_accessor :amount, :unit
|
45
|
+
|
46
|
+
def amount
|
47
|
+
@amount || 1
|
48
|
+
end
|
49
|
+
|
50
|
+
def unit
|
51
|
+
@unit || units.first
|
52
|
+
end
|
53
|
+
|
54
|
+
validates_presence_of :product_title, :net_price, :in_stock, :units
|
55
|
+
|
56
|
+
before_create :assign_sku
|
57
|
+
|
58
|
+
# a method which provides a product sku like
|
59
|
+
# PN-aec5d-00002
|
60
|
+
|
61
|
+
def build_sku
|
62
|
+
"#{self.product_title.split(' ').map(&:first).map!(&:upcase).join}-#{_id.to_s.split(//).first(5).join}-#{_id.to_s.split(//).last(5).join}"
|
63
|
+
end
|
64
|
+
|
65
|
+
# returns Hash with mapped cart_item params
|
66
|
+
def to_cart_item_params
|
67
|
+
{sku: self.sku,
|
68
|
+
product_title: self.product_title,
|
69
|
+
type: self.type,
|
70
|
+
in_stock: self.in_stock,
|
71
|
+
net_price: self.net_price,
|
72
|
+
units: self.units,
|
73
|
+
unit: self.unit,
|
74
|
+
amount: self.amount
|
75
|
+
}.merge!(Hash["#{self.class.to_s.underscore}_id".to_sym, self.id])
|
76
|
+
end
|
77
|
+
|
78
|
+
# returns class of product as String
|
79
|
+
def type
|
80
|
+
self.class.to_s
|
81
|
+
end
|
82
|
+
|
83
|
+
private
|
84
|
+
|
85
|
+
def assign_sku
|
86
|
+
self.sku = build_sku
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
module ClassMethods
|
92
|
+
|
93
|
+
def class_name_to_sym
|
94
|
+
name.underscore.to_sym
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module MongoidCart
|
2
|
+
module Controller
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
def cart_id
|
6
|
+
session[:mongoid_cart_id] ||= MongoidCart::Cart.create._id
|
7
|
+
end
|
8
|
+
|
9
|
+
def current_cart
|
10
|
+
session[:mongoid_current_cart] ||= MongoidCart::Cart.find cart_id
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rails'
|
2
|
+
require 'mongoid_cart'
|
3
|
+
require 'mongoid_cart/controller'
|
4
|
+
require 'mongoid_cart/view_helpers' if defined? ActionView
|
5
|
+
|
6
|
+
module MongoidCart
|
7
|
+
class Railtie < Rails::Railtie
|
8
|
+
|
9
|
+
initializer "mongoid_cart.action_controller" do
|
10
|
+
ActiveSupport.on_load(:action_controller) do
|
11
|
+
include MongoidCart::Controller
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
initializer "mongoid_cart.view_helpers" do
|
16
|
+
ActionView::Base.send :include, ViewHelpers
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module MongoidCart
|
2
|
+
class Relation
|
3
|
+
|
4
|
+
# creates a string which can be implemented in models to provide dynamcic relation
|
5
|
+
def self.cart_items_product_string(class_name)
|
6
|
+
"belongs_to :#{class_name.to_s.underscore.to_sym}" + ", :class_name => '#{class_name.constantize}', inverse_of: :cart_item"
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.build_user_relation_string
|
10
|
+
"has_many :carts, :class_name => 'MongoidCart::Cart', inverse_of: :customer"
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.cart_product_string(class_name)
|
14
|
+
"def #{class_name.to_s.underscore.pluralize}; #{class_name.camelcase.constantize}.in(id: cart_items.pluck(:#{class_name.to_s.underscore}_id)); end"
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
data/lib/mongoid_cart/version.rb
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
module MongoidCart
|
2
|
+
module ViewHelpers
|
3
|
+
|
4
|
+
# link_to mongoid_cart.remove_item_path
|
5
|
+
def remove_from_cart_link(item)
|
6
|
+
link_to(mongoid_cart.remove_item_path(item: {type: item.class.to_s, id: item._id}), {class: "btn btn-default"}) do
|
7
|
+
(tag :i, class: 'fa fa-cart-plus').concat('Remove from cart')
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
# link_to mongoid_cart.add_item_path
|
12
|
+
def add_to_cart_link(item)
|
13
|
+
link_to(mongoid_cart.add_item_path(item: {type: item.class.to_s, id: item._id}), {class: "btn btn-default"}) do
|
14
|
+
(tag :i, class: 'fa fa-cart-plus').concat('Add to cart')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# shows the add_to_cart or remove_from_cart link, depending if the item is already in cart or not
|
19
|
+
def add_or_remove_cart_link(item)
|
20
|
+
if current_cart.add item
|
21
|
+
remove_from_cart_link item
|
22
|
+
else
|
23
|
+
add_to_cart_link item
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def link_to_product(item, *options)
|
28
|
+
action = options.include?(:action) ? options[:action] : :show
|
29
|
+
controller = options.include?(:controller) ? options[:controller] : item.type.pluralize.downcase
|
30
|
+
|
31
|
+
link_to item.title, controller: controller, action: action, id: item.id
|
32
|
+
end
|
33
|
+
|
34
|
+
# sums net_price of cart contentç
|
35
|
+
def sum
|
36
|
+
self.current.map { |item| [item.amount, item.net_price] }
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_cart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.5'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Jezek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,98 +16,112 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 4.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mongoid
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec-rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: factory_girl_rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: cucumber
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: database_cleaner
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: mongoid-rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - '='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 3.0.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 3.0.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
124
|
+
version: '0'
|
111
125
|
description: If you need a simple shopping cart handler for monogid project use this
|
112
126
|
one :-)
|
113
127
|
email:
|
@@ -121,13 +135,27 @@ files:
|
|
121
135
|
- app/assets/javascripts/mongoid_cart/application.js
|
122
136
|
- app/assets/stylesheets/mongoid_cart/application.css
|
123
137
|
- app/controllers/mongoid_cart/application_controller.rb
|
138
|
+
- app/controllers/mongoid_cart/cart_controller.rb
|
124
139
|
- app/helpers/mongoid_cart/application_helper.rb
|
140
|
+
- app/models/mongoid_cart/cart.rb
|
141
|
+
- app/models/mongoid_cart/cart_item.rb
|
142
|
+
- app/models/mongoid_cart/validators/cart_item_duplicate_validator.rb
|
125
143
|
- app/views/layouts/mongoid_cart/application.html.erb
|
144
|
+
- app/views/mongoid_cart/cart/show.html.erb
|
126
145
|
- config/cucumber.yml
|
127
146
|
- config/routes.rb
|
147
|
+
- config/secrets.yml
|
148
|
+
- lib/configuration/config_template.rb
|
149
|
+
- lib/generators/initializer_generator.rb
|
128
150
|
- lib/mongoid_cart.rb
|
151
|
+
- lib/mongoid_cart/acts_as_customer.rb
|
152
|
+
- lib/mongoid_cart/acts_as_product.rb
|
153
|
+
- lib/mongoid_cart/controller.rb
|
129
154
|
- lib/mongoid_cart/engine.rb
|
155
|
+
- lib/mongoid_cart/railtie.rb
|
156
|
+
- lib/mongoid_cart/relation.rb
|
130
157
|
- lib/mongoid_cart/version.rb
|
158
|
+
- lib/mongoid_cart/view_helpers.rb
|
131
159
|
- lib/tasks/mongoid_cart_tasks.rake
|
132
160
|
homepage: https://www.github.com/mediatainment/mongoid_cart
|
133
161
|
licenses:
|
@@ -149,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
177
|
version: '0'
|
150
178
|
requirements: []
|
151
179
|
rubyforge_project:
|
152
|
-
rubygems_version: 2.4.
|
180
|
+
rubygems_version: 2.4.5.1
|
153
181
|
signing_key:
|
154
182
|
specification_version: 4
|
155
183
|
summary: Very basic cart system for mongoid models.
|