contacts_client 0.0.38 → 0.0.40

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWMzMWRiYzQzYjNlYzFkOGIwMDQ2NTkzNjc2YTM1OGQwNDYxNTQ3YQ==
4
+ ZTgxYjk4ODM5MDhlNDc3ODRhNDYyZmYwYTU4NGY4OWQ1ZWEyZTBhZQ==
5
5
  data.tar.gz: !binary |-
6
- YWFlZmIyMmFlNWM4NmVlYjE5MDM4NjBiOGJkZGVmZjJjNDExOGQ2Yg==
6
+ MGI5MjA1Mjg1NzlkNTBlZmEwMzYzNzA3Y2JmNjNhOTJlOTAyYzUyMQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Njg3YzgwMzE5OWJkNzVlYjU1ZGI4Y2QxMTU1ZGYzMTYxOTdlMGE2MGQ1NjY5
10
- MmFiZTBkZWNhOTBhMmY0MjBjNmM0Y2ZkYWM5ZWZjMWU0Y2E2MzE3NzY4ZTY0
11
- MWFkY2JhNTI5OTRiYzFlODRiM2UyOGU3MTZjMDQ1NDNhMjVjNmE=
9
+ MGE2NjU0Y2ZiMzlkNjk0MDNhODhiNWQzZTdkNjlkZmRmMDg3ZTcwZWMzZTU1
10
+ ZjJlMDRiNGY3ZDg4NGYzMzc2Y2JlMGQ3NTNiZDg4NjdjM2NiY2NhYTYwZWY1
11
+ NDAxM2EzZWYwMzE5NzEzOTg1YzhjNjcxN2I4MTFlNGVhYWVjYzE=
12
12
  data.tar.gz: !binary |-
13
- MDhhYjM5ZWNlY2VlYzcyZTFlNzYxMjg4NWI3Y2YzNmE2ZTFkMzlkYzVlNTZj
14
- MTAzYjcwYjRmMDI3YWU4MTMwNDVmNmE4ZDA2Yzg3ZmNlZWMzNzUzNDcyYmJk
15
- ZWVhYTZmNDA4ODFmYzExMDkwNmI3ZjhhMjJmMDliNzVlMDM3N2I=
13
+ NzE2ZmU5YjU5ODhmNjYyYzg1NDhmODEyYjc2NzA5ZDY1NWVkN2E0MDg3YmE1
14
+ YjFiNWNiODhlNmRiM2MyMzhjYTBhMTZlM2QyZGViOWIyYTkzOGI4ODc4ZTg1
15
+ NmVkOTNkYmUwOWRhNjMzNzRjZGQ0ZmI4M2Y3MWZiZjlkYWY2NGY=
@@ -4,6 +4,7 @@ module BelongsToContact
4
4
 
5
5
  def self.included(base)
6
6
  base.send(:validate, :padma_contact_setted_correctly)
7
+ base.extend ClassMethods
7
8
  end
8
9
 
9
10
  attr_accessor :padma_contact
@@ -27,6 +28,17 @@ module BelongsToContact
27
28
  ret
28
29
  end
29
30
 
31
+ module ClassMethods
32
+ def prefetch_contacts_for_collection(collection,ws_options={})
33
+ contact_ids = collection.map(&:contact_id).uniq
34
+ ws_options = ws_options.merge({ids: contact_ids, per_page: contact_ids.size})
35
+ contacts = PadmaContact.search(ws_options)
36
+ if contacts
37
+ collection.each{|i| i.padma_contact= contacts.select{|c|c.id==i.contact_id}.first }
38
+ end
39
+ end
40
+ end
41
+
30
42
  private
31
43
 
32
44
  # If padma_contact is setted with a PadmaContact that doesn't match
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contacts_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.38
4
+ version: 0.0.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dwayne Macgowan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-08 00:00:00.000000000 Z
11
+ date: 2015-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties