deli 0.5.0
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.
- data/Rakefile +77 -0
- data/lib/deli.rb +18 -0
- data/lib/deli/adapters.rb +9 -0
- data/lib/deli/adapters/active_record.rb +251 -0
- data/lib/deli/adapters/cassandra.rb +52 -0
- data/lib/deli/adapters/mongoid.rb +180 -0
- data/lib/deli/adapters/neo4j.rb +54 -0
- data/lib/deli/adapters/simple.rb +39 -0
- data/lib/deli/configuration.rb +47 -0
- data/lib/deli/controller.rb +75 -0
- data/lib/deli/helper.rb +61 -0
- data/lib/deli/model.rb +13 -0
- data/lib/deli/pagination.rb +117 -0
- data/lib/deli/param.rb +189 -0
- data/lib/deli/query.rb +133 -0
- data/lib/deli/railtie.rb +14 -0
- data/spec/active_record_spec.rb +358 -0
- data/spec/cassandra_spec.rb +40 -0
- data/spec/mongoid_spec.rb +40 -0
- data/spec/neo4j_spec.rb +40 -0
- data/spec/param_spec.rb +318 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/support/database.rb +69 -0
- data/spec/support/models.rb +27 -0
- metadata +77 -0
@@ -0,0 +1,69 @@
|
|
1
|
+
#MongoMapper.config = {"test" => {'uri' => 'mongodb://localhost/computable-gem-test'}}
|
2
|
+
#MongoMapper.connect('test')
|
3
|
+
|
4
|
+
Mongoid.configure do |config|
|
5
|
+
config.master = Mongo::Connection.new.db("deli-gem-test")
|
6
|
+
end
|
7
|
+
|
8
|
+
begin
|
9
|
+
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
|
10
|
+
rescue ArgumentError
|
11
|
+
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => ":memory:")
|
12
|
+
end
|
13
|
+
|
14
|
+
ActiveRecord::Base.configurations = true
|
15
|
+
|
16
|
+
ActiveRecord::Schema.define(:version => 1) do
|
17
|
+
create_table :users, :force => true do |t|
|
18
|
+
t.string :type
|
19
|
+
t.string :first_name
|
20
|
+
t.string :last_name
|
21
|
+
t.string :status
|
22
|
+
t.string :category
|
23
|
+
t.integer :product_count, :default => 0
|
24
|
+
t.integer :selected_count, :default => 0
|
25
|
+
t.integer :redeemed_count, :default => 0
|
26
|
+
t.integer :card_product_count, :default => 0
|
27
|
+
t.integer :deal_product_count, :default => 0
|
28
|
+
t.decimal :average_product_cost, :precision => 8, :scale => 2, :default => 0.0, :null => false
|
29
|
+
t.decimal :total_product_cost, :precision => 8, :scale => 2, :default => 0.0, :null => false
|
30
|
+
t.timestamps
|
31
|
+
end
|
32
|
+
|
33
|
+
create_table :stores, :force => true do |t|
|
34
|
+
t.string :type
|
35
|
+
t.string :name
|
36
|
+
t.string :status
|
37
|
+
t.string :category
|
38
|
+
t.integer :product_count, :default => 0
|
39
|
+
t.integer :card_product_count, :default => 0
|
40
|
+
t.integer :deal_product_count, :default => 0
|
41
|
+
t.decimal :average_product_cost, :precision => 8, :scale => 2, :default => 0.0, :null => false
|
42
|
+
t.decimal :total_product_cost, :precision => 8, :scale => 2, :default => 0.0, :null => false
|
43
|
+
t.timestamps
|
44
|
+
end
|
45
|
+
|
46
|
+
create_table :products, :force => true do |t|
|
47
|
+
t.string :type
|
48
|
+
t.integer :user_id
|
49
|
+
t.string :user_type
|
50
|
+
t.integer :store_id
|
51
|
+
t.string :status
|
52
|
+
t.decimal :total, :precision => 8, :scale => 2, :default => 0.0, :null => false
|
53
|
+
t.decimal :balance, :precision => 8, :scale => 2, :default => 0.0, :null => false
|
54
|
+
t.timestamps
|
55
|
+
end
|
56
|
+
|
57
|
+
create_table :bookmarks, :force => true do |t|
|
58
|
+
t.integer :user_id
|
59
|
+
t.integer :store_id
|
60
|
+
t.integer :product_id
|
61
|
+
t.integer :bookmarkable_id
|
62
|
+
t.string :bookmarkable_type
|
63
|
+
t.string :customer_segment
|
64
|
+
t.string :location_kind
|
65
|
+
t.string :event
|
66
|
+
t.timestamps
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class User < ActiveRecord::Base
|
2
|
+
has_many :bookmarks
|
3
|
+
end
|
4
|
+
|
5
|
+
class Bookmark < ActiveRecord::Base
|
6
|
+
belongs_to :user
|
7
|
+
#belongs_to :bookmarkable, :polymorphic => true
|
8
|
+
belongs_to :product
|
9
|
+
end
|
10
|
+
|
11
|
+
class Product < ActiveRecord::Base
|
12
|
+
has_many :bookmarks#, :as => :bookmarkable, :source => :bookmark, :class_name => "Bookmark", :source_type => "Bookmark"
|
13
|
+
end
|
14
|
+
|
15
|
+
=begin
|
16
|
+
class MongoidUser
|
17
|
+
include Mongoid::Document
|
18
|
+
end
|
19
|
+
|
20
|
+
class MongoidBookmark
|
21
|
+
include Mongoid::Document
|
22
|
+
end
|
23
|
+
|
24
|
+
class MongoidProduct
|
25
|
+
include Mongoid::Document
|
26
|
+
end
|
27
|
+
=end
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: deli
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.5.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Lance Pollard
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-09-14 00:00:00 Z
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Tasty URL Parameters for Rails
|
17
|
+
email: lancejpollard@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- Rakefile
|
26
|
+
- lib/deli/adapters/active_record.rb
|
27
|
+
- lib/deli/adapters/cassandra.rb
|
28
|
+
- lib/deli/adapters/mongoid.rb
|
29
|
+
- lib/deli/adapters/neo4j.rb
|
30
|
+
- lib/deli/adapters/simple.rb
|
31
|
+
- lib/deli/adapters.rb
|
32
|
+
- lib/deli/configuration.rb
|
33
|
+
- lib/deli/controller.rb
|
34
|
+
- lib/deli/helper.rb
|
35
|
+
- lib/deli/model.rb
|
36
|
+
- lib/deli/pagination.rb
|
37
|
+
- lib/deli/param.rb
|
38
|
+
- lib/deli/query.rb
|
39
|
+
- lib/deli/railtie.rb
|
40
|
+
- lib/deli.rb
|
41
|
+
- spec/active_record_spec.rb
|
42
|
+
- spec/cassandra_spec.rb
|
43
|
+
- spec/mongoid_spec.rb
|
44
|
+
- spec/neo4j_spec.rb
|
45
|
+
- spec/param_spec.rb
|
46
|
+
- spec/spec_helper.rb
|
47
|
+
- spec/support/database.rb
|
48
|
+
- spec/support/models.rb
|
49
|
+
homepage: http://github.com/viatropos/deli
|
50
|
+
licenses: []
|
51
|
+
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: "0"
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: "0"
|
69
|
+
requirements: []
|
70
|
+
|
71
|
+
rubyforge_project: deli
|
72
|
+
rubygems_version: 1.8.10
|
73
|
+
signing_key:
|
74
|
+
specification_version: 3
|
75
|
+
summary: Tasty URL Parameters for Rails
|
76
|
+
test_files: []
|
77
|
+
|