Class: Zendesk2::Group

Inherits:
Object
  • Object
show all
Extended by:
Attributes
Includes:
Model
Defined in:
lib/zendesk2/group.rb

Instance Attribute Summary

Attributes included from Model

#errors

Instance Method Summary collapse

Methods included from Attributes

assoc_accessor, assoc_reader, assoc_writer

Methods included from Model

#destroy, #missing_attributes, #save, #update!

Instance Method Details

#created_atTime

Returns The time the group was created.

Returns:

  • (Time)

    The time the group was created



11
# File 'lib/zendesk2/group.rb', line 11

attribute :created_at, type: :time

#deletedBoolean

Returns Deleted groups get marked as such.

Returns:

  • (Boolean)

    Deleted groups get marked as such



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

attribute :deleted, type: :boolean

#destroy!Object



35
36
37
38
39
40
41
# File 'lib/zendesk2/group.rb', line 35

def destroy!
  requires :identity

  cistern.destroy_group('group' => { 'id' => identity })

  self.deleted = true
end

#destroyed?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/zendesk2/group.rb', line 43

def destroyed?
  deleted
end

#idInteger

Returns Automatically assigned when creating groups.

Returns:

  • (Integer)

    Automatically assigned when creating groups



8
# File 'lib/zendesk2/group.rb', line 8

identity :id, type: :integer

#nameString

Returns The name of the group.

Returns:

  • (String)

    The name of the group



15
# File 'lib/zendesk2/group.rb', line 15

attribute :name, type: :string

#save!Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/zendesk2/group.rb', line 21

def save!
  data = if new_record?
           requires :name

           cistern.create_group('group' => attributes)
         else
           requires :identity

           cistern.update_group('group' => attributes)
         end.body['group']

  merge_attributes(data)
end

#updated_atTime

Returns The time of the last update of the group.

Returns:

  • (Time)

    The time of the last update of the group



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

attribute :updated_at, type: :time

#urlString

Returns The API url of this group.

Returns:

  • (String)

    The API url of this group



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

attribute :url, type: :string