serviceable 0.6.4 → 0.7

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.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +4 -0
  3. data/lib/serviceable.rb +9 -9
  4. metadata +26 -44
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 70138358467523e5577760dafd8a00e422fc3756
4
+ data.tar.gz: 133476cc816bb8aeff19bda7ea8fbf45852fb698
5
+ SHA512:
6
+ metadata.gz: d1d4b217885311a1c4882e3972b26ecdbf540cca6c8557b68fe4b6c6accdf68e6c6ee54aa01e324badb19dbbbe938c7a1476168d1795c04ef6b6e00e6441e414
7
+ data.tar.gz: 9ede21492c06a3ed9162fdaaec55c66e29588babd0809d826c7675925b97d6c785c4d6de1ef62ccebb3ab430d944ca979694658428dc1ab7002f4916a691533c
data/README.md CHANGED
@@ -4,6 +4,10 @@ Serviceable aims to reduce code duplication for common patterns, such as JSON/XM
4
4
  API endpoints. Instead of repeating the same patterns in multiple controllers and
5
5
  trying to maintain that over time, we extracted those patterns into a module.
6
6
 
7
+ Configuration:
8
+
9
+ gem 'serviceable'
10
+
7
11
  Controller:
8
12
 
9
13
  class PostsController < ApplicationController
@@ -24,12 +24,12 @@ module Serviceable
24
24
  #
25
25
  def acts_as_service(object,defaults={})
26
26
 
27
- before_filter :assign_new_instance, only: :create
28
- before_filter :did_assign_new_instance, only: :create
29
- before_filter :assign_existing_instance, only: [ :show, :update, :destroy ]
30
- before_filter :did_assign_existing_instance, only: [ :show, :update ]
31
- before_filter :assign_collection, only: [ :index, :count ]
32
- before_filter :did_assign_collection, only: [ :index, :count ]
27
+ before_action :assign_new_instance, only: :create
28
+ before_action :did_assign_new_instance, only: :create
29
+ before_action :assign_existing_instance, only: [ :show, :update, :destroy ]
30
+ before_action :did_assign_existing_instance, only: [ :show, :update ]
31
+ before_action :assign_collection, only: [ :index, :count ]
32
+ before_action :did_assign_collection, only: [ :index, :count ]
33
33
 
34
34
  define_method("index") do
35
35
  respond_to do |format|
@@ -161,7 +161,7 @@ module Serviceable
161
161
  end
162
162
 
163
163
  define_method("assign_existing_instance") do
164
- @instance = object.to_s.camelize.constantize.scoped
164
+ @instance = object.to_s.camelize.constantize.all
165
165
  if params[:include].kind_of?(Hash)
166
166
  @instance = @instance.includes(params[:include].keys)
167
167
  end
@@ -193,7 +193,7 @@ module Serviceable
193
193
  # where[tags][id][in]=123,234,345 (OR)
194
194
  # where[tags][id]=123&where[tags][id]=234 (AND)
195
195
  define_method("assign_collection") do
196
- @collection = object.to_s.camelize.constantize.scoped
196
+ @collection = object.to_s.camelize.constantize.all
197
197
  if params[:include].kind_of?(Hash)
198
198
  for assoc in params[:include].keys
199
199
  @collection = @collection.includes(assoc.to_sym)
@@ -284,7 +284,7 @@ module Serviceable
284
284
  end
285
285
 
286
286
  define_method("is_time_column?") do |column|
287
- [:timestamp,:datetime].include?(object.to_s.capitalize.constantize.columns.select {|e| e.name==column.to_s}.first.type.to_sym) rescue false
287
+ object.to_s.capitalize.constantize.columns.select {|e| e.name==column.to_s}.first.type == :timestamp rescue false
288
288
  end
289
289
 
290
290
  define_method("is_boolean_column?") do |column|
metadata CHANGED
@@ -1,67 +1,49 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: serviceable
3
- version: !ruby/object:Gem::Version
4
- hash: 15
5
- prerelease:
6
- segments:
7
- - 0
8
- - 6
9
- - 4
10
- version: 0.6.4
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.7'
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Aubrey Goodman
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2013-12-10 00:00:00 Z
11
+ date: 2017-10-22 00:00:00.000000000 Z
19
12
  dependencies: []
20
-
21
- description: Decorate your controller classes with acts_as_service :model_name, and instantly support JSON/XML CRUD interface. Allow client to specify response contents using query string filter parameters.
13
+ description: Decorate your controller classes with acts_as_service :model_name, and
14
+ instantly support JSON/XML CRUD interface. Allow client to specify response contents
15
+ using query string filter parameters.
22
16
  email: aubrey.goodman@gmail.com
23
17
  executables: []
24
-
25
18
  extensions: []
26
-
27
19
  extra_rdoc_files: []
28
-
29
- files:
30
- - lib/serviceable.rb
20
+ files:
31
21
  - LICENSE
32
22
  - README.md
33
- homepage: https://github.com/verifip/serviceable
34
- licenses:
23
+ - lib/serviceable.rb
24
+ homepage: https://github.com/agoodman/serviceable
25
+ licenses:
35
26
  - MIT
27
+ metadata: {}
36
28
  post_install_message:
37
29
  rdoc_options: []
38
-
39
- require_paths:
30
+ require_paths:
40
31
  - lib
41
- required_ruby_version: !ruby/object:Gem::Requirement
42
- none: false
43
- requirements:
32
+ required_ruby_version: !ruby/object:Gem::Requirement
33
+ requirements:
44
34
  - - ">="
45
- - !ruby/object:Gem::Version
46
- hash: 3
47
- segments:
48
- - 0
49
- version: "0"
50
- required_rubygems_version: !ruby/object:Gem::Requirement
51
- none: false
52
- requirements:
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ requirements:
53
39
  - - ">="
54
- - !ruby/object:Gem::Version
55
- hash: 3
56
- segments:
57
- - 0
58
- version: "0"
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
59
42
  requirements: []
60
-
61
43
  rubyforge_project:
62
- rubygems_version: 1.8.24
44
+ rubygems_version: 2.6.14
63
45
  signing_key:
64
- specification_version: 3
65
- summary: Standardized Rails web services with design-time configuration and query string filtering support
46
+ specification_version: 4
47
+ summary: Standardized Rails web services with design-time configuration and query
48
+ string filtering support
66
49
  test_files: []
67
-