infopark_webcrm_sdk 1.0.0.rc3 → 1.0.0.rc4

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: 8a561b393abf924121d1a9ce529a41e0ae3755cf
4
- data.tar.gz: dfdf43bd6251ff9f7efbce8a690e0f19a949544a
3
+ metadata.gz: 64908fdd68af3338ba419a21d2240224992e5595
4
+ data.tar.gz: 5d51b9504f1d45a08d99537031cfdd337270e46d
5
5
  SHA512:
6
- metadata.gz: 56115b0bb466632f59dc5f260636f138c50438ea36d019465fdbfdf747f720d1cc8628870961ed9b643858ebbee72ce55885afadc2be42943eb81c5b70ec186c
7
- data.tar.gz: 8e0269de6a93d2a2eb00b1aa9b5587569d7b411c71cd1c7a0644ae4ec738c08941358702f9257a1ba2415826a0e9cbf65c105ca3e785a51e7b0fe082433d6a19
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 max 10 contacts with last name Johnson.
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: +10+.
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: nil, offset: nil, sort_by: nil,
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 ||= 10
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.rc3
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-03-27 00:00:00.000000000 Z
11
+ date: 2015-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack