thumbsy 1.0.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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +299 -0
- data/Rakefile +24 -0
- data/config/database.yml +47 -0
- data/lib/generators/thumbsy/api_generator.rb +59 -0
- data/lib/generators/thumbsy/install_generator.rb +53 -0
- data/lib/generators/thumbsy/templates/README +56 -0
- data/lib/generators/thumbsy/templates/create_thumbsy_votes.rb +20 -0
- data/lib/generators/thumbsy/templates/thumbsy.rb +24 -0
- data/lib/generators/thumbsy/templates/thumbsy_api.rb +75 -0
- data/lib/thumbsy/api/configuration.rb +19 -0
- data/lib/thumbsy/api/controllers/application_controller.rb +70 -0
- data/lib/thumbsy/api/controllers/votes_controller.rb +135 -0
- data/lib/thumbsy/api/engine.rb +14 -0
- data/lib/thumbsy/api/routes.rb +26 -0
- data/lib/thumbsy/api/serializers/vote_serializer.rb +36 -0
- data/lib/thumbsy/api.rb +57 -0
- data/lib/thumbsy/configuration.rb +24 -0
- data/lib/thumbsy/engine.rb +20 -0
- data/lib/thumbsy/extension.rb +13 -0
- data/lib/thumbsy/models/thumbsy_vote.rb +75 -0
- data/lib/thumbsy/validators/array_inclusion_validator.rb +20 -0
- data/lib/thumbsy/version.rb +5 -0
- data/lib/thumbsy/votable.rb +82 -0
- data/lib/thumbsy/voter.rb +65 -0
- data/lib/thumbsy.rb +58 -0
- metadata +125 -0
data/lib/thumbsy.rb
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "thumbsy/version"
|
|
4
|
+
require "thumbsy/extension"
|
|
5
|
+
require "thumbsy/engine"
|
|
6
|
+
require "thumbsy/votable"
|
|
7
|
+
require "thumbsy/voter"
|
|
8
|
+
require "thumbsy/configuration"
|
|
9
|
+
require "thumbsy/api/configuration"
|
|
10
|
+
|
|
11
|
+
module Thumbsy
|
|
12
|
+
class << self
|
|
13
|
+
attr_accessor :config
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.configure
|
|
17
|
+
self.config ||= Configuration.new
|
|
18
|
+
yield(config)
|
|
19
|
+
# Ensure feedback_options validation is set up after configuration
|
|
20
|
+
return unless defined?(ThumbsyVote) && config.feedback_options.present?
|
|
21
|
+
|
|
22
|
+
ThumbsyVote.setup_feedback_options_validation!
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def self.feedback_options
|
|
26
|
+
config&.feedback_options
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self.feedback_options=(options)
|
|
30
|
+
self.config ||= Configuration.new
|
|
31
|
+
config.feedback_options = options
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def self.api_config
|
|
35
|
+
config&.api_config
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Load API functionality (optional)
|
|
39
|
+
def self.load_api!
|
|
40
|
+
require "thumbsy/api" unless defined?(Thumbsy::Api)
|
|
41
|
+
Thumbsy::Api.load!
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Autoload API module when accessed
|
|
45
|
+
def self.const_missing(name)
|
|
46
|
+
if name == :Api
|
|
47
|
+
require "thumbsy/api"
|
|
48
|
+
const_get(name)
|
|
49
|
+
else
|
|
50
|
+
super
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Extend ActiveRecord when available (fallback if Rails engine doesn't load)
|
|
56
|
+
ActiveRecord::Base.extend(Thumbsy::Extension) if defined?(ActiveRecord::Base) && !defined?(Thumbsy::Engine)
|
|
57
|
+
|
|
58
|
+
require_relative "thumbsy/models/thumbsy_vote"
|
metadata
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: thumbsy
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- HealthsHive
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2025-08-29 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: rails
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '7.0'
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '9.0'
|
|
23
|
+
type: :runtime
|
|
24
|
+
prerelease: false
|
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
26
|
+
requirements:
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '7.0'
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '9.0'
|
|
33
|
+
- !ruby/object:Gem::Dependency
|
|
34
|
+
name: rack-test
|
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '2.0'
|
|
40
|
+
type: :development
|
|
41
|
+
prerelease: false
|
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - "~>"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '2.0'
|
|
47
|
+
- !ruby/object:Gem::Dependency
|
|
48
|
+
name: rspec-rails
|
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '6.0'
|
|
54
|
+
type: :development
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - "~>"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '6.0'
|
|
61
|
+
description: Thumbsy provides an easy way to add thumbs up/down or like/dislike functionality
|
|
62
|
+
to your Rails models with comments support
|
|
63
|
+
email:
|
|
64
|
+
- development@healthhive.org
|
|
65
|
+
executables: []
|
|
66
|
+
extensions: []
|
|
67
|
+
extra_rdoc_files: []
|
|
68
|
+
files:
|
|
69
|
+
- MIT-LICENSE
|
|
70
|
+
- README.md
|
|
71
|
+
- Rakefile
|
|
72
|
+
- config/database.yml
|
|
73
|
+
- lib/generators/thumbsy/api_generator.rb
|
|
74
|
+
- lib/generators/thumbsy/install_generator.rb
|
|
75
|
+
- lib/generators/thumbsy/templates/README
|
|
76
|
+
- lib/generators/thumbsy/templates/create_thumbsy_votes.rb
|
|
77
|
+
- lib/generators/thumbsy/templates/thumbsy.rb
|
|
78
|
+
- lib/generators/thumbsy/templates/thumbsy_api.rb
|
|
79
|
+
- lib/thumbsy.rb
|
|
80
|
+
- lib/thumbsy/api.rb
|
|
81
|
+
- lib/thumbsy/api/configuration.rb
|
|
82
|
+
- lib/thumbsy/api/controllers/application_controller.rb
|
|
83
|
+
- lib/thumbsy/api/controllers/votes_controller.rb
|
|
84
|
+
- lib/thumbsy/api/engine.rb
|
|
85
|
+
- lib/thumbsy/api/routes.rb
|
|
86
|
+
- lib/thumbsy/api/serializers/vote_serializer.rb
|
|
87
|
+
- lib/thumbsy/configuration.rb
|
|
88
|
+
- lib/thumbsy/engine.rb
|
|
89
|
+
- lib/thumbsy/extension.rb
|
|
90
|
+
- lib/thumbsy/models/thumbsy_vote.rb
|
|
91
|
+
- lib/thumbsy/validators/array_inclusion_validator.rb
|
|
92
|
+
- lib/thumbsy/version.rb
|
|
93
|
+
- lib/thumbsy/votable.rb
|
|
94
|
+
- lib/thumbsy/voter.rb
|
|
95
|
+
homepage: https://github.com/healthhive/thumbsy
|
|
96
|
+
licenses:
|
|
97
|
+
- MIT
|
|
98
|
+
metadata:
|
|
99
|
+
allowed_push_host: https://rubygems.org
|
|
100
|
+
homepage_uri: https://github.com/healthhive/thumbsy
|
|
101
|
+
source_code_uri: https://github.com/healthhive/thumbsy.git
|
|
102
|
+
changelog_uri: https://github.com/healthhive/thumbsy/blob/main/docs/changelog.md
|
|
103
|
+
documentation_uri: https://github.com/healthhive/thumbsy/blob/main/docs/api-guide.md
|
|
104
|
+
bug_tracker_uri: https://github.com/healthhive/thumbsy/issues
|
|
105
|
+
rubygems_mfa_required: 'true'
|
|
106
|
+
post_install_message:
|
|
107
|
+
rdoc_options: []
|
|
108
|
+
require_paths:
|
|
109
|
+
- lib
|
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
|
+
requirements:
|
|
112
|
+
- - ">="
|
|
113
|
+
- !ruby/object:Gem::Version
|
|
114
|
+
version: 3.3.0
|
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
|
+
requirements:
|
|
117
|
+
- - ">="
|
|
118
|
+
- !ruby/object:Gem::Version
|
|
119
|
+
version: '0'
|
|
120
|
+
requirements: []
|
|
121
|
+
rubygems_version: 3.5.3
|
|
122
|
+
signing_key:
|
|
123
|
+
specification_version: 4
|
|
124
|
+
summary: A Rails gem for adding voting/liking functionality to ActiveRecord models
|
|
125
|
+
test_files: []
|