class Zendesk2::Organization

Public Instance Methods

destroy!() click to toggle source
# File lib/zendesk2/organization.rb, line 35
def destroy!
  requires :identity

  cistern.destroy_organization('organization' => { 'id' => identity })
end
memberships() click to toggle source

@return [Zendesk2::Memberships] memberships associated with this organization

# File lib/zendesk2/organization.rb, line 65
def memberships
  requires :identity

  cistern.memberships(organization: self)
end
save!() click to toggle source
# 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
tickets() click to toggle source

@return [Zendesk2::Tickets] tickets associated with this organization

# File lib/zendesk2/organization.rb, line 72
def tickets
  requires :identity

  cistern.tickets.load(
    cistern.get_organization_tickets('organization_id' => identity).body['tickets']
  )
end
users() click to toggle source

@return [Zendesk2::Users] users associated with this organization

# File lib/zendesk2/organization.rb, line 56
def users
  requires :identity

  cistern.users.load(
    cistern.get_organization_users('organization' => { 'id' => identity }).body['users']
  )
end