civicrm 1.0.6 → 1.0.7

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: 7cfa1149476a5896453ceb5b9a1338e8086179c8
4
- data.tar.gz: f816b49e711481291aa6f747b7cf073108e580c2
3
+ metadata.gz: 20c5b696021decdd86453e689e74c3b25ce7dc97
4
+ data.tar.gz: 26a68e62ff042a11fcb357e1d27b1ca3b1f676fc
5
5
  SHA512:
6
- metadata.gz: 722be9f5dc41b116331dad7d1d198141d210176e47c457aaec892b994d08b90156204978acc93d90e633c336c8f1e05a05e08d72ea66e7d5451115c0080af061
7
- data.tar.gz: 51764fa77039ef8e06f3b0e85be14976ae4c96df8dce4c052f44d60e4a280d69bcb50b03551ee087e50583fa781406503057fb1f9bb130fd82c069110eeae4e1
6
+ metadata.gz: 31e521a4bef9f022793a1196e8801be59f8f2a54eb36185b92f0732a26524b51a1327c45ccacb3bba9cc421750af730e8b5fe5cc8340a1d390f52893feb54caf
7
+ data.tar.gz: 0620007e2f86085cefebce9e12dfe9fa3de221d2e69765dd4f2584eab440ee5b9b5af945f7620e1b459b4f1d741a0e288dad8d8e83384dd882278f10cf5d8a76
@@ -9,6 +9,7 @@ require 'nokogiri'
9
9
  require 'civicrm/client'
10
10
  require 'civicrm/xml'
11
11
  require 'civicrm/resource'
12
+ require 'civicrm/profiling'
12
13
  require 'civicrm/version'
13
14
 
14
15
  # actions
@@ -27,6 +28,8 @@ require 'civicrm/resources/base'
27
28
  module CiviCrm
28
29
  Error = Class.new(Exception)
29
30
 
31
+ include Profiling
32
+
30
33
  @@api_key = nil
31
34
  @@site_key = nil
32
35
  @@api_base = 'https://www.example.org/path/to/civi/codebase'
@@ -24,8 +24,14 @@ module CiviCrm
24
24
  else
25
25
  opts[:payload] = stringify_params(params)
26
26
  end
27
+
27
28
  opts[:url] = CiviCrm.api_url(path)
28
- response = execute(opts)
29
+
30
+ response = nil
31
+
32
+ CiviCrm.time(params['entity'], params['action']) do
33
+ response = execute(opts)
34
+ end
29
35
 
30
36
  puts(JSON.dump(params)) if ENV["DEBUG_CIVICRM_REQUEST"]
31
37
  puts(response) if ENV["DEBUG_CIVICRM_RESPONSE"]
@@ -0,0 +1,31 @@
1
+ module CiviCrm
2
+ module Profiling
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ private
7
+
8
+ mattr_accessor :_profile
9
+ end
10
+
11
+ module ClassMethods
12
+ def profile(&block)
13
+ self._profile = []
14
+
15
+ block.call
16
+
17
+ _profile.dup
18
+ ensure
19
+ self._profile = nil
20
+ end
21
+
22
+ def time(entity, action, &block)
23
+ time = Benchmark.realtime(&block)
24
+
25
+ if _profile
26
+ _profile << [entity, action, time]
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,3 @@
1
1
  module CiviCrm
2
- VERSION = '1.0.6'
2
+ VERSION = '1.0.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: civicrm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iskander Haziev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-31 00:00:00.000000000 Z
11
+ date: 2018-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -136,6 +136,7 @@ files:
136
136
  - lib/civicrm/actions/update.rb
137
137
  - lib/civicrm/client.rb
138
138
  - lib/civicrm/errors.rb
139
+ - lib/civicrm/profiling.rb
139
140
  - lib/civicrm/resource.rb
140
141
  - lib/civicrm/resources/base.rb
141
142
  - lib/civicrm/version.rb