capsule_crm 1.2.0 → 1.3.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.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/lib/capsule_crm/address.rb +4 -3
  4. data/lib/capsule_crm/associations/belongs_to.rb +2 -1
  5. data/lib/capsule_crm/associations/belongs_to_association.rb +19 -2
  6. data/lib/capsule_crm/associations/belongs_to_finder.rb +46 -0
  7. data/lib/capsule_crm/associations/has_many_association.rb +23 -9
  8. data/lib/capsule_crm/associations/has_many_proxy.rb +38 -4
  9. data/lib/capsule_crm/case.rb +33 -236
  10. data/lib/capsule_crm/configuration.rb +1 -1
  11. data/lib/capsule_crm/connection.rb +3 -0
  12. data/lib/capsule_crm/contactable.rb +1 -1
  13. data/lib/capsule_crm/country.rb +7 -13
  14. data/lib/capsule_crm/currency.rb +7 -13
  15. data/lib/capsule_crm/custom_field.rb +14 -54
  16. data/lib/capsule_crm/custom_field_definition.rb +36 -0
  17. data/lib/capsule_crm/email.rb +4 -3
  18. data/lib/capsule_crm/gettable.rb +11 -0
  19. data/lib/capsule_crm/hash_helper.rb +5 -0
  20. data/lib/capsule_crm/history.rb +37 -252
  21. data/lib/capsule_crm/milestone.rb +9 -9
  22. data/lib/capsule_crm/normalizer.rb +85 -0
  23. data/lib/capsule_crm/opportunity.rb +30 -271
  24. data/lib/capsule_crm/organization.rb +19 -197
  25. data/lib/capsule_crm/party.rb +13 -26
  26. data/lib/capsule_crm/persistence/configuration.rb +25 -0
  27. data/lib/capsule_crm/persistence/deletable.rb +14 -0
  28. data/lib/capsule_crm/persistence/persistable.rb +76 -0
  29. data/lib/capsule_crm/persistence.rb +3 -0
  30. data/lib/capsule_crm/person.rb +19 -194
  31. data/lib/capsule_crm/phone.rb +4 -3
  32. data/lib/capsule_crm/querying/configuration.rb +21 -0
  33. data/lib/capsule_crm/querying/find_all.rb +16 -0
  34. data/lib/capsule_crm/querying/find_one.rb +14 -0
  35. data/lib/capsule_crm/querying/findable.rb +14 -0
  36. data/lib/capsule_crm/querying.rb +4 -0
  37. data/lib/capsule_crm/serializable.rb +38 -0
  38. data/lib/capsule_crm/serializer.rb +54 -7
  39. data/lib/capsule_crm/task.rb +16 -96
  40. data/lib/capsule_crm/track.rb +5 -10
  41. data/lib/capsule_crm/user.rb +3 -15
  42. data/lib/capsule_crm/version.rb +1 -1
  43. data/lib/capsule_crm/website.rb +4 -2
  44. data/lib/capsule_crm.rb +15 -5
  45. data/spec/fabricators/case_fabricator.rb +1 -0
  46. data/spec/fabricators/history_fabricator.rb +1 -0
  47. data/spec/fabricators/opportunity_fabricator.rb +1 -0
  48. data/spec/lib/capsule_crm/associations/belongs_to_finder_spec.rb +48 -0
  49. data/spec/lib/capsule_crm/associations/belongs_to_spec.rb +34 -0
  50. data/spec/lib/capsule_crm/associations/has_many_proxy_spec.rb +54 -14
  51. data/spec/lib/capsule_crm/associations/has_many_spec.rb +15 -2
  52. data/spec/lib/capsule_crm/case_spec.rb +20 -330
  53. data/spec/lib/capsule_crm/country_spec.rb +1 -16
  54. data/spec/lib/capsule_crm/currency_spec.rb +1 -18
  55. data/spec/lib/capsule_crm/custom_field_definition_spec.rb +59 -0
  56. data/spec/lib/capsule_crm/custom_field_spec.rb +2 -27
  57. data/spec/lib/capsule_crm/history_spec.rb +14 -389
  58. data/spec/lib/capsule_crm/milestone_spec.rb +1 -23
  59. data/spec/lib/capsule_crm/normalizer_spec.rb +11 -0
  60. data/spec/lib/capsule_crm/opportunity_spec.rb +22 -341
  61. data/spec/lib/capsule_crm/organization_spec.rb +39 -60
  62. data/spec/lib/capsule_crm/party_spec.rb +37 -59
  63. data/spec/lib/capsule_crm/person_spec.rb +49 -247
  64. data/spec/lib/capsule_crm/serializer_spec.rb +25 -4
  65. data/spec/lib/capsule_crm/task_spec.rb +21 -250
  66. data/spec/lib/capsule_crm/track_spec.rb +1 -15
  67. data/spec/lib/capsule_crm/user_spec.rb +1 -14
  68. data/spec/support/{countries.json → all_countries.json} +0 -0
  69. data/spec/support/{currencies.json → all_currencies.json} +0 -0
  70. data/spec/support/{milestones.json → all_milestones.json} +0 -0
  71. data/spec/support/{tracks.json → all_tracks.json} +0 -0
  72. data/spec/support/custom_field_definitions.json +19 -0
  73. data/spec/support/helpers.rb +3 -2
  74. data/spec/support/no_cases.json +5 -0
  75. data/spec/support/no_countries.json +5 -0
  76. data/spec/support/no_currencies.json +5 -0
  77. data/spec/support/no_milestones.json +5 -0
  78. data/spec/support/no_opportunities.json +5 -0
  79. data/spec/support/no_tasks.json +5 -0
  80. data/spec/support/no_tracks.json +5 -0
  81. data/spec/support/no_users.json +5 -0
  82. data/spec/support/shared_examples/deletable.rb +15 -0
  83. data/spec/support/shared_examples/find_all.rb +34 -0
  84. data/spec/support/shared_examples/find_one.rb +23 -0
  85. data/spec/support/shared_examples/persistable.rb +318 -0
  86. data/spec/support/single_person.json +16 -0
  87. metadata +60 -15
  88. data/lib/capsule_crm/attributes.rb +0 -11
  89. data/lib/capsule_crm/capsule_jsonable.rb +0 -13
  90. data/lib/capsule_crm/collection.rb +0 -9
  91. data/spec/support/single_user.json +0 -25
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capsule_crm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Beedle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-10 00:00:00.000000000 Z
11
+ date: 2014-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -257,14 +257,12 @@ files:
257
257
  - lib/capsule_crm/associations.rb
