Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9366ebe
commit d01fffe
Showing
7 changed files
with
45 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module CapsuleCRM | ||
class TaskCategory | ||
include Virtus | ||
|
||
include ActiveModel::Naming | ||
include ActiveModel::Conversion | ||
include ActiveModel::Validations | ||
|
||
include CapsuleCRM::Associations | ||
include CapsuleCRM::Querying::Configuration | ||
include CapsuleCRM::Querying::FindAll | ||
include CapsuleCRM::Serializable | ||
|
||
queryable_config do |config| | ||
config.plural = 'task/categories' | ||
end | ||
|
||
serializable_config do |config| | ||
config.collection_root = 'taskCategories' | ||
config.root = 'taskCategory' | ||
config.attribute_to_assign = :name | ||
end | ||
|
||
attribute :name | ||
|
||
validates :name, presence: true | ||
|
||
has_many :tasks | ||
|
||
def id; name; end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require 'spec_helper' | ||
|
||
describe CapsuleCRM::TaskCategory do | ||
it_behaves_like 'listable', '/task/categories', 'categories', 6 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"taskCategories": { | ||
"@size": "0" | ||
} | ||
} |