Class: Zendesk2::Organization
- Inherits:
-
Object
- Object
- Zendesk2::Organization
- Includes:
- Model
- Defined in:
- lib/zendesk2/organization.rb
Instance Attribute Summary
Attributes included from Model
Instance Method Summary collapse
-
#created_at ⇒ Date
The time the organization was created.
- #destroy! ⇒ Object
-
#details ⇒ String
In this field you can store any details obout the organization.
-
#domain_names ⇒ Array
An array of domain names associated with this organization.
-
#external_id ⇒ String
A unique external id, you can use this to associate organizations to an external record.
-
#group_id ⇒ Integer
New tickets from users in this organization will automatically be put in this group.
-
#id ⇒ integer
Automatically assigned when creating organization.
-
#memberships ⇒ Zendesk2::Memberships
Memberships associated with this organization.
-
#name ⇒ String
The name of the organization.
-
#notes ⇒ String
In this field you can store any notes you have about the organization.
-
#organization_fields ⇒ Hash
Custom fields for this organization.
- #save! ⇒ Object
-
#shared_comments ⇒ Boolean
End users in this organization are able to see each other’s comments on tickets.
-
#shared_tickets ⇒ Boolean
End users in this organization are able to see each other’s tickets.
-
#tags ⇒ Array
The tags of the organization.
-
#tickets ⇒ Zendesk2::Tickets
Tickets associated with this organization.
-
#updated_at ⇒ Date
The time of the last update of the organization.
-
#url ⇒ String
The API url of this organization.
-
#users ⇒ Zendesk2::Users
Users associated with this organization.
Methods included from Model
#destroy, #destroyed?, #missing_attributes, #save, #update!
Instance Method Details
#created_at ⇒ Date
Returns The time the organization was created.
9 |
# File 'lib/zendesk2/organization.rb', line 9 attribute :created_at, type: :time |
#destroy! ⇒ Object
35 36 37 38 39 |
# File 'lib/zendesk2/organization.rb', line 35 def destroy! requires :identity cistern.destroy_organization('organization' => { 'id' => identity }) end |
#details ⇒ String
Returns In this field you can store any details obout the organization. e.g. the address.
11 |
# File 'lib/zendesk2/organization.rb', line 11 attribute :details, type: :string |
#domain_names ⇒ Array
Returns An array of domain names associated with this organization.
13 |
# File 'lib/zendesk2/organization.rb', line 13 attribute :domain_names, type: :array |
#external_id ⇒ String
Returns A unique external id, you can use this to associate organizations to an external record.
15 |
# File 'lib/zendesk2/organization.rb', line 15 attribute :external_id, type: :string |
#group_id ⇒ Integer
Returns New tickets from users in this organization will automatically be put in this group.
17 |
# File 'lib/zendesk2/organization.rb', line 17 attribute :group_id, type: :integer |
#id ⇒ integer
Returns Automatically assigned when creating organization.
6 |
# File 'lib/zendesk2/organization.rb', line 6 identity :id, type: :integer |
#memberships ⇒ Zendesk2::Memberships
Returns memberships associated with this organization.
65 66 67 68 69 |
# File 'lib/zendesk2/organization.rb', line 65 def memberships requires :identity cistern.memberships(organization: self) end |
#name ⇒ String
Returns The name of the organization.
19 |
# File 'lib/zendesk2/organization.rb', line 19 attribute :name, type: :string |
#notes ⇒ String
Returns In this field you can store any notes you have about the organization.
21 |
# File 'lib/zendesk2/organization.rb', line 21 attribute :notes, type: :string |
#organization_fields ⇒ Hash
Returns Custom fields for this organization.
23 |
# File 'lib/zendesk2/organization.rb', line 23 attribute :organization_fields, type: :hash |
#save! ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/zendesk2/organization.rb', line 41 def save! data = if new_record? requires :name cistern.create_organization('organization' => attributes) else requires :identity cistern.update_organization('organization' => attributes) end.body['organization'] merge_attributes(data) end |
#shared_comments ⇒ Boolean
Returns End users in this organization are able to see each other’s comments on tickets.
25 |
# File 'lib/zendesk2/organization.rb', line 25 attribute :shared_comments, type: :boolean |
#shared_tickets ⇒ Boolean
Returns End users in this organization are able to see each other’s tickets.
27 |
# File 'lib/zendesk2/organization.rb', line 27 attribute :shared_tickets, type: :boolean |
#tags ⇒ Array
Returns The tags of the organization.
29 |
# File 'lib/zendesk2/organization.rb', line 29 attribute :tags, type: :array |
#tickets ⇒ Zendesk2::Tickets
Returns tickets associated with this organization.
72 73 74 75 76 77 78 |
# File 'lib/zendesk2/organization.rb', line 72 def tickets requires :identity cistern.tickets.load( cistern.get_organization_tickets('organization_id' => identity).body['tickets'] ) end |
#updated_at ⇒ Date
Returns The time of the last update of the organization.
31 |
# File 'lib/zendesk2/organization.rb', line 31 attribute :updated_at, type: :time |
#url ⇒ String
Returns The API url of this organization.
33 |
# File 'lib/zendesk2/organization.rb', line 33 attribute :url, type: :string |
#users ⇒ Zendesk2::Users
Returns users associated with this organization.
56 57 58 59 60 61 62 |
# File 'lib/zendesk2/organization.rb', line 56 def users requires :identity cistern.users.load( cistern.get_organization_users('organization' => { 'id' => identity }).body['users'] ) end |