mongoid_rateable 0.3.3 → 0.4.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.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MDQyMzA4M2M3N2NmM2JmMGI2MTJlNzhiYmVjMDhhOWUwYWQ5Njc5YQ==
5
- data.tar.gz: !binary |-
6
- MzE1NWFjNTJjNWY0ZDZjYTU5NTA4NjU2NTgwNWJlZjdhY2VhYTY0ZA==
2
+ SHA1:
3
+ metadata.gz: 7ed5813b4307405729d5811b7cffba3f3dc93f25
4
+ data.tar.gz: 24c6cbd0e6a16cec116f28605e1239a93f5cf3eb
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ODdkMzA3ODhlZWNkMGE0ZmUzMmI5ZDVhMWY5OTljMTA1MTIxNDUyODc2NDg2
10
- MDVjZTM2YzI1NzJjMTVjODVkNDQ5MzQ0Zjk2NDNlZmM3ODg0OTc1Y2JmNjFj
11
- MTNmOGUwMTUzMzM5YzdhZTU5NWIwMTcxZmU3YWY2YTU3NTA0YTU=
12
- data.tar.gz: !binary |-
13
- NDc0OGUxOTkxODFjNmNiMGJmMGNjOGM5MzU3ZmRmZDRkMGViOTZkY2RhZWUw
14
- Y2ZiNDQzZmQyZmU5YzJiMDZlZjAxOTllOGQ5ZmNmZjlhNmYyM2NiMzZiNTU2
15
- OTEzODcxODViZjIzMGZjN2IxNTEzMmVmODVlNDgyZjEwN2MyNjQ=
6
+ metadata.gz: 8478ba38acb41d3a62dd3f9ca89909b7548f46480c015de728491059ab1c3be0e17d809eb2c33af9d41fee0371f15162c0fe2c7fb18008cc596f0f9d58ab387d
7
+ data.tar.gz: 04b0604a1296b623c78f2b80d4a765a887d9130f0cad598bc488dc1e8f7642e06680cac80cd8a469f3007c415ff41aaf4853c340092c1f4f305721547d88799e
@@ -0,0 +1 @@
1
+ ruby-2.3.3
@@ -1 +1,16 @@
1
- services: mongodb
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 2.1.0
5
+ - 2.2.0
6
+ - ruby-head
7
+ - jruby
8
+ - jruby-head
9
+ gemfile:
10
+ - gemfiles/mongoid_3.gemfile
11
+ - gemfiles/mongoid_4.gemfile
12
+ - gemfiles/mongoid_5.gemfile
13
+ - gemfiles/mongoid_6.gemfile
14
+ services:
15
+ - mongodb
16
+ sudo: false
@@ -0,0 +1,15 @@
1
+ appraise 'mongoid-3' do
2
+ gem 'mongoid', '3.1.7'
3
+ end
4
+
5
+ appraise 'mongoid-4' do
6
+ gem 'mongoid', '4.0.2'
7
+ end
8
+
9
+ appraise 'mongoid-5' do
10
+ gem 'mongoid', '5.2.0'
11
+ end
12
+
13
+ appraise 'mongoid-6' do
14
+ gem 'mongoid', '6.1.0'
15
+ end
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ *0.4.0*
4
+
5
+ Add Mongoid 4,5,6 support
6
+
3
7
  *0.3.0*
4
8
 
5
9
  Removed RATING_RANGE constant.
data/Gemfile CHANGED
@@ -1,13 +1,15 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'mongoid', '~> 3.0'
3
+ gem 'mongoid', '>= 3.0'
4
4
 
5
5
  group :development do
6
- gem 'bundler', '~> 1'
7
- gem 'jeweler', '~> 1.6'
8
- gem 'simplecov', '~> 0.4', :require => false
9
- gem 'rdoc', '~> 3'
10
- gem 'rspec', '~> 2.0'
11
- gem 'database_cleaner', '~> 0'
6
+ gem 'bundler'
7
+ gem 'jeweler', '~> 2.1.1'
8
+ gem 'simplecov', '~> 0.7', require: false
9
+ gem 'yard'
10
+ gem 'rspec', '>= 3.0.0'
11
+ gem 'appraisal'
12
+ gem 'coveralls', require: false
13
+ gem 'database_cleaner', '>= 0.8.0'
12
14
  end
13
15
 
@@ -4,7 +4,8 @@ Provides fields and methods for the *rating* manipulation on Mongoid documents
4
4
 
