Class: Zensana::Zendesk::View

Inherits:
Object
  • Object
show all
Includes:
Access
Defined in:
lib/zensana/models/zendesk/view.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Access

#zendesk_service

Constructor Details

#initializeView

Returns a new instance of View.



10
11
12
# File 'lib/zensana/models/zendesk/view.rb', line 10

def initialize
  @attributes = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



27
28
29
# File 'lib/zensana/models/zendesk/view.rb', line 27

def method_missing(name, *args, &block)
  attributes[name.to_s] || super
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



8
9
10
# File 'lib/zensana/models/zendesk/view.rb', line 8

def attributes
  @attributes
end

Instance Method Details

#find(id) ⇒ Object



14
15
16
# File 'lib/zensana/models/zendesk/view.rb', line 14

def find(id)
  @attributes = fetch(id)
end

#idObject



23
24
25
# File 'lib/zensana/models/zendesk/view.rb', line 23

def id
  attributes['id']
end

#ticketsObject

Raises:



18
19
20
21
# File 'lib/zensana/models/zendesk/view.rb', line 18

def tickets
  raise NotFound, "You must fetch the view first!" unless self.id
  get_tickets self.id
end