Class: Zendesk2::View

Inherits:
Object
  • Object
show all
Extended by:
Attributes
Includes:
Model
Defined in:
lib/zendesk2/view.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, #destroyed?, #missing_attributes, #save, #update!

Instance Method Details

#activeBoolean

Returns Useful for determining if the view should be displayed.

Returns:

  • (Boolean)

    Useful for determining if the view should be displayed



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

attribute :active, type: :boolean

#conditionsHash

Returns An object describing how the view is constructed.

Returns:

  • (Hash)

    An object describing how the view is constructed



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

attribute :conditions, type: :hash, default: {}

#createObject



31
32
33
34
35
36
# File 'lib/zendesk2/view.rb', line 31

def create
  requires :execution, :title

  data = cistern.create_view('view' => request_data).body
  merge_attributes(data['view'])
end

#created_atTime

Returns The time the view was created.

Returns:

  • (Time)

    The time the view was created



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

attribute :created_at, type: :time

#destroy!Object



51
52
53
54
55
# File 'lib/zendesk2/view.rb', line 51

def destroy!
  requires :identity

  cistern.destroy_view('view' => { 'id' => identity })
end

#executionHash

Returns An object describing how the view should be executed.

Returns:

  • (Hash)

    An object describing how the view should be executed



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

attribute :execution, type: :hash, default: {}

#idInteger

Returns Automatically assigned when created.

Returns:

  • (Integer)

    Automatically assigned when created



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

identity :id, type: :integer

#restrictionHash

Returns Who may access this account. Will be null when everyone in the account can access it.

Returns:

  • (Hash)

    Who may access this account. Will be null when everyone in the account can access it.



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

attribute :restriction, type: :hash, default: {}

#save!Object



27
28
29
# File 'lib/zendesk2/view.rb', line 27

def save!
  new_record? ? create : update
end

#sla_idInteger

Returns If the view is for an SLA this is the id.

Returns:

  • (Integer)

    If the view is for an SLA this is the id



21
# File 'lib/zendesk2/view.rb', line 21

attribute :sla_id, type: :integer

#ticketsObject



45
46
47
48
49
# File 'lib/zendesk2/view.rb', line 45

def tickets
  requires :identity

  cistern.tickets(view_id: identity)
end

#titleString

Returns The title of the view.

Returns:

  • (String)

    The title of the view



23
# File 'lib/zendesk2/view.rb', line 23

attribute :title, type: :string

#updateObject



38
39
40
41
42
43
# File 'lib/zendesk2/view.rb', line 38

def update
  requires :identity

  data = cistern.update_view('view' => request_data.merge('id' => identity)).body
  merge_attributes(data['view'])
end

#updated_atTime

Returns The time of the last update of the view.

Returns:

  • (Time)

    The time of the last update of the view



25
# File 'lib/zendesk2/view.rb', line 25

attribute :updated_at, type: :time