rubyzoho 0.3.4 → 0.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3df2fb7e8d61e0b02c8afa481559358b18b5890
4
- data.tar.gz: ca65e559f7560c3bf8039932c4081a4b5b8c2022
3
+ metadata.gz: 9c2778e7aacd346dbf9831614d6a0ee39c7f58bc
4
+ data.tar.gz: f2e35de7692aa5125bb37ad1c56d84c88874d9c2
5
5
  SHA512:
6
- metadata.gz: bd31855e84a2015e006e9f0d06cf95edf9f8d0705690810b9bcc63f87530c3f022a659a4ca19399b78cbb2656ae805f708ab2a1ac55ea00d5005f85ead0b5fd7
7
- data.tar.gz: 67ec7297a349802e00ec2c5592c0fad622330d576513ebbcf239ac9a572b5ece326d96449b6aa193d3f909268af24537e9342a1c2589764c1fb18127d8a01199
6
+ metadata.gz: 92a1371830f6dac34c6e4c9b7f681df8fad323d406f08c05b136dd59dc98eb325836dd38f0c77c3c5727a7855e9568ce417ee9ea4852346aaa51a3d461deed3b
7
+ data.tar.gz: 51b31f7739e70516fea90c8f1c99cb9cb2ad8165ab669affe0ffbc0a5f1796b23cf6a162d09823c1c629314071cbd92aa558a8757e18a989f9459e6bc745475b
@@ -26,6 +26,29 @@ Put the following in an initializer (e.g. <tt><RAILS_ROOT>/config/initializers/z
26
26
  # Currently only Quotes are supported
27
27
  end
28
28
 
29
+ You can reduce the number of API calls made during development and production by adding
30
+
31
+ config.cache_fields = true
32
+
33
+ to the initializer. You can also limit the number of modules in use, so if you're only using 'Leads' for
34
+ instance, set the gem to only load field data from 'Leads' by setting
35
+
36
+ config.crm_modules = ['Leads']
37
+
38
+ and only meta data from 'Leads' will be loaded.
39
+
40
+ In Test or Continous Integration(CI) environments, one strategy is not to initialize the gem at all, so
41
+ for example,
42
+
43
+ RubyZoho.configure do |config|
44
+ config.api_key = '<< API Key from Zoho>>'
45
+ config.crm_modules = ['Accounts']
46
+ config.cache_fields = true if Rails.env.development?
47
+ end unless Rails.env.test?
48
+
49
+ and wrap the code calling the API in a <tt>begin ... rescue</tt> block.
50
+
51
+
29
52
  === Ruby
30
53
  Make sure the following block is executed prior to making calls to the gem.
31
54
 
@@ -266,15 +289,22 @@ Copyright (c) 2013 - 2015 amalc (\@\amalc). Released under the MIT license. See
266
289
  == Release Candidates (Uses {Semantic Versioning}[http://semver.org/])
267
290
 
268
291
  == Development
269
- [0.7.0]
292
+ [0.8.0]
270
293
  1. << syntax for Account/Tasks on Master/Detail relationships
271
294
  2. ActiveRecord style syntax for Class.\new, Class.delete, Class.find, Class.update, Object.save
272
295
  3. Modules Supported: Accounts, Contacts, Leads, Potentials, Quotes, Tasks and Users
273
- [0.6.0]
296
+ [0.7.0]
274
297
  1. Option in config to ignore fields with improper field names
275
- [0.5.0]
298
+ [0.6.0]
276
299
  1. Support for testing without calling Zoho to prevent crushing API call limits in CI.
277
300
  == Released
301
+ [0.5.0]
302
+ 1. Replaces <tt>getSearchRecords</tt> with <tt>searchRecords</tt> in the Zoho API. The direct impact of this is
303
+ increasing the number of API calls you can make. However, this search method appears to be
304
+ asynchronous, so if you update a record and then immediately look for it, it will not updated
305
+ or in the event of a create, will return a nil. This applies to deletes as well. So a deleted
306
+ record will show up in a search which immediately follows. Empirical evidence shows about 30 -
307
+ 45 seconds before search is updated. Be warned!
278
308
  [0.4.0]
279
309
  1. Fixed major bug with retrieving records thanks to @kjcpass PR#28
280
310
  [0.3.0]
@@ -11,10 +11,10 @@ module ZohoApiFinders
11
11
 
12
12
  def find_record_by_field(module_name, sc_field, condition, value)
13
13
  field = sc_field.rindex('id') ? sc_field.downcase : sc_field
14
- search_condition = '(' + field + '|' + condition + '|' + value + ')'
15
- r = self.class.get(create_url("#{module_name}", 'getSearchRecords'),
14
+ search_condition = "(#{field}:#{value})"
15
+ r = self.class.get(create_url("#{module_name}", 'searchRecords'),
16
16
  :query => { :newFormat => 1, :authtoken => @auth_token, :scope => 'crmapi',
17
- :selectColumns => 'All', :searchCondition => search_condition,
17
+ :selectColumns => 'All', :criteria => search_condition,
18
18
  :fromIndex => 1, :toIndex => NUMBER_OF_RECORDS_TO_GET })
19
19
  check_for_errors(r)
20
20
  x = REXML::Document.new(r.body).elements.to_a("/response/result/#{module_name}/row")
@@ -1,16 +1,16 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'rubyzoho'
3
- s.version = '0.3.4'
3
+ s.version = '0.5.0'
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ['amalc']
7
- s.date = '2015-02-22'
7
+ s.date = '2015-02-23'
8
8
  s.description = 'A set of Ruby classes supporting the ActiveRecord lifecycle for the Zoho CRM API.'
9
9
  s.email = 'amalc@github.com'
10
10
  s.extra_rdoc_files = %w(LICENSE.txt README.rdoc)
11
11
  s.files = %w(
12
12
  .coverall.yml .document .rspec .travis.yml Gemfile
13
- LICENSE.txt README.rdoc Rakefile VERSION lib/api_utils.rb lib/crm.rb lib/crud_methods.rb
13
+ LICENSE.txt README.rdoc Rakefile lib/api_utils.rb lib/crm.rb lib/crud_methods.rb
14
14
  lib/ruby_zoho.rb lib/zoho_api.rb lib/zoho_api_field_utils.rb lib/zoho_api_finders.rb
15
15
  lib/zoho_crm_users.rb lib/zoho_crm_utils.rb rubyzoho.gemspec spec/api_utils_spec.rb
16
16
  spec/fixtures/sample.pdf spec/fixtures/sample_contact.xml spec/fixtures/sample_contact_search.xml
@@ -7,7 +7,7 @@ require 'vcr'
7
7
  VCR.configure do |c|
8
8
  c.cassette_library_dir = 'spec/vcr'
9
9
  c.hook_into :webmock
10
- # c.default_cassette_options = {:record => :all}
10
+ c.default_cassette_options = {:record => :all}
11
11
  # c.debug_logger = File.open('log/vcr_debug.log', 'w')
12
12
  end
13
13
 
@@ -105,8 +105,6 @@ describe RubyZoho::Crm do
105
105
 
106
106
  it 'should find a contact by email or last name' do
107
107
  VCR.use_cassette 'zoho/find_by_email_or_name' do
108
- r = RubyZoho::Crm::Contact.find_by_email('bob@smith.com')
109
- r.each { |m| RubyZoho::Crm::Contact.delete(m.id) } unless r.nil?
110
108
  1.upto(3) do
111
109
  c = RubyZoho::Crm::Contact.new(
112
110
  :first_name => 'Bob',
@@ -115,6 +113,10 @@ describe RubyZoho::Crm do
115
113
  c.save
116
114
  end
117
115
  r = RubyZoho::Crm::Contact.find_by_email('bob@smith.com')
116
+ while r.nil?
117
+ sleep(15)
118
+ r = RubyZoho::Crm::Contact.find_by_email('bob@smith.com')
119
+ end
118
120
  r.should_not eq(nil)
119
121
  r.count.should eq(3)
120
122
  r.each { |m| m.email.should eq('bob@smith.com') }
@@ -274,7 +276,12 @@ describe RubyZoho::Crm do
274
276
  :last_name => 'Portra',
275
277
  :email => 'raj@portra.com')
276
278
  c.save
279
+ sleep(30)
277
280
  r = RubyZoho::Crm::Contact.find_by_email('raj@portra.com')
281
+ while r.nil?
282
+ sleep(15)
283
+ r = RubyZoho::Crm::Contact.find_by_email('raj@portra.com')
284
+ end
278
285
  r.first.email.should eq('raj@portra.com')
279
286
  r.each { |contact| RubyZoho::Crm::Contact.delete(contact.contactid) }
280
287
  end
@@ -315,10 +322,12 @@ describe RubyZoho::Crm do
315
322
  if defined?(l.test_label)
316
323
  RubyZoho::Crm::Lead.update(
317
324
  :id => l.id,
318
- :test_label => '$1000000'
325
+ :test_label => '$101',
326
+ :test_integer => 1
319
327
  )
320
328
  l2 = RubyZoho::Crm::Lead.find(l.id)
321
- l2.first.test_label.should eq('$1000000')
329
+ l2.first.test_label.should eq('$101')
330
+ l2.first.test_integer.should eq('1')
322
331
  end
323
332
  end
324
333
  end
@@ -338,6 +347,10 @@ describe RubyZoho::Crm do
338
347
  p = RubyZoho::Crm::Potential.new(h)
339
348
  p.save
340
349
  r = RubyZoho::Crm::Potential.find_by_potential_name(p.potential_name)
350
+ while r.nil? do
351
+ sleep(15)
352
+ r = RubyZoho::Crm::Potential.find_by_potential_name(p.potential_name)
353
+ end
341
354
  r.first.potential_name.should eq(h[:potential_name])
342
355
  potential = RubyZoho::Crm::Potential.find(r.first.potentialid)
343
356
  potential.first.potentialid.should eq(r.first.potentialid)
@@ -363,6 +376,10 @@ describe RubyZoho::Crm do
363
376
  t = RubyZoho::Crm::Task.new(h)
364
377
  t.save
365
378
  r = RubyZoho::Crm::Task.find_by_subject(h[:subject])
379
+ while r.nil?
380
+ sleep(15)
381
+ r = RubyZoho::Crm::Task.find_by_subject(h[:subject])
382
+ end
366
383
  r.first.subject.should eq(h[:subject])
367
384
  tasks = RubyZoho::Crm::Task.find_by_activityid(r.first.activityid)
368
385
  tasks.first.activityid.should eq(r.first.activityid)
@@ -415,7 +432,7 @@ describe RubyZoho::Crm do
415
432
 
416
433
  it 'should update a lead record' do
417
434
  VCR.use_cassette 'zoho/update_lead' do
418
- r_changed = RubyZoho::Crm::Lead.find_by_email('changed_raj@portra.com')
435
+ r_changed = RubyZoho::Crm::Lead.find_by_email('changed_rajj@portra.com')
419
436
  r_changed.each { |c| RubyZoho::Crm::Lead.delete(c.leadid) } unless r_changed.nil?
420
437
  l = RubyZoho::Crm::Lead.new(
421
438
  :first_name => 'Raj',
@@ -423,11 +440,19 @@ describe RubyZoho::Crm do
423
440
  :email => 'raj@portra.com')
424
441
  l.save
425
442
  r = RubyZoho::Crm::Lead.find_by_email('raj@portra.com')
443
+ while r.nil?
444
+ sleep(15)
445
+ r = RubyZoho::Crm::Lead.find_by_email('raj@portra.com')
446
+ end
426
447
  RubyZoho::Crm::Lead.update(
427
448
  :id => r.first.leadid,
428
- :email => 'changed_raj@portra.com'
449
+ :email => 'changed_rajj@portra.com'
429
450
  )
430
- r_changed = RubyZoho::Crm::Lead.find_by_email('changed_raj@portra.com')
451
+ r_changed = RubyZoho::Crm::Lead.find_by_email('changed_rajj@portra.com')
452
+ while r_changed.nil?
453
+ sleep(15)
454
+ r_changed = RubyZoho::Crm::Lead.find_by_email('changed_rajj@portra.com')
455
+ end
431
456
  r.first.leadid.should eq(r_changed.first.leadid)
432
457
  r.each { |c| RubyZoho::Crm::Lead.delete(c.leadid) }
433
458
  r_changed.each { |c| RubyZoho::Crm::Lead.delete(c.leadid) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyzoho
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - amalc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-22 00:00:00.000000000 Z
11
+ date: 2015-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -181,7 +181,6 @@ files:
181
181
  - LICENSE.txt
182
182
  - README.rdoc
183
183
  - Rakefile
184
- - VERSION
185
184
  - lib/api_utils.rb
186
185
  - lib/crm.rb
187
186
  - lib/crud_methods.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.2.0