Class: Zendesk2::View
- Inherits:
-
Object
- Object
- Zendesk2::View
- Extended by:
- Attributes
- Includes:
- Model
- Defined in:
- lib/zendesk2/view.rb
Instance Attribute Summary
Attributes included from Model
Instance Method Summary collapse
-
#active ⇒ Boolean
Useful for determining if the view should be displayed.
-
#conditions ⇒ Hash
An object describing how the view is constructed.
- #create ⇒ Object
-
#created_at ⇒ Time
The time the view was created.
- #destroy! ⇒ Object
-
#execution ⇒ Hash
An object describing how the view should be executed.
-
#id ⇒ Integer
Automatically assigned when created.
-
#restriction ⇒ Hash
Who may access this account.
- #save! ⇒ Object
-
#sla_id ⇒ Integer
If the view is for an SLA this is the id.
- #tickets ⇒ Object
-
#title ⇒ String
The title of the view.
- #update ⇒ Object
-
#updated_at ⇒ Time
The time of the last update of the view.
Methods included from Attributes
assoc_accessor, assoc_reader, assoc_writer
Methods included from Model
#destroy, #destroyed?, #missing_attributes, #save, #update!
Instance Method Details
#active ⇒ Boolean
Returns Useful for determining if the view should be displayed.
11 |
# File 'lib/zendesk2/view.rb', line 11 attribute :active, type: :boolean |
#conditions ⇒ Hash
Returns An object describing how the view is constructed.
13 |
# File 'lib/zendesk2/view.rb', line 13 attribute :conditions, type: :hash, default: {} |
#create ⇒ Object
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_at ⇒ Time
Returns 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 |
#execution ⇒ Hash
Returns An object describing how the view should be executed.
17 |
# File 'lib/zendesk2/view.rb', line 17 attribute :execution, type: :hash, default: {} |
#id ⇒ Integer
Returns Automatically assigned when created.
8 |
# File 'lib/zendesk2/view.rb', line 8 identity :id, type: :integer |
#restriction ⇒ Hash
Returns 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_id ⇒ Integer
Returns If the view is for an SLA this is the id.
21 |
# File 'lib/zendesk2/view.rb', line 21 attribute :sla_id, type: :integer |
#tickets ⇒ Object
45 46 47 48 49 |
# File 'lib/zendesk2/view.rb', line 45 def tickets requires :identity cistern.tickets(view_id: identity) end |
#title ⇒ String
Returns The title of the view.
23 |
# File 'lib/zendesk2/view.rb', line 23 attribute :title, type: :string |
#update ⇒ Object
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_at ⇒ Time
Returns The time of the last update of the view.
25 |
# File 'lib/zendesk2/view.rb', line 25 attribute :updated_at, type: :time |