Class: Zendesk2::Category
- Inherits:
-
Object
- Object
- Zendesk2::Category
show all
- Includes:
- Model
- Defined in:
- lib/zendesk2/category.rb
Instance Attribute Summary
Attributes included from Model
#errors
Instance Method Summary
collapse
Methods included from Model
#destroy, #destroyed?, #missing_attributes, #save, #update!
Instance Method Details
#created_at ⇒ Time
9
|
# File 'lib/zendesk2/category.rb', line 9
attribute :created_at, type: :time
|
#description ⇒ String
11
|
# File 'lib/zendesk2/category.rb', line 11
attribute :description, type: :string
|
#destroy! ⇒ Object
21
22
23
24
25
|
# File 'lib/zendesk2/category.rb', line 21
def destroy!
requires :identity
cistern.destroy_category('category' => { 'id' => identity })
end
|
#id ⇒ Integer
6
|
# File 'lib/zendesk2/category.rb', line 6
identity :id, type: :integer
|
#name ⇒ String
13
|
# File 'lib/zendesk2/category.rb', line 13
attribute :name, type: :string
|
#position ⇒ Integer
15
|
# File 'lib/zendesk2/category.rb', line 15
attribute :position, type: :integer
|
#save! ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/zendesk2/category.rb', line 27
def save!
data = if new_record?
requires :name
cistern.create_category(params).body['category']
else
requires :identity
cistern.update_category(params).body['category']
end
merge_attributes(data)
end
|
#updated_at ⇒ Time
17
|
# File 'lib/zendesk2/category.rb', line 17
attribute :updated_at, type: :time
|
#url ⇒ String
19
|
# File 'lib/zendesk2/category.rb', line 19
attribute :url, type: :string
|