civicrm 1.3.6 → 1.3.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
  SHA256:
3
- metadata.gz: b0696639f8699fa3a341b53c3f1539fcdd0dcc39b74b8a7186421716db46e0d0
4
- data.tar.gz: 1db6b2b5c24e4765fbfc05a0062c57d4c42c94b77a3f7a490f717154397c1514
3
+ metadata.gz: 8368cd231e0941132210ff8bf11724816e59242958ac47d458eddb512b93aad4
4
+ data.tar.gz: 8df3d8a938b2b722c8329f2464bcb42b0e153464e1914fc21bc14721c340b707
5
5
  SHA512:
6
- metadata.gz: b76f49391f357998a9be71c0c5bbd4a40e9fb0d2e167bdc9e36ef3a338c2b98b178c12b06f32971891b35c8f94cfce5f5ba6e8e0be895e930aa8c4fbcb894b8e
7
- data.tar.gz: bc4754584c368373964135a58ca7d796a967a0b9c11b137d439c7754e0cad51cecede5079cdb262959181e1d21ef07299698154e33182b16db1fcf306e9d39d8
6
+ metadata.gz: af3a1b5c342f2d22c3da940c958c2e0e926a1097b93b5bf32da901eba25881a066ab65732fab32c77a916eae6b7ec27d49f608f01c9f102f56451a4115a8707d
7
+ data.tar.gz: 71a5213a6e9fcc38c01310b2b9a06987284bb902512c2426113df859e24947d3a038ccdfb598e976b876a7218a40e0697829b177747d7b787ed0697dc4ebb786
data/README.md CHANGED
@@ -13,6 +13,9 @@ $ gem install civicrm
13
13
  CiviCrm.api_base = "https://www.example.org/path/to/civi/codebase/"
14
14
  CiviCrm.site_key = "YOUR_SITE_KEY"
15
15
  CiviCrm.api_key = "..."
16
+
17
+ # Optional config
18
+ CiviCrm.timeout = 60 # Change request timeout in seconds (nil to disable)
16
19
  ```
17
20
 
18
21
  ## CiviCrm Objects
@@ -34,6 +37,27 @@ CiviCrm::Contact.find(1).delete
34
37
  $ bundle exec rspec spec
35
38
  ```
36
39
 
40
+ ## Debugging
41
+
42
+ Set these `ENV` options to a truthy value to print CiviCRM REST API data.
43
+
44
+ ```DEBUG_CIVICRM_REQUEST```
45
+
46
+ Example:
47
+
48
+ ```
49
+ [CiviCRM] [REQ] [FinancialType] [get] {"method":"post","timeout":null,"headers":{"user_agent":"CiviCrm RubyClient/1.3.6","request_id":"8168cbfc-36d1-4967-bf94-8fd72fd48455"},"payload":{"json":"{\"id\":12}"},"url":"..."}
50
+ ```
51
+
52
+ ```DEBUG_CIVICRM_RESPONSE```
53
+
54
+ Example:
55
+
56
+ ```
57
+ [CiviCRM] [RES] [FinancialType] [get] {"is_error":0,"version":3,"count":1,"id":12,"values":{"12":{"id":"12","name":"Matching Gift","is_deductible":"0","is_active":"1"}}}
58
+ ```
59
+
60
+
37
61
  ## Useful links
38
62
 
39
63
  * https://docs.civicrm.org/dev/en/latest/api/interfaces/#rest-interface
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.3.7
data/civicrm.gemspec CHANGED
@@ -12,6 +12,7 @@ spec = Gem::Specification.new do |s|
12
12
  s.homepage = 'http://civicrm.org'
13
13
  s.executables = 'civicrm'
14
14
  s.require_paths = %w{lib}
15
+ s.required_ruby_version = '>= 2.0'
15
16
 
16
17
  s.add_dependency('rest-client', '~> 2.0')
17
18
  s.add_dependency('activesupport')
data/lib/civicrm.rb CHANGED
@@ -35,8 +35,9 @@ module CiviCrm
35
35
  @@site_key = nil
36
36
  @@api_base = 'https://www.example.org/path/to/civi/codebase'
37
37
  @@api_version = 'v3'
38
+ @@timeout = 80
38
39
 
39
- mattr_accessor :api_key, :api_base, :api_version, :site_key
40
+ mattr_accessor :api_key, :api_base, :api_version, :site_key, :timeout
40
41
 
41
42
  def self.api_url(path = '')
42
43
  base = "#{api_base}/civicrm/extern/rest.php?#{path}"
@@ -10,12 +10,13 @@ module CiviCrm
10
10
  end
11
11
 
12
12
  headers = {
13
- :user_agent => "CiviCrm RubyClient/#{CiviCrm::VERSION}"
13
+ :user_agent => "CiviCrm RubyClient/#{CiviCrm::VERSION}",
14
+ :request_id => SecureRandom.uuid
14
15
  }
15
16
 
16
17
  opts = {
17
18
  :method => :post,
18
- :timeout => 80,
19
+ :timeout => CiviCrm.timeout,
19
20
  :headers => headers
20
21
  }
21
22
 
@@ -34,12 +35,13 @@ module CiviCrm
34
35
 
35
36
  response = nil
36
37
 
38
+ puts("[CiviCRM] [REQ] [#{entity}] [#{action}] #{JSON.dump(opts)}") if ENV["DEBUG_CIVICRM_REQUEST"]
39
+
37
40
  CiviCrm.time(params['entity'], params['action']) do
38
41
  response = execute(opts)
39
42
  end
40
43
 
41
- puts(JSON.dump(opts)) if ENV["DEBUG_CIVICRM_REQUEST"]
42
- puts(response) if ENV["DEBUG_CIVICRM_RESPONSE"]
44
+ puts("[CiviCRM] [RES] [#{entity}] [#{action}] #{response}") if ENV["DEBUG_CIVICRM_RESPONSE"]
43
45
 
44
46
  body, code = response.body, response.code
45
47
 
@@ -1,3 +1,3 @@
1
1
  module CiviCrm
2
- VERSION = '1.3.6'
2
+ VERSION = "1.3.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.3.6
4
+ version: 1.3.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: 2020-02-26 00:00:00.000000000 Z
11
+ date: 2021-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -160,7 +160,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
160
  requirements:
161
161
  - - ">="
162
162
  - !ruby/object:Gem::Version
163
- version: '0'
163
+ version: '2.0'
164
164
  required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  requirements:
166
166
  - - ">="
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  version: '0'
169
169
  requirements: []
170
170
  rubyforge_project:
171
- rubygems_version: 2.7.6
171
+ rubygems_version: 2.7.11
172
172
  signing_key:
173
173
  specification_version: 4
174
174
  summary: Ruby bindings for the CiviCRM API