5
5
  {<img src="https://secure.travis-ci.org/proton/mongoid_rateable.png" />}[http://travis-ci.org/proton/mongoid_rateable]
6
6
 
7
- Lastest version of Mongoid:Rateable requires mongoid 3.
7
+ Lastest version of Mongoid:Rateable requires mongoid 3, 4, 5 and 6.
8
+
8
9
  If you need a mongoid 2 support, look at mongoid_rateable 0.1.7.
9
10
 
10
11
  == Support us
@@ -21,7 +22,7 @@ Add to Gemfile:
21
22
  == Getting Started
22
23
 
23
24
 
24
- Simply use the `rateable` macro from any class that is a Mongoid Document.
25
+ Simply use the `rateable` macro from any class that is a Mongoid Document.
25
26
 
26
27
  This macro will include `Mongoid::Rateable` into the class and configure the rating functionality using the options hash. For any option not present, the default option value will be used.
27
28
 
@@ -36,7 +37,7 @@ You can also set the `default_rater`
36
37
  class Post
37
38
  include Mongoid::Document
38
39
 
39
- # will simply call the 'owner' method to find the default rater
40
+ # will simply call the 'owner' method to find the default rater
40
41
  # if no rater given when rating
41
42
 
42
43
  rateable range: (-5..7), raters: [User, Admin], default_rater: 'owner'
@@ -45,12 +46,12 @@ You can also set the `default_rater`
45
46
  class Post
46
47
  include Mongoid::Document
47
48
 
48
- # if given a block, this will be used as a dynamic way to find
49
+ # if given a block, this will be used as a dynamic way to find
49
50
  # the a rater in case no rater is passed in as the 2nd argument to
50
51
  # the rate method
51
52
 
52
53
  rateable range: (-5..7), raters: [User, Admin] do
53
- # will by default be rated by the last user
54
+ # will by default be rated by the last user
54
55
  # who made a comment to this post!
55
56
  comments.last.user
56
57
  end
@@ -73,7 +74,7 @@ You can rate by passing an integer and a rater model to the "rate" method:
73
74
  # Many users love this!
74
75
  @post.rate 5, @users # They LOVIN' it!
75
76
 
76
- Rates have weight (1 by defaut)
77
+ Rates have weight (1 by default)
77
78
 
78
79
  @post.rate 5, @user, 3 # Rate @post with weight 3 (@user has high karma)
79
80
  @post.rate 3, @user, 1 # Rate @post with weight 1 (@user has low karma)
@@ -86,7 +87,7 @@ And don't forget to save rateable object:
86
87
 
87
88
  @post.save
88
89
 
89
- Sure, you can rate and save in one fuction:
90
+ Sure, you can rate and save in one function:
90
91
 
91
92
  @post.rate_and_save(3, @user)
92
93
  @post.unrate_and_save(@user)
@@ -105,6 +106,10 @@ You can get user mark:
105
106
 
106
107
  @post.user_mark(@user) # Mark or nil (if not rated by user)
107
108
 
109
+ Or marks:
110
+
111
+ @post.user_marks([@user1, @user2]) # Hash {user.id => mark}
112
+
108
113
  You can also get a tally of the number of rates cast:
109
114
 
110
115
  @post.rate_count # Just one so far!
data/Rakefile CHANGED
@@ -37,7 +37,7 @@ task :default => :spec
37
37
 
38
38
  require 'rdoc/task'
39
39
  RDoc::Task.new do |rdoc|
40
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
40
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
41
41
 
42
42
  rdoc.rdoc_dir = 'rdoc'
43
43
  rdoc.title = "mongoid_rateable #{version}"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.3
1
+ 0.4.0
@@ -0,0 +1,16 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "mongoid", "3.1.7"
6
+
7
+ group :development do
8
+ gem "bundler"
9
+ gem "jeweler", "~> 2.1.1"
10
+ gem "simplecov", "~> 0.7", :require => false
11
+ gem "yard"
12
+ gem "rspec", ">= 3.0.0"
13
+ gem "appraisal"
14
+ gem "coveralls", :require => false
15
+ gem "database_cleaner", ">= 0.8.0"
16
+ end
@@ -0,0 +1,119 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activemodel (3.2.22.5)
5
+ activesupport (= 3.2.22.5)
6
+ builder (~> 3.0.0)
7
+ activesupport (3.2.22.5)
8
+ i18n (~> 0.6, >= 0.6.4)
9
+ multi_json (~> 1.0)
10
+ addressable (2.5.0)
11
+ public_suffix (~> 2.0, >= 2.0.2)
12
+ appraisal (2.1.0)
13
+ bundler
14
+ rake
15
+ thor (>= 0.14.0)
16
+ builder (3.0.4)
17
+ coveralls (0.8.19)
18
+ json (>= 1.8, < 3)
19
+ simplecov (~> 0.12.0)
20
+ term-ansicolor (~> 1.3)
21
+ thor (~> 0.19.1)
22
+ tins (~> 1.6)
23
+ database_cleaner (1.5.3)
24
+ descendants_tracker (0.0.4)
25
+ thread_safe (~> 0.3, >= 0.3.1)
26
+ diff-lcs (1.3)
27
+ docile (1.1.5)
28
+ faraday (0.9.2)
29
+ multipart-post (>= 1.2, < 3)
30
+ git (1.3.0)
31
+ github_api (0.11.3)
32
+ addressable (~> 2.3)
33
+ descendants_tracker (~> 0.0.1)
34
+ faraday (~> 0.8, < 0.10)
35
+ hashie (>= 1.2)
36
+ multi_json (>= 1.7.5, < 2.0)
37
+ nokogiri (~> 1.6.0)
38
+ oauth2
39
+ hashie (3.4.6)
40
+ highline (1.7.8)
41
+ i18n (0.7.0)
42
+ jeweler (2.1.2)
43
+ builder
44
+ bundler (>= 1.0)
45
+ git (>= 1.2.5)
46
+ github_api (~> 0.11.0)
47
+ highline (>= 1.6.15)
48
+ nokogiri (>= 1.5.10)
49
+ rake
50
+ rdoc
51
+ semver
52
+ json (2.0.3)
53
+ jwt (1.5.6)
54
+ mini_portile2 (2.1.0)
55
+ mongoid (3.1.7)
56
+ activemodel (~> 3.2)
57
+ moped (~> 1.4)
58
+ origin (~> 1.0)
59
+ tzinfo (~> 0.3.29)
60
+ moped (1.5.3)
61
+ multi_json (1.12.1)
62
+ multi_xml (0.6.0)
63
+ multipart-post (2.0.0)
64
+ nokogiri (1.6.8.1)
65
+ mini_portile2 (~> 2.1.0)
66
+ oauth2 (1.3.0)
67
+ faraday (>= 0.8, < 0.11)
68
+ jwt (~> 1.0)
69
+ multi_json (~> 1.3)
70
+ multi_xml (~> 0.5)
71
+ rack (>= 1.2, < 3)
72
+ origin (1.1.0)
73
+ public_suffix (2.0.5)
74
+ rack (2.0.1)
75
+ rake (12.0.0)
76
+ rdoc (5.0.0)
77
+ rspec (3.5.0)
78
+ rspec-core (~> 3.5.0)
79
+ rspec-expectations (~> 3.5.0)
80
+ rspec-mocks (~> 3.5.0)
81
+ rspec-core (3.5.4)
82
+ rspec-support (~> 3.5.0)
83
+ rspec-expectations (3.5.0)
84
+ diff-lcs (>= 1.2.0, < 2.0)
85
+ rspec-support (~> 3.5.0)
86
+ rspec-mocks (3.5.0)
87
+ diff-lcs (>= 1.2.0, < 2.0)
88
+ rspec-support (~> 3.5.0)
89
+ rspec-support (3.5.0)
90
+ semver (1.0.1)
91
+ simplecov (0.12.0)
92
+ docile (~> 1.1.0)
93
+ json (>= 1.8, < 3)
94
+ simplecov-html (~> 0.10.0)
95
+ simplecov-html (0.10.0)
96
+ term-ansicolor (1.4.0)
97
+ tins (~> 1.0)
98
+ thor (0.19.4)
99
+ thread_safe (0.3.5)
100
+ tins (1.13.0)
101
+ tzinfo (0.3.52)
102
+ yard (0.9.8)
103
+
104
+ PLATFORMS
105
+ ruby
106
+
107
+ DEPENDENCIES
108
+ appraisal
109
+ bundler
110
+ coveralls
111
+ database_cleaner (>= 0.8.0)
112
+ jeweler (~> 2.1.1)
113
+ mongoid (= 3.1.7)
114
+ rspec (>= 3.0.0)
115
+ simplecov (~> 0.7)
116
+ yard
117
+
118
+ BUNDLED WITH
119
+ 1.14.3
@@ -0,0 +1,16 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "mongoid", "4.0.2"
6
+
7
+ group :development do
8
+ gem "bundler"
9
+ gem "jeweler", "~> 2.1.1"
10
+ gem "simplecov", "~> 0.7", :require => false
11
+ gem "yard"
12
+ gem "rspec", ">= 3.0.0"
13
+ gem "appraisal"
14
+ gem "coveralls", :require => false
15
+ gem "database_cleaner", ">= 0.8.0"
16
+ end
@@ -0,0 +1,130 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activemodel (4.2.7.1)
5
+ activesupport (= 4.2.7.1)
6
+ builder (~> 3.1)
7
+ activesupport (4.2.7.1)
8
+ i18n (~> 0.7)
9
+ json (~> 1.7, >= 1.7.7)
10
+ minitest (~> 5.1)
11
+ thread_safe (~> 0.3, >= 0.3.4)
12
+ tzinfo (~> 1.1)
13
+ addressable (2.5.0)
14
+ public_suffix (~> 2.0, >= 2.0.2)
15
+ appraisal (2.1.0)
16
+ bundler
17
+ rake
18
+ thor (>= 0.14.0)
19
+ bson (3.2.6)
20
+ builder (3.2.3)
21
+ connection_pool (2.2.1)
22
+ coveralls (0.8.19)
23
+ json (>= 1.8, < 3)
24
+ simplecov (~> 0.12.0)
25
+ term-ansicolor (~> 1.3)
26
+ thor (~> 0.19.1)
27
+ tins (~> 1.6)
28
+ database_cleaner (1.5.3)
29
+ descendants_tracker (0.0.4)
30
+ thread_safe (~> 0.3, >= 0.3.1)
31
+ diff-lcs (1.3)
32
+ docile (1.1.5)
33
+ faraday (0.9.2)
34
+ multipart-post (>= 1.2, < 3)
35
+ git (1.3.0)
36
+ github_api (0.11.3)
37
+ addressable (~> 2.3)
38
+ descendants_tracker (~> 0.0.1)
39
+ faraday (~> 0.8, < 0.10)
40
+ hashie (>= 1.2)
41
+ multi_json (>= 1.7.5, < 2.0)
42
+ nokogiri (~> 1.6.0)
43
+ oauth2
44
+ hashie (3.4.6)
45
+ highline (1.7.8)
46
+ i18n (0.7.0)
47
+ jeweler (2.1.2)
48
+ builder
49
+ bundler (>= 1.0)
50
+ git (>= 1.2.5)
51
+ github_api (~> 0.11.0)
52
+ highline (>= 1.6.15)
53
+ nokogiri (>= 1.5.10)
54
+ rake
55
+ rdoc
56
+ semver
57
+ json (1.8.6)
58
+ jwt (1.5.6)
59
+ mini_portile2 (2.1.0)
60
+ minitest (5.10.1)
61
+ mongoid (4.0.2)
62
+ activemodel (~> 4.0)
63
+ moped (~> 2.0.0)
64
+ origin (~> 2.1)
65
+ tzinfo (>= 0.3.37)
66
+ moped (2.0.7)
67
+ bson (~> 3.0)
68
+ connection_pool (~> 2.0)
69
+ optionable (~> 0.2.0)
70
+ multi_json (1.12.1)
71
+ multi_xml (0.6.0)
72
+ multipart-post (2.0.0)
73
+ nokogiri (1.6.8.1)
74
+ mini_portile2 (~> 2.1.0)
75
+ oauth2 (1.3.0)
76
+ faraday (>= 0.8, < 0.11)
77
+ jwt (~> 1.0)
78
+ multi_json (~> 1.3)
79
+ multi_xml (~> 0.5)
80
+ rack (>= 1.2, < 3)
81
+ optionable (0.2.0)
82
+ origin (2.3.0)
83
+ public_suffix (2.0.5)
84
+ rack (2.0.1)
85
+ rake (12.0.0)
86
+ rdoc (5.0.0)
87
+ rspec (3.5.0)
88
+ rspec-core (~> 3.5.0)
89
+ rspec-expectations (~> 3.5.0)
90
+ rspec-mocks (~> 3.5.0)
91
+ rspec-core (3.5.4)
92
+ rspec-support (~> 3.5.0)
93
+ rspec-expectations (3.5.0)
94
+ diff-lcs (>= 1.2.0, < 2.0)
95
+ rspec-support (~> 3.5.0)
96
+ rspec-mocks (3.5.0)
97
+ diff-lcs (>= 1.2.0, < 2.0)
98
+ rspec-support (~> 3.5.0)
99
+ rspec-support (3.5.0)
100
+ semver (1.0.1)
101
+ simplecov (0.12.0)
102
+ docile (~> 1.1.0)
103
+ json (>= 1.8, < 3)
104
+ simplecov-html (~> 0.10.0)
105
+ simplecov-html (0.10.0)
106
+ term-ansicolor (1.4.0)
107
+ tins (~> 1.0)
108
+ thor (0.19.4)
109
+ thread_safe (0.3.5)
110
+ tins (1.13.0)
111
+ tzinfo (1.2.2)
112
+ thread_safe (~> 0.1)
113
+ yard (0.9.8)
114
+
115
+ PLATFORMS
116
+ ruby
117
+
118
+ DEPENDENCIES
119
+ appraisal
120
+ bundler
121
+ coveralls
122
+ database_cleaner (>= 0.8.0)
123
+ jeweler (~> 2.1.1)
124
+ mongoid (= 4.0.2)
125
+ rspec (>= 3.0.0)
126
+ simplecov (~> 0.7)
127
+ yard
128
+
129
+ BUNDLED WITH
130
+ 1.14.3