ocean-rails 1.24.2 → 1.25.0

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: d4525196be58ed89455e600f44b31119e0b5e0df
4
- data.tar.gz: bae15361c52f1f4bc2f6c86c2d2e69b8d8c52af7
3
+ metadata.gz: d4503764ecbaf7727d17852978ec1bd891d1ad78
4
+ data.tar.gz: f481e468809272a0216791edfa6bacb4e54be380
5
5
  SHA512:
6
- metadata.gz: d55a1efea9d2a2eb5c6297eb281b6d8a140b1b3b17fb1074ebc2ab7e2ea21977402ef247c005e4127edd92b654316484db7c63001e44541af92e1e83a0d4abb7
7
- data.tar.gz: 017211f771c5d2c524ba0989b5506eb3a98cdcf013e4334ed79c0531c4be58ae34dd8153ab6d18427e21399b2c51ecfa0de7fafc1ce0ec2cd76bc6fadcb0e536
6
+ metadata.gz: 1e193a45bec1a86983317add48766a50eb6f5d5bdcdbdf419107fcd8132020416cbf7bb7be20f5157a264becc84b4b4dc9175f29a4c0f992924dcd054a4196cb
7
+ data.tar.gz: 12dd83d6db363cd40df5b6baea61385c669e028e9993682d44d962fdb5700f96bc7a9fcdebf6741f739c7bcc08157130a3f077ec419935ced42286cbc6e325f4
@@ -1,6 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem "ocean-rails", git: "git://github.com/OceanDev/ocean-rails.git"
3
+ gem "ocean-rails", "~> 1.0"
4
+
4
5
  gem "rails", "~> 4.0"
5
6
  gem "mysql2"
6
7
  gem "foreigner"
@@ -1,6 +1,7 @@
1
1
  require 'simplecov'
2
2
  SimpleCov.start do
3
3
  add_filter "/vendor/"
4
+ add_filter "/spec/support/hyperlinks.rb"
4
5
  end
5
6
 
6
7
  # This file is copied to spec/ when you run 'rails generate rspec:install'
@@ -47,7 +47,17 @@ module ApiResource
47
47
  def collection_internal(conds={}, group, search, page, page_size)
48
48
  if index_only != []
49
49
  new_conds = {}
50
- index_only.each { |key| new_conds[key] = conds[key] if conds[key].present? }
50
+ ranges = {}
51
+ index_only.each do |key|
52
+ val = conds[key]
53
+ next if val.blank?
54
+ if ranged_matchers.include?(key) && val.include?(",")
55
+ from, to = val.split(",")
56
+ new_conds[key] = DateTime.parse(from)..DateTime.parse(to)
57
+ else
58
+ new_conds[key] = val
59
+ end
60
+ end
51
61
  conds = new_conds
52
62
  end
53
63
  # Fold in the conditions
@@ -35,7 +35,8 @@ module Ocean
35
35
  # enumerating the Varnish +BAN+ HTTP request URI suffixes to use to invalidate a
36
36
  # collection of resources.
37
37
  #
38
- def ocean_resource_model(index: [:name],
38
+ def ocean_resource_model(index: [:name],
39
+ ranged: [],
39
40
  search: :description,
40
41
  page_size: 25,
41
42
  invalidate_member: INVALIDATE_MEMBER_DEFAULT,
@@ -43,11 +44,13 @@ module Ocean
43
44
  )
44
45
  include ApiResource
45
46
  cattr_accessor :index_only
47
+ cattr_accessor :ranged_matchers
46
48
  cattr_accessor :index_search_property
47
49
  cattr_accessor :collection_page_size
48
50
  cattr_accessor :varnish_invalidate_member
49
51
  cattr_accessor :varnish_invalidate_collection
50
52
  self.index_only = index
53
+ self.ranged_matchers = ranged
51
54
  self.index_search_property = search
52
55
  self.collection_page_size = page_size
53
56
  self.varnish_invalidate_member = invalidate_member
data/lib/ocean/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ocean
2
- VERSION = "1.24.2"
2
+ VERSION = "1.25.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.24.2
4
+ version: 1.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Bengtson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-29 00:00:00.000000000 Z
11
+ date: 2013-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday