capsule_crm 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -1
  3. data/CHANGELOG.md +5 -0
  4. data/Guardfile +2 -4
  5. data/capsule_crm.gemspec +1 -1
  6. data/lib/capsule_crm/address.rb +1 -1
  7. data/lib/capsule_crm/associations/belongs_to.rb +2 -1
  8. data/lib/capsule_crm/attachment.rb +1 -1
  9. data/lib/capsule_crm/case.rb +1 -1
  10. data/lib/capsule_crm/country.rb +1 -1
  11. data/lib/capsule_crm/currency.rb +1 -1
  12. data/lib/capsule_crm/custom_field.rb +1 -1
  13. data/lib/capsule_crm/custom_field_definition.rb +1 -1
  14. data/lib/capsule_crm/email.rb +1 -1
  15. data/lib/capsule_crm/history.rb +1 -1
  16. data/lib/capsule_crm/milestone.rb +1 -1
  17. data/lib/capsule_crm/opportunity.rb +1 -1
  18. data/lib/capsule_crm/participant.rb +1 -1
  19. data/lib/capsule_crm/party.rb +1 -1
  20. data/lib/capsule_crm/phone.rb +1 -1
  21. data/lib/capsule_crm/tag.rb +1 -1
  22. data/lib/capsule_crm/task.rb +3 -8
  23. data/lib/capsule_crm/task_category.rb +32 -0
  24. data/lib/capsule_crm/track.rb +1 -1
  25. data/lib/capsule_crm/user.rb +1 -1
  26. data/lib/capsule_crm/version.rb +1 -1
  27. data/lib/capsule_crm/website.rb +1 -1
  28. data/lib/capsule_crm.rb +1 -0
  29. data/spec/lib/capsule_crm/associations/belongs_to_association_spec.rb +1 -1
  30. data/spec/lib/capsule_crm/associations/belongs_to_spec.rb +1 -1
  31. data/spec/lib/capsule_crm/associations/has_many_association_spec.rb +1 -1
  32. data/spec/lib/capsule_crm/associations/has_many_proxy_spec.rb +2 -2
  33. data/spec/lib/capsule_crm/associations_spec.rb +1 -1
  34. data/spec/lib/capsule_crm/custom_field_spec.rb +0 -2
  35. data/spec/lib/capsule_crm/serializer_spec.rb +2 -2
  36. data/spec/lib/capsule_crm/taggable_spec.rb +2 -2
  37. data/spec/lib/capsule_crm/task_category_spec.rb +7 -0
  38. data/spec/lib/capsule_crm/task_spec.rb +0 -12
  39. data/spec/support/{task_categories.json → all_categories.json} +0 -0
  40. data/spec/support/no_categories.json +5 -0
  41. metadata +11 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6cc2774ab10bd28336dd0d4586a9e580339da8fa
4
- data.tar.gz: 993020dd12dc61dcf601e70b111279f7dbf0dd8b
3
+ metadata.gz: 0e6d24bb7037a3d119bccf9122b99dcc4c637a76
4
+ data.tar.gz: d3963ea029b318ad0e730ef6d7fd8d37fe42a758
5
5
  SHA512:
6
- metadata.gz: e8ff0fcca56968b5f6bcf914c2041e758c2f28c3d16107b2a36f61be649ba35c9741c171619f2197d7ca229b746131a68d6e556e8b440b311413c8611c41b646
7
- data.tar.gz: 002ed9d4cb89290cf6151e72439c84912f2752e7b6b4a455d4165aa024b01d4d75c0efbf2b08c5ca65bef995ae9e6bdca176a84bfb17fe8c237c8c1e05bc55fb
6
+ metadata.gz: d7e0f36ec559f8d5473f50050c2751b5ec4e3c91cbd0cd210ba1e65ab2342dc15e961ff3a2792baa346b2e249931a2601bdd96588e234e355cf875614b10a324
7
+ data.tar.gz: 2afd21361071265d65f897c386dd83d845d835e45edb5be1e9e6ec283486ca1ec10e81764a3ff63a33ada828ec4ba86de2d0cb261a7a9d06861867337e45f731
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
1
  --color
2
- --format documentation
2
+ --format progress
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.5.0
4
+
5
+ - Add TaskCategory
6
+ - Upgrade to latest virtus
7
+
3
8
  ## 1.4.0
4
9
 
5
10
  - Fix bug with contacts, where contact details were being attached to parties as
data/Guardfile CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  notification :tmux
5
5
 
6
- guard 'rspec', all_on_start: true, all_after_pass: true, keep_failed: true do
6
+ guard 'rspec', all_on_start: true, all_after_pass: true, failed_mode: :keep do
7
7
  watch(%r{^spec/.+_spec\.rb$})
8
8
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
9
9
  watch('spec/spec_helper.rb') { "spec" }
@@ -17,7 +17,5 @@ end
17
17
 
18
18
 
19
19
  guard 'bundler' do
20
- watch('Gemfile')
21
- # Uncomment next line if Gemfile contain `gemspec' command
22
- # watch(/^.+\.gemspec/)
20
+ watch(/^.+\.gemspec/)
23
21
  end
data/capsule_crm.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |gem|
23
23
  gem.add_runtime_dependency('activesupport')
24
24
  gem.add_runtime_dependency('faraday')
25
25
  gem.add_runtime_dependency('faraday_middleware')
26
- gem.add_runtime_dependency('virtus', '~> 0.5.4')
26
+ gem.add_runtime_dependency('virtus', '~> 1.0.0')
27
27
 
28
28
  gem.add_development_dependency('coveralls')
29
29
  gem.add_development_dependency('cucumber')
@@ -1,6 +1,6 @@
1
1
  module CapsuleCRM
2
2
  class Address
3
- include Virtus
3
+ include Virtus.model
4
4
  include CapsuleCRM::Serializable
5
5
  extend ActiveModel::Naming
6
6
 
@@ -42,7 +42,8 @@ module CapsuleCRM
42
42
 
43
43
  (class << self; self; end).instance_eval do
44
44
  define_method "_for_#{association_name}" do |id|
45
- CapsuleCRM::Associations::BelongsToFinder.new(association).call(id)
45
+ CapsuleCRM::Associations::BelongsToFinder.new(association).
46
+ call(id)
46
47
  end
47
48
  end
48
49
 
@@ -1,6 +1,6 @@
1
1
  module CapsuleCRM
2
2
  class Attachment
3
- include Virtus
3
+ include Virtus.model
4
4
 
5
5
  include ActiveModel::Validations
6
6
 
@@ -1,6 +1,6 @@
1
1
  module CapsuleCRM
2
2
  class Case
3
- include Virtus
3
+ include Virtus.model
4
4
 
5
5
  extend ActiveModel::Naming
6
6
  include ActiveModel::Conversion
@@ -1,6 +1,6 @@
1
1
  module CapsuleCRM
2
2
  class Country
3
- include Virtus
3
+ include Virtus.model
4
4
 
5
5
  include CapsuleCRM::Serializable
6
6
  include CapsuleCRM::Querying::Configuration
@@ -1,6 +1,6 @@
1
1
  module CapsuleCRM
2
2
  class Currency
3
- include Virtus
3
+ include Virtus.model
4
4
 
5
5
  extend ActiveModel::Naming
6
6
  include ActiveModel::Conversion
@@ -1,6 +1,6 @@
1
1
  module CapsuleCRM
2
2
  class CustomField
3
- include Virtus
3
+ include Virtus.model
4
4
 
5
5
  extend ActiveModel::Naming
6
6
  include ActiveModel::Conversion
@@ -1,6 +1,6 @@
1
1
  module CapsuleCRM
2
2
  class CustomFieldDefinition
3
- include Virtus
3
+ include Virtus.model
4
4
  include CapsuleCRM::Serializable
5
5
  include CapsuleCRM::Gettable
6
6
 
@@ -1,6 +1,6 @@
1
1
  module CapsuleCRM
2
2
  class Email
3
- include Virtus
3
+ include Virtus.model
4
4
  include CapsuleCRM::Serializable
5
5
  extend ActiveModel::Naming
6
6
 
@@ -1,6 +1,6 @@
1
1
  module CapsuleCRM
2
2
  class History
3
- include Virtus
3
+ include Virtus.model
4
4
 
5
5
  extend ActiveModel::Naming
6
6
  include ActiveModel::Conversion
