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

Returns The time the category was created.

Returns:

  • (Time)

    The time the category was created



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

attribute :created_at, type: :time

#descriptionString

Returns The description of the category.

Returns:

  • (String)

    The description of the category



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

Returns Automatically assigned during creation.

Returns:

  • (Integer)

    Automatically assigned during creation



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

identity :id, type: :integer

#nameString

Returns The name of the category.

Returns:

  • (String)

    The name of the category



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

attribute :name, type: :string

#positionInteger

Returns The position of this category relative to other categories.

Returns:

  • (Integer)

    The position of this category relative to other categories



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

Returns The time of the last update of the category.

Returns:

  • (Time)

    The time of the last update of the category



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

attribute :updated_at, type: :time

#urlString

Returns The API url of this category.

Returns:

  • (String)

    The API url of this category



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

attribute :url, type: :string