258
258
  - lib/capsule_crm/associations/belongs_to.rb
259
259
  - lib/capsule_crm/associations/belongs_to_association.rb
260
+ - lib/capsule_crm/associations/belongs_to_finder.rb
260
261
  - lib/capsule_crm/associations/has_many.rb
261
262
  - lib/capsule_crm/associations/has_many_association.rb
262
263
  - lib/capsule_crm/associations/has_many_proxy.rb
263
264
  - lib/capsule_crm/attachment.rb
264
- - lib/capsule_crm/attributes.rb
265
- - lib/capsule_crm/capsule_jsonable.rb
266
265
  - lib/capsule_crm/case.rb
267
- - lib/capsule_crm/collection.rb
268
266
  - lib/capsule_crm/configuration.rb
269
267
  - lib/capsule_crm/connection.rb
270
268
  - lib/capsule_crm/contactable.rb
@@ -272,22 +270,35 @@ files:
272
270
  - lib/capsule_crm/country.rb
273
271
  - lib/capsule_crm/currency.rb
274
272
  - lib/capsule_crm/custom_field.rb
273
+ - lib/capsule_crm/custom_field_definition.rb
275
274
  - lib/capsule_crm/email.rb
276
275
  - lib/capsule_crm/errors.rb
277
276
  - lib/capsule_crm/errors/record_invalid.rb
278
277
  - lib/capsule_crm/errors/record_not_saved.rb
279
278
  - lib/capsule_crm/errors/response_error.rb
280
279
  - lib/capsule_crm/faraday/middleware/raise_error.rb
280
+ - lib/capsule_crm/gettable.rb
281
281
  - lib/capsule_crm/hash_helper.rb
282
282
  - lib/capsule_crm/history.rb
283
283
  - lib/capsule_crm/milestone.rb
284
+ - lib/capsule_crm/normalizer.rb
284
285
  - lib/capsule_crm/opportunity.rb
285
286
  - lib/capsule_crm/organization.rb
286
287
  - lib/capsule_crm/participant.rb
287
288
  - lib/capsule_crm/party.rb
289
+ - lib/capsule_crm/persistence.rb
290
+ - lib/capsule_crm/persistence/configuration.rb
291
+ - lib/capsule_crm/persistence/deletable.rb
292
+ - lib/capsule_crm/persistence/persistable.rb
288
293
  - lib/capsule_crm/person.rb
289
294
  - lib/capsule_crm/phone.rb
295
+ - lib/capsule_crm/querying.rb
296
+ - lib/capsule_crm/querying/configuration.rb
297
+ - lib/capsule_crm/querying/find_all.rb
298
+ - lib/capsule_crm/querying/find_one.rb
299
+ - lib/capsule_crm/querying/findable.rb
290
300
  - lib/capsule_crm/results_proxy.rb
301
+ - lib/capsule_crm/serializable.rb
291
302
  - lib/capsule_crm/serializer.rb
