infopark_webcrm_sdk 1.0.0.rc3 → 1.0.0.rc4
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.
- checksums.yaml +4 -4
- data/lib/crm.rb +4 -5
- data/lib/crm/core/search_configurator.rb +10 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64908fdd68af3338ba419a21d2240224992e5595
|
4
|
+
data.tar.gz: 5d51b9504f1d45a08d99537031cfdd337270e46d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfe2593e28bf610bf7d647f1009e73ef3bc28d8ec8f8bf351345f5ce5d65d04deb90c8e17096f72156ea7fa3413bf947a4fa49a1f7755c00dbaff85313a44f65
|
7
|
+
data.tar.gz: 1a959b2ccbca3532e7e43cf056d43cf099361bbc77e35d38e26162516f146e93b701e4f7936c31eb73b4bb58e3c729cfcf18ada68058a9b75b4209d780df1e75
|
data/lib/crm.rb
CHANGED
@@ -77,7 +77,7 @@ module Crm
|
|
77
77
|
# * {Crm::Mailing Mailing}
|
78
78
|
# @example
|
79
79
|
# Crm.search([{field: 'last_name', condition: 'equals', value: 'Johnson'}])
|
80
|
-
# # => Crm::Core::ItemEnumerator with
|
80
|
+
# # => Crm::Core::ItemEnumerator with all contacts with last name Johnson.
|
81
81
|
#
|
82
82
|
# Crm.search(
|
83
83
|
# [
|
@@ -98,7 +98,7 @@ module Crm
|
|
98
98
|
# The search term of a full-text search for words starting with the term
|
99
99
|
# (case-insensitive prefix search). Affects score.
|
100
100
|
# @param limit [Fixnum] The number of results to return at most. Minimum: +0+.
|
101
|
-
# Use +:none+ to specify no limit. Default:
|
101
|
+
# Use +:none+ to specify no limit. Default: +:none+.
|
102
102
|
# @param offset [Fixnum] The number of results to skip. Minimum: +0+. Default: +0+.
|
103
103
|
# @param sort_by [String] The name of the attribute by which the result is to be sorted:
|
104
104
|
# * +base_type+
|
@@ -116,11 +116,10 @@ module Crm
|
|
116
116
|
# @return [Crm::Core::ItemEnumerator]
|
117
117
|
# An {Crm::Core::ItemEnumerator enumerator} to iterate over the found items.
|
118
118
|
# @api public
|
119
|
-
def self.search(filters: nil, query: nil, limit:
|
119
|
+
def self.search(filters: nil, query: nil, limit: :none, offset: 0, sort_by: nil,
|
120
120
|
sort_order: nil, include_deleted: nil)
|
121
121
|
server_limit = 100
|
122
|
-
limit
|
123
|
-
limit = Float::INFINITY if limit == :none
|
122
|
+
limit = Float::INFINITY if limit.nil? || limit == :none
|
124
123
|
offset ||= 0
|
125
124
|
|
126
125
|
ids = []
|
@@ -21,8 +21,7 @@ module Crm; module Core
|
|
21
21
|
#
|
22
22
|
# @example Unlimited search results
|
23
23
|
# search_config = Crm::Contact.
|
24
|
-
# where('last_name', 'equals', 'Johnson')
|
25
|
-
# unlimited
|
24
|
+
# where('last_name', 'equals', 'Johnson')
|
26
25
|
# # => Crm::Core::SearchConfigurator
|
27
26
|
#
|
28
27
|
# results = search_config.perform_search
|
@@ -195,6 +194,15 @@ module Crm; module Core
|
|
195
194
|
perform_search.each(&block)
|
196
195
|
end
|
197
196
|
|
197
|
+
def take(n)
|
198
|
+
limit(n).perform_search.to_a
|
199
|
+
end
|
200
|
+
|
201
|
+
def first(n = :undefined)
|
202
|
+
return take(n) unless n == :undefined
|
203
|
+
limit(1).perform_search.first
|
204
|
+
end
|
205
|
+
|
198
206
|
# Returns the total number of items that match this search configuration.
|
199
207
|
# It can be greater than +limit+.
|
200
208
|
# Implicitly triggers {#perform_search} and caches its result.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infopark_webcrm_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Infopark AG
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|