rails_rest_vote 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -24
- data/lib/rails_rest_vote/engine.rb +9 -9
- data/lib/rails_rest_vote/version.rb +1 -1
- data/rails_rest_vote.gemspec +0 -3
- metadata +2 -53
- data/rails_rest_vote-0.1.0.gem +0 -0
- data/rails_rest_vote-0.1.1.gem +0 -0
- data/rails_rest_vote-0.1.2.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6e92d5617dc208cd81aeae204063afd65098f83
|
4
|
+
data.tar.gz: ec05a98ff3df34476dbe545b3d923cf71dd9138f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecdb344744bb7ddec6185e748b0a6711960645c28f99f0ac8250285efceb1e1ac822e01e2f5cbb122e6adea1e80121abc425c0e0e5a0c94b7617c43f1acce81f
|
7
|
+
data.tar.gz: cf045799d5c003eff3487fbccfca699e967db3f61f8181e73c7c3b2b39663798598b48e7f66b8f9aee38894de5c95a449658da8953f070b454a5599d43dc0051
|
data/README.md
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
# RailsRestVote
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/rails_rest_vote.svg)](https://badge.fury.io/rb/rails_rest_vote)
|
2
3
|
|
3
4
|
Rails Rest Vote is a Ruby Gem which can add voting feature to any model of your rails application and exposes its RESTful APIs.
|
4
5
|
|
5
6
|
If you are using any frontend framework like angular2 in your application it is really helpful.
|
6
7
|
|
7
|
-
|
8
|
-
|
8
|
+
|
9
|
+
|
9
10
|
>Your rails application user managment model name should be `user`.
|
10
11
|
|
11
12
|
## Installation
|
@@ -54,37 +55,37 @@ It can be used in two different ways.
|
|
54
55
|
##### APIs
|
55
56
|
|
56
57
|
> /api/votes/up
|
57
|
-
|
58
|
-
|
58
|
+
|
59
|
+
API is used for upvote on model.
|
59
60
|
```
|
60
|
-
method: POST
|
61
|
+
method: POST
|
61
62
|
body: {"votable_id":"1","votable_type":"Service","user_id":"1"}
|
62
63
|
content-type: application/json
|
63
64
|
response: {"status":200,"message":"upvoted successfully."}
|
64
65
|
```
|
65
|
-
|
66
|
+
|
66
67
|
> /api/votes/down
|
67
|
-
|
68
|
-
|
68
|
+
|
69
|
+
API is used for downvote on model.
|
69
70
|
```
|
70
|
-
method: POST
|
71
|
+
method: POST
|
71
72
|
body: {"votable_id":"1","votable_type":"Service","user_id":"1"}
|
72
73
|
content-type: application/json
|
73
74
|
response: {"status":200,"message":"downvoted successfully."}
|
74
75
|
```
|
75
76
|
> /api/votes/user?user_id=1
|
76
|
-
|
77
|
-
|
77
|
+
|
78
|
+
API returns upvote and downvote count done by a particular user.
|
78
79
|
```
|
79
|
-
method: GET
|
80
|
+
method: GET
|
80
81
|
content-type: application/json
|
81
82
|
response: {"status":200,"upcount":1,"upvotes":[{"id":1,...}], "downcount":1,"downvotes":[{"id":3,...}]}
|
82
83
|
```
|
83
84
|
> /api/votes/model?votable_id=1&votable_type=Service
|
84
|
-
|
85
|
-
|
85
|
+
|
86
|
+
API returns upvote and downvote count done on a particular model.
|
86
87
|
```
|
87
|
-
method: GET
|
88
|
+
method: GET
|
88
89
|
content-type: application/json
|
89
90
|
response: {"status":200,"upcount":1,"upvotes":[{"id":1,...}], "downcount":1,"downvotes":[{"id":3,...}]}
|
90
91
|
```
|
@@ -94,27 +95,27 @@ response: {"status":200,"upcount":1,"upvotes":[{"id":1,...}], "downcount":1,"dow
|
|
94
95
|
##### APIs
|
95
96
|
|
96
97
|
> /api/likes
|
97
|
-
|
98
|
-
Same
|
98
|
+
|
99
|
+
Same API is used for like and unlike. for first time if you hit this api it will work as `like` and If you send same parameters second time it will remove the record from vote table i.e `unlike`
|
99
100
|
```
|
100
|
-
method: POST
|
101
|
+
method: POST
|
101
102
|
body: {"votable_id":"1","votable_type":"Service","user_id":"1"}
|
102
103
|
content-type: application/json
|
103
104
|
response: {"status":200,"message":"liked successfully."}
|
104
105
|
```
|
105
106
|
> /api/likes/user?user_id=1
|
106
|
-
|
107
|
-
|
107
|
+
|
108
|
+
API returns like count done by a particular user.
|
108
109
|
```
|
109
|
-
method: GET
|
110
|
+
method: GET
|
110
111
|
content-type: application/json
|
111
112
|
response: {"status":200,"likecount":1,"likes":[{"id":1,...}]}
|
112
113
|
```
|
113
114
|
> /api/likes/model?votable_id=1&votable_type=Service
|
114
|
-
|
115
|
-
|
115
|
+
|
116
|
+
API returns like count done on a particular model.
|
116
117
|
```
|
117
|
-
method: GET
|
118
|
+
method: GET
|
118
119
|
content-type: application/json
|
119
120
|
response: {"status":200,"likecount":1,"likes":[{"id":1,...}]}
|
120
121
|
```
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module RailsRestVote
|
2
2
|
class Engine < Rails::Engine
|
3
|
-
initialize "rails_rest_vote.load_app_instance_data" do |app|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
end
|
8
|
-
|
9
|
-
initialize "rails_rest_vote.load_static_assets" do |app|
|
10
|
-
|
11
|
-
end
|
3
|
+
# initialize "rails_rest_vote.load_app_instance_data" do |app|
|
4
|
+
# RailsRestVote.setup do |config|
|
5
|
+
# config.app_root = app.root
|
6
|
+
# end
|
7
|
+
# end
|
8
|
+
#
|
9
|
+
# initialize "rails_rest_vote.load_static_assets" do |app|
|
10
|
+
# app.middleware.use ::ActionDispatch::Static, "#{root}/public"
|
11
|
+
# end
|
12
12
|
|
13
13
|
end
|
14
14
|
end
|
data/rails_rest_vote.gemspec
CHANGED
@@ -20,8 +20,5 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.add_development_dependency "bundler", "~> 1.11"
|
24
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
-
spec.add_development_dependency 'rails', '~> 4.2', '>= 4.2.5'
|
26
23
|
spec.add_runtime_dependency 'json', '~> 1.8', '>= 1.8.3'
|
27
24
|
end
|
metadata
CHANGED
@@ -1,63 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_rest_vote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- satendra02
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.11'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.11'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '10.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '10.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rails
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '4.2'
|
48
|
-
- - ">="
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: 4.2.5
|
51
|
-
type: :development
|
52
|
-
prerelease: false
|
53
|
-
version_requirements: !ruby/object:Gem::Requirement
|
54
|
-
requirements:
|
55
|
-
- - "~>"
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: '4.2'
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: 4.2.5
|
61
13
|
- !ruby/object:Gem::Dependency
|
62
14
|
name: json
|
63
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,9 +52,6 @@ files:
|
|
100
52
|
- lib/rails_rest_vote.rb
|
101
53
|
- lib/rails_rest_vote/engine.rb
|
102
54
|
- lib/rails_rest_vote/version.rb
|
103
|
-
- rails_rest_vote-0.1.0.gem
|
104
|
-
- rails_rest_vote-0.1.1.gem
|
105
|
-
- rails_rest_vote-0.1.2.gem
|
106
55
|
- rails_rest_vote.gemspec
|
107
56
|
homepage: https://github.com/tixdo/rails_rest_vote
|
108
57
|
licenses:
|
data/rails_rest_vote-0.1.0.gem
DELETED
Binary file
|
data/rails_rest_vote-0.1.1.gem
DELETED
Binary file
|
data/rails_rest_vote-0.1.2.gem
DELETED
Binary file
|