@@ -1,7 +1,7 @@
1
1
  module CapsuleCRM
2
2
  class Milestone
3
3
  include ActiveModel::Validations
4
- include Virtus
4
+ include Virtus.model
5
5
 
6
6
  include CapsuleCRM::Querying::Configuration
7
7
  include CapsuleCRM::Querying::FindAll
@@ -1,6 +1,6 @@
1
1
  module CapsuleCRM
2
2
  class Opportunity
3
- include Virtus
3
+ include Virtus.model
4
4
 
5
5
  extend ActiveModel::Naming
6
6
  include ActiveModel::Conversion
@@ -1,6 +1,6 @@
1
1
  module CapsuleCRM
2
2
  class Participant
3
- include Virtus
3
+ include Virtus.model
4
4
 
5
5
  extend ActiveModel::Naming
6
6
  include ActiveModel::Validations
@@ -1,5 +1,5 @@
1
1
  class CapsuleCRM::Party
2
- include Virtus
2
+ include Virtus.model
3
3
 
4
4
  include CapsuleCRM::Associations
5
5
  include CapsuleCRM::Querying::Findable
@@ -1,6 +1,6 @@
1
1
  module CapsuleCRM
2
2
  class Phone
3
- include Virtus
3
+ include Virtus.model
4
4
  include CapsuleCRM::Serializable
5
5
  extend ActiveModel::Naming
6
6
 
@@ -1,6 +1,6 @@
1
1
  module CapsuleCRM
2
2
  class Tag
3
- include Virtus
3
+ include Virtus.model
4
4
 
5
5
  extend ActiveModel::Naming
6
6
  include ActiveModel::Conversion
@@ -1,6 +1,6 @@
1
1
  module CapsuleCRM
2
2
  class Task
3
- include Virtus
3
+ include Virtus.model
4
4
 
5
5
  extend ActiveModel::Naming
6
6
  include ActiveModel::Conversion
@@ -19,7 +19,6 @@ module CapsuleCRM
19
19
  attribute :id, Integer
20
20
  attribute :due_date, Date
21
21
  attribute :due_date_time, DateTime
22
- attribute :category, String
23
22
  attribute :description, String
24
23
  attribute :detail, String
25
24
 
@@ -27,6 +26,8 @@ module CapsuleCRM
27
26
  belongs_to :opportunity
28
27
  belongs_to :case
29
28
  belongs_to :owner, class_name: 'CapsuleCRM::User', serializable_key: :owner
29
+ belongs_to :category, class_name: 'CapsuleCRM::TaskCategory',
30
+ serializable_key: :category
30
31
 
31
32
  validates :id, numericality: { allow_blank: true }
32
33
  validates :description, presence: true
@@ -73,12 +74,6 @@ module CapsuleCRM
73
74
  self
74
75
  end
75
76
 
76
- # TODO Change this to an embedded association, like custom fields
77
- def self.categories
78
- CapsuleCRM::Connection.
79
- get('/api/task/categories')['taskCategories']['taskCategory']
80
- end
81
-
82
77
  def create_url
83
78
  if party_id
84
79
  "party/#{party_id}/task"
@@ -0,0 +1,32 @@
1
+ module CapsuleCRM
2
+ class TaskCategory
3
+ include Virtus.model
4
+
5
+ include ActiveModel::Naming
6
+ include ActiveModel::Conversion
7
+ include ActiveModel::Validations
8
+
9
+ include CapsuleCRM::Associations
10
+ include CapsuleCRM::Querying::Configuration
11
+ include CapsuleCRM::Querying::FindAll
12
+ include CapsuleCRM::Serializable
13
+
14
+ queryable_config do |config|
15
+ config.plural = 'task/categories'
16
+ end
17
+
18
+ serializable_config do |config|
19
+ config.collection_root = 'taskCategories'
20
+ config.root = 'taskCategory'
21
+ config.attribute_to_assign = :name
22
+ end
23
+
24
+ attribute :name
25
+
26
+ validates :name, presence: true
27
+
28
+ has_many :tasks
29
+
30
+ def id; name; end
31
+ end
32
+ end
@@ -1,6 +1,6 @@
1
1
  module CapsuleCRM
2
2
  class Track
3
- include Virtus
3
+ include Virtus.model
4
4
 
