responders 2.0.0 → 3.1.1
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 +5 -5
- data/CHANGELOG.md +66 -1
- data/MIT-LICENSE +2 -1
- data/README.md +150 -49
- data/lib/action_controller/respond_with.rb +52 -20
- data/lib/action_controller/responder.rb +44 -28
- data/lib/generators/rails/responders_controller_generator.rb +4 -26
- data/lib/generators/rails/templates/api_controller.rb.tt +51 -0
- data/lib/generators/rails/templates/controller.rb.tt +59 -0
- data/lib/generators/responders/install_generator.rb +23 -9
- data/lib/responders/collection_responder.rb +3 -0
- data/lib/responders/controller_method.rb +7 -2
- data/lib/responders/flash_responder.rb +32 -27
- data/lib/responders/http_cache_responder.rb +5 -3
- data/lib/responders/version.rb +3 -1
- data/lib/responders.rb +16 -16
- metadata +32 -57
- data/lib/generators/rails/templates/controller.rb +0 -55
- data/lib/responders/location_responder.rb +0 -8
- data/test/action_controller/respond_with_test.rb +0 -717
- data/test/locales/en.yml +0 -28
- data/test/responders/collection_responder_test.rb +0 -82
- data/test/responders/controller_method_test.rb +0 -72
- data/test/responders/flash_responder_test.rb +0 -260
- data/test/responders/http_cache_responder_test.rb +0 -120
- data/test/test_helper.rb +0 -87
- data/test/views/addresses/create.js.erb +0 -1
- data/test/views/addresses/edit.html.erb +0 -1
- data/test/views/addresses/new.html.erb +0 -1
- data/test/views/locations/new.html.erb +0 -1
- data/test/views/respond_with/edit.html.erb +0 -1
- data/test/views/respond_with/new.html.erb +0 -1
- data/test/views/respond_with/respond_with_additional_params.html.erb +0 -0
- data/test/views/respond_with/using_invalid_resource_with_template.xml.erb +0 -1
- data/test/views/respond_with/using_options_with_template.xml.erb +0 -1
- data/test/views/respond_with/using_resource.js.erb +0 -1
- data/test/views/respond_with/using_resource_with_block.html.erb +0 -1
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: responders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- José Valim
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -16,22 +16,30 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '5'
|
19
|
+
version: '5.2'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
30
|
-
|
26
|
+
version: '5.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: actionpack
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.2'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
31
39
|
- !ruby/object:Gem::Version
|
32
|
-
version: '5'
|
40
|
+
version: '5.2'
|
33
41
|
description: A set of Rails responders to dry up your application
|
34
|
-
email:
|
42
|
+
email: heartcombo@googlegroups.com
|
35
43
|
executables: []
|
36
44
|
extensions: []
|
37
45
|
extra_rdoc_files: []
|
@@ -43,7 +51,8 @@ files:
|
|
43
51
|
- lib/action_controller/responder.rb
|
44
52
|
- lib/generators/rails/USAGE
|
45
53
|
- lib/generators/rails/responders_controller_generator.rb
|
46
|
-
- lib/generators/rails/templates/
|
54
|
+
- lib/generators/rails/templates/api_controller.rb.tt
|
55
|
+
- lib/generators/rails/templates/controller.rb.tt
|
47
56
|
- lib/generators/responders/install_generator.rb
|
48
57
|
- lib/responders.rb
|
49
58
|
- lib/responders/collection_responder.rb
|
@@ -51,31 +60,16 @@ files:
|
|
51
60
|
- lib/responders/flash_responder.rb
|
52
61
|
- lib/responders/http_cache_responder.rb
|
53
62
|
- lib/responders/locales/en.yml
|
54
|
-
- lib/responders/location_responder.rb
|
55
63
|
- lib/responders/version.rb
|
56
|
-
|
57
|
-
- test/locales/en.yml
|
58
|
-
- test/responders/collection_responder_test.rb
|
59
|
-
- test/responders/controller_method_test.rb
|
60
|
-
- test/responders/flash_responder_test.rb
|
61
|
-
- test/responders/http_cache_responder_test.rb
|
62
|
-
- test/test_helper.rb
|
63
|
-
- test/views/addresses/create.js.erb
|
64
|
-
- test/views/addresses/edit.html.erb
|
65
|
-
- test/views/addresses/new.html.erb
|
66
|
-
- test/views/locations/new.html.erb
|
67
|
-
- test/views/respond_with/edit.html.erb
|
68
|
-
- test/views/respond_with/new.html.erb
|
69
|
-
- test/views/respond_with/respond_with_additional_params.html.erb
|
70
|
-
- test/views/respond_with/using_invalid_resource_with_template.xml.erb
|
71
|
-
- test/views/respond_with/using_options_with_template.xml.erb
|
72
|
-
- test/views/respond_with/using_resource.js.erb
|
73
|
-
- test/views/respond_with/using_resource_with_block.html.erb
|
74
|
-
homepage: http://github.com/plataformatec/responders
|
64
|
+
homepage: https://github.com/heartcombo/responders
|
75
65
|
licenses:
|
76
66
|
- MIT
|
77
|
-
metadata:
|
78
|
-
|
67
|
+
metadata:
|
68
|
+
homepage_uri: https://github.com/heartcombo/responders
|
69
|
+
changelog_uri: https://github.com/heartcombo/responders/blob/main/CHANGELOG.md
|
70
|
+
source_code_uri: https://github.com/heartcombo/responders
|
71
|
+
bug_tracker_uri: https://github.com/heartcombo/responders/issues
|
72
|
+
post_install_message:
|
79
73
|
rdoc_options: []
|
80
74
|
require_paths:
|
81
75
|
- lib
|
@@ -83,34 +77,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
83
77
|
requirements:
|
84
78
|
- - ">="
|
85
79
|
- !ruby/object:Gem::Version
|
86
|
-
version:
|
80
|
+
version: 2.5.0
|
87
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
82
|
requirements:
|
89
83
|
- - ">="
|
90
84
|
- !ruby/object:Gem::Version
|
91
85
|
version: '0'
|
92
86
|
requirements: []
|
93
|
-
|
94
|
-
|
95
|
-
signing_key:
|
87
|
+
rubygems_version: 3.4.10
|
88
|
+
signing_key:
|
96
89
|
specification_version: 4
|
97
90
|
summary: A set of Rails responders to dry up your application
|
98
|
-
test_files:
|
99
|
-
- test/action_controller/respond_with_test.rb
|
100
|
-
- test/locales/en.yml
|
101
|
-
- test/responders/collection_responder_test.rb
|
102
|
-
- test/responders/controller_method_test.rb
|
103
|
-
- test/responders/flash_responder_test.rb
|
104
|
-
- test/responders/http_cache_responder_test.rb
|
105
|
-
- test/test_helper.rb
|
106
|
-
- test/views/addresses/create.js.erb
|
107
|
-
- test/views/addresses/edit.html.erb
|
108
|
-
- test/views/addresses/new.html.erb
|
109
|
-
- test/views/locations/new.html.erb
|
110
|
-
- test/views/respond_with/edit.html.erb
|
111
|
-
- test/views/respond_with/new.html.erb
|
112
|
-
- test/views/respond_with/respond_with_additional_params.html.erb
|
113
|
-
- test/views/respond_with/using_invalid_resource_with_template.xml.erb
|
114
|
-
- test/views/respond_with/using_options_with_template.xml.erb
|
115
|
-
- test/views/respond_with/using_resource.js.erb
|
116
|
-
- test/views/respond_with/using_resource_with_block.html.erb
|
91
|
+
test_files: []
|
@@ -1,55 +0,0 @@
|
|
1
|
-
<% module_namespacing do -%>
|
2
|
-
class <%= controller_class_name %>Controller < ApplicationController
|
3
|
-
<%= controller_before_filter %> :set_<%= file_name %>, only: [:show, :edit, :update, :destroy]
|
4
|
-
|
5
|
-
<% unless options[:singleton] -%>
|
6
|
-
def index
|
7
|
-
@<%= table_name %> = <%= orm_class.all(class_name) %>
|
8
|
-
respond_with(@<%= table_name %>)
|
9
|
-
end
|
10
|
-
<% end -%>
|
11
|
-
|
12
|
-
def show
|
13
|
-
respond_with(@<%= file_name %>)
|
14
|
-
end
|
15
|
-
|
16
|
-
def new
|
17
|
-
@<%= file_name %> = <%= orm_class.build(class_name) %>
|
18
|
-
respond_with(@<%= file_name %>)
|
19
|
-
end
|
20
|
-
|
21
|
-
def edit
|
22
|
-
end
|
23
|
-
|
24
|
-
def create
|
25
|
-
@<%= file_name %> = <%= orm_class.build(class_name, attributes_params) %>
|
26
|
-
<%= "flash[:notice] = '#{class_name} was successfully created.' if " if flash? %>@<%= orm_instance.save %>
|
27
|
-
respond_with(@<%= file_name %>)
|
28
|
-
end
|
29
|
-
|
30
|
-
def update
|
31
|
-
<%= "flash[:notice] = '#{class_name} was successfully updated.' if " if flash? %>@<%= orm_instance_update(attributes_params) %>
|
32
|
-
respond_with(@<%= file_name %>)
|
33
|
-
end
|
34
|
-
|
35
|
-
def destroy
|
36
|
-
@<%= orm_instance.destroy %>
|
37
|
-
respond_with(@<%= file_name %>)
|
38
|
-
end
|
39
|
-
|
40
|
-
private
|
41
|
-
def set_<%= file_name %>
|
42
|
-
@<%= file_name %> = <%= orm_class.find(class_name, "params[:id]") %>
|
43
|
-
end
|
44
|
-
<%- if strong_parameters_defined? -%>
|
45
|
-
|
46
|
-
def <%= "#{file_name}_params" %>
|
47
|
-
<%- if attributes_names.empty? -%>
|
48
|
-
params[:<%= file_name %>]
|
49
|
-
<%- else -%>
|
50
|
-
params.require(:<%= file_name %>).permit(<%= attributes_names.map { |name| ":#{name}" }.join(', ') %>)
|
51
|
-
<%- end -%>
|
52
|
-
end
|
53
|
-
<%- end -%>
|
54
|
-
end
|
55
|
-
<% end -%>
|