Class: Zendesk2::Category

Inherits:
Object
  • Object
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_atTime



9
# File 'lib/zendesk2/category.rb', line 9

attribute :created_at, type: :time

#descriptionString



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

#idInteger



6
# File 'lib/zendesk2/category.rb', line 6

identity :id, type: :integer

#nameString



13
# File 'lib/zendesk2/category.rb', line 13

attribute :name, type: :string

#positionInteger



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_atTime



17
# File 'lib/zendesk2/category.rb', line 17

attribute :updated_at, type: :time

#urlString



19
# File 'lib/zendesk2/category.rb', line 19

attribute :url, type: :string