ocean-rails 1.26.0 → 1.26.1

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
  SHA1:
3
- metadata.gz: ed17df413aa988bc3f8fb0657bb64a0badd3e867
4
- data.tar.gz: 8d343d76ebad720f9f6848a7dcc8e7ab5ce1df37
3
+ metadata.gz: d5185b58e21da14504bb65ab1c314b0def4ebb39
4
+ data.tar.gz: 4df08ec09d8d7c3549d5ed049b43d0a83848a8c2
5
5
  SHA512:
6
- metadata.gz: 6908a52cc7d59b1925efe758f886625c24061fb0d72b7ffd7731e1e2f6020681380aba8bdc7935aa66b58a726a588d77fa6f42fcbd3aca222b09c43f3b532785
7
- data.tar.gz: cfe17eb55a1e0d8b03defc0017c5d61edc69e08243e8cd8044ea05420784ce8a04d155eb1c90de0d1f3b4d27ad0ac331722112dc879c9be905df1d4cda65b064
6
+ metadata.gz: e27b2ae036163701a0ee86a96171aa388bf831314dd227de5013f210eb37739ece6f6f86c597444283980b37fc926c60a1b06d7e49e16ac14d0b5cd25771ca9e
7
+ data.tar.gz: 7374426c6bbc58f67a6bd4ea0983b810db76b13b32c771acd7df36c12a96fb67e7c57fe950064510a6153418ba92ac0265ee6083fb3ade21df560dad4872fe06
@@ -24,7 +24,8 @@ module ApiResource
24
24
  #
25
25
  # The whole params hash can safely be passed as the input arg: keys are filtered so
26
26
  # that matches only are done against the attributes declared in the controller using
27
- # +ocean_resource_model+.
27
+ # +ocean_resource_model+. Ranges are allowed for those attributes declared to accept
28
+ # them using the +ranged+ parameter of +ocean_resource_model+.
28
29
  #
29
30
  # The +group:+ keyword arg, if present, adds a +GROUP+ clause to the generated SQL.
30
31
  #
@@ -44,6 +45,8 @@ module ApiResource
44
45
  end
45
46
 
46
47
 
48
+ private
49
+
47
50
  def collection_internal(conds={}, group, search, page, page_size)
48
51
  if index_only != []
49
52
  new_conds = {}
@@ -88,9 +91,9 @@ module ApiResource
88
91
  case val
89
92
  when ""
90
93
  ""
91
- when val.to_i.to_s == val
94
+ when /^[+-][0-9]+$/
92
95
  val.to_i
93
- when val.to_f.to_s == val
96
+ when /^[+-]([0-9]*\.[0-9]+|[0-9]+\.[0-9]*)$/
94
97
  val.to_f
95
98
  when /[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z/
96
99
  DateTime.parse(val)
@@ -100,6 +103,8 @@ module ApiResource
100
103
  end
101
104
 
102
105
 
106
+ public
107
+
103
108
  #
104
109
  # Returns the latest version for the resource class. E.g.:
105
110
  #
@@ -21,6 +21,9 @@ module Ocean
21
21
  # +index+: defaults to <code>[:name]</code>. Enumerates the model attributes which
22
22
  # may be used for parameter matching and grouping.
23
23
  #
24
+ # +ranged+: defaults to <code>[]</code>. An array of attributes which should accept
25
+ # ranges in collection match operations.
26
+ #
24
27
  # +search+: defaults to +:description+. Names the model attribute used for substring
25
28
  # searches. The attribute must be a string or text attribute.
26
29
  #
data/lib/ocean/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ocean
2
- VERSION = "1.26.0"
2
+ VERSION = "1.26.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.26.0
4
+ version: 1.26.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Bengtson
@@ -323,7 +323,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
323
323
  version: '0'
324
324
  requirements: []
325
325
  rubyforge_project:
326
- rubygems_version: 2.0.7
326
+ rubygems_version: 2.1.10
327
327
  signing_key:
328
328
  specification_version: 4
329
329
  summary: This gem implements common Ocean behaviour for Ruby and Ruby on Rails.