292
303
  - lib/capsule_crm/tag.rb
293
304
  - lib/capsule_crm/taggable.rb
@@ -305,6 +316,8 @@ files:
305
316
  - spec/fabricators/task_fabricator.rb
306
317
  - spec/lib/capsule_crm/address_spec.rb
307
318
  - spec/lib/capsule_crm/associations/belongs_to_association_spec.rb
319
+ - spec/lib/capsule_crm/associations/belongs_to_finder_spec.rb
320
+ - spec/lib/capsule_crm/associations/belongs_to_spec.rb
308
321
  - spec/lib/capsule_crm/associations/has_many_association_spec.rb
309
322
  - spec/lib/capsule_crm/associations/has_many_proxy_spec.rb
310
323
  - spec/lib/capsule_crm/associations/has_many_spec.rb
@@ -315,10 +328,12 @@ files:
315
328
  - spec/lib/capsule_crm/contacts_spec.rb
316
329
  - spec/lib/capsule_crm/country_spec.rb
317
330
  - spec/lib/capsule_crm/currency_spec.rb
331
+ - spec/lib/capsule_crm/custom_field_definition_spec.rb
318
332
  - spec/lib/capsule_crm/custom_field_spec.rb
319
333
  - spec/lib/capsule_crm/email_spec.rb
320
334
  - spec/lib/capsule_crm/history_spec.rb
321
335
  - spec/lib/capsule_crm/milestone_spec.rb
336
+ - spec/lib/capsule_crm/normalizer_spec.rb
322
337
  - spec/lib/capsule_crm/opportunity_spec.rb
323
338
  - spec/lib/capsule_crm/organization_spec.rb
324
339
  - spec/lib/capsule_crm/party_spec.rb
@@ -331,32 +346,45 @@ files:
331
346
  - spec/lib/capsule_crm/user_spec.rb
332
347
  - spec/spec_helper.rb
333
348
  - spec/support/all_cases.json
349
+ - spec/support/all_countries.json
350
+ - spec/support/all_currencies.json
334
351
  - spec/support/all_customfields.json
335
352
  - spec/support/all_history.json
353
+ - spec/support/all_milestones.json
336
354
  - spec/support/all_opportunities.json
337
355
  - spec/support/all_parties.json
338
356
  - spec/support/all_people.json
339
357
  - spec/support/all_tags.json
340
358
  - spec/support/all_tasks.json
359
+ - spec/support/all_tracks.json
341
360
  - spec/support/all_users.json
342
361
  - spec/support/case.json
343
- - spec/support/countries.json
344
- - spec/support/currencies.json
362
+ - spec/support/custom_field_definitions.json
345
363
  - spec/support/deleted_opportunities.json
346
364
  - spec/support/helpers.rb
347
365
  - spec/support/history.json
348
- - spec/support/milestones.json
366
+ - spec/support/no_cases.json
367
+ - spec/support/no_countries.json
368
+ - spec/support/no_currencies.json
349
369
  - spec/support/no_customfields.json
350
370
  - spec/support/no_history.json
371
+ - spec/support/no_milestones.json
372
+ - spec/support/no_opportunities.json
351
373
  - spec/support/no_parties.json
374
+ - spec/support/no_tasks.json
375
+ - spec/support/no_tracks.json
376
+ - spec/support/no_users.json
352
377
  - spec/support/opportunity.json
353
378
  - spec/support/organisation.json
354
379
  - spec/support/person.json
355
380
  - spec/support/shared_examples/contactable.rb
356
- - spec/support/single_user.json
381
+ - spec/support/shared_examples/deletable.rb
382
+ - spec/support/shared_examples/find_all.rb
383
+ - spec/support/shared_examples/find_one.rb
384
+ - spec/support/shared_examples/persistable.rb
385
+ - spec/support/single_person.json
357
386
  - spec/support/task.json
358
387
  - spec/support/task_categories.json
359
- - spec/support/tracks.json
360
388
  homepage: ''
361
389
  licenses: []
362
390
  metadata: {}
@@ -391,6 +419,8 @@ test_files:
391
419
  - spec/fabricators/task_fabricator.rb
392
420
  - spec/lib/capsule_crm/address_spec.rb
393
421
  - spec/lib/capsule_crm/associations/belongs_to_association_spec.rb
422
+ - spec/lib/capsule_crm/associations/belongs_to_finder_spec.rb
423
+ - spec/lib/capsule_crm/associations/belongs_to_spec.rb
394
424
  - spec/lib/capsule_crm/associations/has_many_association_spec.rb
395
425
  - spec/lib/capsule_crm/associations/has_many_proxy_spec.rb
396
426
  - spec/lib/capsule_crm/associations/has_many_spec.rb