5
5
  extend ActiveModel::Naming
6
6
  include ActiveModel::Conversion
@@ -1,6 +1,6 @@
1
1
  module CapsuleCRM
2
2
  class User
3
- include Virtus
3
+ include Virtus.model
4
4
 
5
5
  extend ActiveModel::Naming
6
6
  include ActiveModel::Conversion
@@ -1,3 +1,3 @@
1
1
  module CapsuleCrm
2
- VERSION = '1.4.0'
2
+ VERSION = '1.5.0'
3
3
  end
@@ -1,6 +1,6 @@
1
1
  module CapsuleCRM
2
2
  class Website
3
- include Virtus
3
+ include Virtus.model
4
4
  include CapsuleCRM::Serializable
5
5
 
6
6
  extend ActiveModel::Naming
data/lib/capsule_crm.rb CHANGED
@@ -42,6 +42,7 @@ require 'capsule_crm/organization'
42
42
  require 'capsule_crm/participant'
43
43
  require 'capsule_crm/person'
44
44
  require 'capsule_crm/milestone'
45
+ require 'capsule_crm/task_category'
45
46
  require 'capsule_crm/track'
46
47
  require 'capsule_crm/version'
47
48
  require 'capsule_crm/faraday/middleware/raise_error'
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  class CapsuleCRM::BelongsToAssociationTest
4
- include Virtus
4
+ include Virtus.model
5
5
 
6
6
  attribute :name
7
7
 
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  class BelongsToTest
4
- include Virtus
4
+ include Virtus.model
5
5
  include CapsuleCRM::Associations
6
6
 
7
7
  belongs_to :person
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  class CapsuleCRM::SomeClass
4
- include Virtus
4
+ include Virtus.model
5
5
 
6
6
  attribute :name
7
7
 
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  class Parent
4
- include Virtus
4
+ include Virtus.model
5
5
  include CapsuleCRM::Associations
6
6
  include CapsuleCRM::Querying::Configuration
7
7
 
@@ -22,7 +22,7 @@ class Parent
22
22
  end
23
23
 
24
24
  class Child
25
- include Virtus
25
+ include Virtus.model
26
26
  include CapsuleCRM::Associations
27
27
  include CapsuleCRM::Querying::Configuration
28
28
  include CapsuleCRM::Serializable
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  class CapsuleCRM::AssociationsTest
4
- include Virtus
4
+ include Virtus.model
5
5
  include CapsuleCRM::Associations
6
6
 
7
7
  has_many :whatevers, class_name: 'CapsuleCRM::Party'
@@ -50,8 +50,6 @@ describe CapsuleCRM::CustomField do
50
50
  end
51
51
 
52
52
  it 'should have a root element of "customField"' do
53
- p described_class.serializable_options
54
- p subject
55
53
  expect(subject.keys.first).to eql('customField')
56
54
  end
57
55
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  class SerializableTest
4
- include Virtus
4
+ include Virtus.model
5
5
  include CapsuleCRM::Associations
6
6
 
7
7
  attribute :id, Integer
@@ -11,7 +11,7 @@ class SerializableTest
11
11
  end
12
12
 
13
13
  class SerializableInverse
14
- include Virtus
14
+ include Virtus.model
15
15
  include CapsuleCRM::Associations
16
16
  end
17
17
 
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  class TaggableItem
4
4
  include CapsuleCRM::Taggable
5
- include Virtus
5
+ include Virtus.model
6
6
 
7
7
  attribute :id
8
8
  end
@@ -87,7 +87,7 @@ describe CapsuleCRM::Taggable do
87
87
 
88
88
  describe '#api_singular_name' do
89
89
  it 'turns the class name into appropriate api name' do
90
- TaggableItem.new.api_singular_name.should == 'taggableitem'
90
+ TaggableItem.new.api_singular_name.should == 'taggableitem'
91
91
  end
92
92
 
93
93
  it 'gives the superclass unless Object to work with Organization/Person subclassing of Party' do
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe CapsuleCRM::TaskCategory do
4
+ before { configure }
5
+
6
+ it_behaves_like 'listable', '/task/categories', 'categories', 6
7
+ end
@@ -74,18 +74,6 @@ describe CapsuleCRM::Task do
74
74
  it { should be_persisted }
