rest_framework 0.3.3 → 0.3.7

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: 3c2cd61ac79fb24303888d0595f53816562ee4377703dca5e6e43842db66153d
4
- data.tar.gz: 195627f1816895b657b1e796ffb81d70781c009aa8f7266cda8a7b28cde33bc2
3
+ metadata.gz: dfa62b5fb49a4c30fabee7308e785d495f244b8aec21be6d5fc99bf0f2f8a3aa
4
+ data.tar.gz: 65e70b6fd5eb3b1d06d54da6044035f1ca418f440b666e81bc7fee7d89ff0e7b
5
5
  SHA512:
6
- metadata.gz: f3dac5f9515f8797c3d2789ccdbc2e623bafa18124b81999c1959884f14449315c574c88ff7ecdfc8766b4816067b188634d381ee2e00b9e1eff91b71a347f6f
7
- data.tar.gz: c883ab665f21b36d7d6838ef154eec4cd2072505fc1a21626e9b56f3a4287a5d85aa5fc090d4e780259ddfe77b4993db7e44157c7aac673138f5deb24a1c438b
6
+ metadata.gz: 2e92adef73b6fe78b9381480015c950b20e8a14e91a49f24b655e4f58a7ba1870e4d7d5b33a1983be514e50215a6c1a8e2197e1008faf4eae4b2da16072ddde0
7
+ data.tar.gz: 27bc294410be0d235db8fccd20bc48b013a9814a0ac3b26fc01f5f7f46905738f6a65dd3fcdf4d54946b70cdeb9eb11c60b33139b169bd83ff8d4cbad76aaf60
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2020 Gregory N. Schmit
3
+ Copyright (c) 2021 Gregory N. Schmit
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Rails REST Framework
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/rest_framework.svg)](https://badge.fury.io/rb/rest_framework)
4
- [![Build Status](https://travis-ci.org/gregschmit/rails-rest-framework.svg?branch=master)](https://travis-ci.org/gregschmit/rails-rest-framework)
4
+ [![Build Status](https://travis-ci.com/gregschmit/rails-rest-framework.svg?branch=master)](https://travis-ci.com/gregschmit/rails-rest-framework)
5
5
  [![Coverage Status](https://coveralls.io/repos/github/gregschmit/rails-rest-framework/badge.svg?branch=master)](https://coveralls.io/github/gregschmit/rails-rest-framework?branch=master)
6
6
  [![Maintainability](https://api.codeclimate.com/v1/badges/ba5df7706cb544d78555/maintainability)](https://codeclimate.com/github/gregschmit/rails-rest-framework/maintainability)
7
7
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.3
1
+ 0.3.7
@@ -40,7 +40,7 @@ module RESTFramework::BaseModelControllerMixin
40
40
  ordering_no_reorder: false,
41
41
  search_fields: nil,
42
42
  search_query_param: 'search',
43
- search_case_sensitive: false,
43
+ search_ilike: false,
44
44
 
45
45
  # Other misc attributes.
46
46
  create_from_recordset: true, # Option for `recordset.create` vs `Model.create` behavior.
@@ -14,15 +14,3 @@ class RESTFramework::NilPassedToAPIResponseError < RESTFramework::Error
14
14
  MSG
15
15
  end
16
16
  end
17
-
18
-
19
- class RESTFramework::UnserializableError < RESTFramework::Error
20
- def initialize(object)
21
- @object = object
22
- return super
23
- end
24
-
25
- def message
26
- return "Unable to serialize `#{@object.inspect}` (of type `#{@object.class}`)."
27
- end
28
- end
@@ -84,7 +84,7 @@ class RESTFramework::ModelSearchFilter < RESTFramework::BaseFilter
84
84
  # Ensure we use array conditions to prevent SQL injection.
85
85
  unless search.blank?
86
86
  return data.where(fields.map { |f|
87
- "CAST(#{f} AS text) #{@controller.send(:search_case_sensitive) ? "LIKE" : "ILIKE"} ?"
87
+ "CAST(#{f} AS CHAR) #{@controller.send(:search_ilike) ? "ILIKE" : "LIKE"} ?"
88
88
  }.join(' OR '), *(["%#{search}%"] * fields.length))
89
89
  end
90
90
 
@@ -105,18 +105,12 @@ class RESTFramework::NativeSerializer < RESTFramework::BaseSerializer
105
105
 
106
106
  # Convert the object (record or recordset) to Ruby primitives.
107
107
  def serialize
108
- if @object
109
- begin
110
- if @object.is_a?(Enumerable)
111
- return @object.map { |r| r.serializable_hash(self.get_serializer_config) }
112
- end
113
- return @object.serializable_hash(self.get_serializer_config)
114
- rescue NoMethodError
115
- end
116
- end
108
+ raise "No object available to serialize!" unless @object
117
109
 
118
- # Raise an error if we cannot serialize the object.
119
- raise RESTFramework::UnserializableError.new(@object)
110
+ if @object.is_a?(Enumerable)
111
+ return @object.map { |r| r.serializable_hash(self.get_serializer_config) }
112
+ end
113
+ return @object.serializable_hash(self.get_serializer_config)
120
114
  end
121
115
 
122
116
  # Allow a serializer instance to be used as a hash directly in a nested serializer config.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest_framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory N. Schmit
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-07 00:00:00.000000000 Z
11
+ date: 2021-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -56,7 +56,7 @@ licenses:
56
56
  metadata:
57
57
  homepage_uri: https://rails-rest-framework.com
58
58
  source_code_uri: https://github.com/gregschmit/rails-rest-framework
59
- post_install_message:
59
+ post_install_message:
60
60
  rdoc_options: []
61
61
  require_paths:
62
62
  - lib
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  version: '0'
74
74
  requirements: []
75
75
  rubygems_version: 3.1.4
76
- signing_key:
76
+ signing_key:
77
77
  specification_version: 4
78
78
  summary: A framework for DRY RESTful APIs in Ruby on Rails.
79
79
  test_files: []