@@ -401,10 +431,12 @@ test_files:
401
431
  - spec/lib/capsule_crm/contacts_spec.rb
402
432
  - spec/lib/capsule_crm/country_spec.rb
403
433
  - spec/lib/capsule_crm/currency_spec.rb
434
+ - spec/lib/capsule_crm/custom_field_definition_spec.rb
404
435
  - spec/lib/capsule_crm/custom_field_spec.rb
405
436
  - spec/lib/capsule_crm/email_spec.rb
406
437
  - spec/lib/capsule_crm/history_spec.rb
407
438
  - spec/lib/capsule_crm/milestone_spec.rb
439
+ - spec/lib/capsule_crm/normalizer_spec.rb
408
440
  - spec/lib/capsule_crm/opportunity_spec.rb
409
441
  - spec/lib/capsule_crm/organization_spec.rb
410
442
  - spec/lib/capsule_crm/party_spec.rb
@@ -417,29 +449,42 @@ test_files:
417
449
  - spec/lib/capsule_crm/user_spec.rb
418
450
  - spec/spec_helper.rb
419
451
  - spec/support/all_cases.json
452
+ - spec/support/all_countries.json
453
+ - spec/support/all_currencies.json
420
454
  - spec/support/all_customfields.json
421
455
  - spec/support/all_history.json
456
+ - spec/support/all_milestones.json
422
457
  - spec/support/all_opportunities.json
423
458
  - spec/support/all_parties.json
424
459
  - spec/support/all_people.json
425
460
  - spec/support/all_tags.json
426
461
  - spec/support/all_tasks.json
462
+ - spec/support/all_tracks.json
427
463
  - spec/support/all_users.json
428
464
  - spec/support/case.json
429
- - spec/support/countries.json
430
- - spec/support/currencies.json
465
+ - spec/support/custom_field_definitions.json
431
466
  - spec/support/deleted_opportunities.json
432
467
  - spec/support/helpers.rb
433
468
  - spec/support/history.json
434
- - spec/support/milestones.json
469
+ - spec/support/no_cases.json
470
+ - spec/support/no_countries.json
471
+ - spec/support/no_currencies.json
435
472
  - spec/support/no_customfields.json
436
473
  - spec/support/no_history.json
474
+ - spec/support/no_milestones.json
475
+ - spec/support/no_opportunities.json
437
476
  - spec/support/no_parties.json
477
+ - spec/support/no_tasks.json
478
+ - spec/support/no_tracks.json
479
+ - spec/support/no_users.json
438
480
  - spec/support/opportunity.json
439
481
  - spec/support/organisation.json
440
482
  - spec/support/person.json
441
483
  - spec/support/shared_examples/contactable.rb
442
- - spec/support/single_user.json
484
+ - spec/support/shared_examples/deletable.rb
485
+ - spec/support/shared_examples/find_all.rb
486
+ - spec/support/shared_examples/find_one.rb
487
+ - spec/support/shared_examples/persistable.rb
488
+ - spec/support/single_person.json
443
489
  - spec/support/task.json
444
490
  - spec/support/task_categories.json
445
- - spec/support/tracks.json
@@ -1,11 +0,0 @@
1
- module CapsuleCRM
2
- module Attributes
3
- extend ActiveSupport::Concern
4
-
5
- def attributes=(attributes)
6
- CapsuleCRM::HashHelper.underscore_keys!(attributes)
7
- super(attributes)
8
- self
9
- end
10
- end
11
- end
@@ -1,13 +0,0 @@
1
- module CapsuleCRM
2
- module CapsuleJsonable
3
- extend ActiveSupport::Concern
4
-
5
- def to_capsule_json
6
- serializer.serialize.delete(serializer.root)
7
- end
8
-
9
- def serializer
10
- @serializer ||= CapsuleCRM::Serializer.new(self)
11
- end
12
- end
13
- end
@@ -1,9 +0,0 @@
1
- module CapsuleCRM::Collection
2
- extend ActiveSupport::Concern
3
-
4
- module ClassMethods
5
- def init_collection(*collection)
6
- collection.flatten.compact.map { |item| new item }
7
- end
8
- end
9
- end
@@ -1,25 +0,0 @@
1
- {
2
- "parties":
3
- {
4
- "@size":"1",
5
- "person":
6
- {
7
- "id":"100",
8
- "contacts":
9
- {
10
- "email":
11
- {
12
- "id":"25101754",
13
- "emailAddress":"aa@aa.com"
14
- }
15
- },
16
- "pictureURL": "",
17
- "createdOn":"2011-08-10T01:58:49Z",
18
- "updatedOn":"2011-08-10T03:20:43Z",
19
- "firstName":"aaa",
20
- "lastName":"bbb",
21
- "organisationId":"1",
22
- "organisationName":"test"
23
- }
24
- }
25
- }