75
75
  end
76
76
 
77
- describe '.categories' do
78
- subject { CapsuleCRM::Task.categories }
79
- before do
80
- stub_request(:get, /\/api\/task\/categories$/).
81
- to_return(body: File.read('spec/support/task_categories.json'))
82
- end
83
-
84
- it do
85
- expect(subject).to eql(%w(Call Email Follow-up Meeting Milestone Send))
86
- end
87
- end
88
-
89
77
  describe '#to_capsule_json' do
90
78
  let(:task) { Fabricate.build(:task) }
91
79
 
@@ -0,0 +1,5 @@
1
+ {
2
+ "taskCategories": {
3
+ "@size": "0"
4
+ }
5
+ }
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.4.0
4
+ version: 1.5.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-17 00:00:00.000000000 Z
11
+ date: 2014-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.5.4
75
+ version: 1.0.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.5.4
82
+ version: 1.0.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: coveralls
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -303,6 +303,7 @@ files:
303
303
  - lib/capsule_crm/tag.rb
304
304
  - lib/capsule_crm/taggable.rb
305
305
  - lib/capsule_crm/task.rb
306
+ - lib/capsule_crm/task_category.rb
306
307
  - lib/capsule_crm/track.rb
307
308
  - lib/capsule_crm/user.rb
308
309
  - lib/capsule_crm/version.rb
@@ -341,11 +342,13 @@ files:
341
342
  - spec/lib/capsule_crm/serializer_spec.rb
342
343
  - spec/lib/capsule_crm/tag_spec.rb
343
344
  - spec/lib/capsule_crm/taggable_spec.rb
345
+ - spec/lib/capsule_crm/task_category_spec.rb
344
346
  - spec/lib/capsule_crm/task_spec.rb
345
347
  - spec/lib/capsule_crm/track_spec.rb
346
348
  - spec/lib/capsule_crm/user_spec.rb
347
349
  - spec/spec_helper.rb
348
350
  - spec/support/all_cases.json
351
+ - spec/support/all_categories.json
349
352
  - spec/support/all_countries.json
350
353
  - spec/support/all_currencies.json
351
354
  - spec/support/all_customfields.json
@@ -364,6 +367,7 @@ files:
364
367
  - spec/support/helpers.rb
365
368
  - spec/support/history.json
366
369
  - spec/support/no_cases.json
370
+ - spec/support/no_categories.json
367
371
  - spec/support/no_countries.json
368
372
  - spec/support/no_currencies.json
369
373
  - spec/support/no_customfields.json
@@ -384,7 +388,6 @@ files:
384
388
  - spec/support/shared_examples/persistable.rb
385
389
  - spec/support/single_person.json
386
390
  - spec/support/task.json
387
- - spec/support/task_categories.json
388
391
  homepage: ''
389
392
  licenses: []
390
393
  metadata: {}
@@ -444,11 +447,13 @@ test_files:
444
447
  - spec/lib/capsule_crm/serializer_spec.rb
445
448
  - spec/lib/capsule_crm/tag_spec.rb
446
449
  - spec/lib/capsule_crm/taggable_spec.rb
450
+ - spec/lib/capsule_crm/task_category_spec.rb
447
451
  - spec/lib/capsule_crm/task_spec.rb
448
452
  - spec/lib/capsule_crm/track_spec.rb
449
453
  - spec/lib/capsule_crm/user_spec.rb
450
454
  - spec/spec_helper.rb
451
455
  - spec/support/all_cases.json
456
+ - spec/support/all_categories.json
452
457
  - spec/support/all_countries.json
453
458
  - spec/support/all_currencies.json
454
459
  - spec/support/all_customfields.json
@@ -467,6 +472,7 @@ test_files:
467
472
  - spec/support/helpers.rb
468
473
  - spec/support/history.json
469
474
  - spec/support/no_cases.json
475
+ - spec/support/no_categories.json
470
476
  - spec/support/no_countries.json
471
477
  - spec/support/no_currencies.json
472
478
  - spec/support/no_customfields.json
@@ -487,4 +493,3 @@ test_files:
487
493
  - spec/support/shared_examples/persistable.rb
488
494
  - spec/support/single_person.json
489
495
  - spec/support/task.json
490
- - spec/support/task_categories.json