rao-api-service_controller 0.0.48.pre → 0.0.50.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70f80adb410c0f1ff29509fadc89fd7640d6f9a15937323d05f7a206e48cb571
4
- data.tar.gz: 2242989059f5d778706693a17547ca947af4777457c4940d73063413dddd1dab
3
+ metadata.gz: 74649d98f935a7e11579d9887f5336b5c556014a76100b0509940ac55c53788c
4
+ data.tar.gz: c397cee0abeb568f7ac11f72f476e59dc2758b266fe7c35f31760216fe72e23a
5
5
  SHA512:
6
- metadata.gz: 615752dd389283d25fe4016fd6d9c2b0c7d0d0ef67aa216c186ba89bf1c3916cd9d9638966d7f61cf1186028b47e6dbe45329fba8993f9df8160b64320fa558a
7
- data.tar.gz: b63cec9d9e53b52ab65a142d98157c55abb061a48e943581122069dbfe17f48128d7680e29ce779d95adf9e266745b76f6fa978ed94c072ff1dba2d887edece6
6
+ metadata.gz: 9a71176d64a03efacd13db1e034a1bcb561375a5fd970514d9a0bfb81581f5b298ca3d82f6cefaac589044c8528b269e0481288584c3c82a7259095a265fb146
7
+ data.tar.gz: 0c6dec929476ca1293bf4ce88958df08b37d0fc1ab81332e1c573a8c82e735fd33b3a68bc2bad36eeec40c75051e21b866af27cc0dd2b6124b5a0754b2e94c24
data/README.md CHANGED
@@ -1,10 +1,13 @@
1
1
  # Rao::Api:ServiceController
2
+
2
3
  Short description and motivation.
3
4
 
4
5
  ## Usage
6
+
5
7
  How to use my plugin.
6
8
 
7
9
  ## Installation
10
+
8
11
  Add this line to your application's Gemfile:
9
12
 
10
13
  ```ruby
@@ -12,11 +15,13 @@ gem 'rao-api-service_controller'
12
15
  ```
13
16
 
14
17
  And then execute:
18
+
15
19
  ```bash
16
20
  $ bundle
17
21
  ```
18
22
 
19
23
  Or install it yourself as:
24
+
20
25
  ```bash
21
26
  $ gem install rao-api-service_controller
22
27
  ```
@@ -27,8 +32,30 @@ Generate the initializer:
27
32
  $ rails g rao:api:service_controller:install
28
33
  ```
29
34
 
35
+ ## Customizing the initialization of the service
36
+
37
+ The service is initialized in the initialize_service_for_create method before
38
+ it is called/performed.
39
+
40
+ If you want to do things with the service before it gets called you can override
41
+ this method in you controller:
42
+
43
+ # app/controller/import_services_controller.rb
44
+ class ImportServicesController < ApplicationServicesController
45
+ #...
46
+
47
+ private
48
+
49
+ def initialize_service_for_create
50
+ super
51
+ @service.current_user_id = session['current_user_id']
52
+ end
53
+ end
54
+
30
55
  ## Contributing
56
+
31
57
  Contribution directions go here.
32
58
 
33
59
  ## License
60
+
34
61
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -10,7 +10,7 @@ module Rao
10
10
 
11
11
  rescue_from ActiveRecord::RecordNotFound do |exception|
12
12
  handle_404(exception)
13
- end
13
+ end if Object.const_defined?(:ActiveRecord)
14
14
  end
15
15
 
16
16
  private
@@ -58,8 +58,9 @@ module Rao
58
58
  #
59
59
  # Example:
60
60
  # # app/controller/import_services_controller.rb
61
- # class ImportServices < ApplicationServicesController
61
+ # class ImportServicesController < ApplicationServicesController
62
62
  # #...
63
+ #
63
64
  # private
64
65
  #
65
66
  # def initialize_service_for_create
@@ -80,6 +81,10 @@ module Rao
80
81
  { autosave: true }
81
82
  end
82
83
 
84
+ def params
85
+ super.deep_transform_keys!(&:underscore)
86
+ end
87
+
83
88
  def permitted_params
84
89
  raise "You have to implement permitted_params in #{self.class.name}."
85
90
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rao-api-service_controller
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.48.pre
4
+ version: 0.0.50.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-21 00:00:00.000000000 Z
11
+ date: 2023-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  - !ruby/object:Gem::Version
139
139
  version: 1.3.1
140
140
  requirements: []
141
- rubygems_version: 3.2.24
141
+ rubygems_version: 3.4.20
142
142
  signing_key:
143
143
  specification_version: 4
144
144
  summary: API Services Controller for Ruby on Rails.