Class: Zimbra::DomainService

Inherits:
HandsoapService show all
Defined in:
lib/zimbra/domain.rb

Defined Under Namespace

Classes: Builder, Parser

Instance Method Summary collapse

Methods inherited from HandsoapService

#on_create_document, #on_response_document

Methods included from HandsoapUriOverrides

#envelope_namespace, #request_content_type, #uri

Methods included from HandsoapNamespaces

#request_namespaces, #response_namespaces

Methods included from HandsoapErrors

#http_error?, #http_not_found?, #on_after_create_http_request, #on_http_error, #report_error, #soap_fault_not_found?

Instance Method Details

#allObject



43
44
45
46
# File 'lib/zimbra/domain.rb', line 43

def all
  xml = invoke("n2:GetAllDomainsRequest")
  Parser.get_all_response(xml)
end

#create(name, attributes = {}) ⇒ Object



48
49
50
51
52
53
# File 'lib/zimbra/domain.rb', line 48

def create(name, attributes = {})
  xml = invoke("n2:CreateDomainRequest") do |message|
    Builder.create(message, name)
  end
  Parser.domain_response(xml/"//n2:domain")
end

#delete(dist) ⇒ Object



78
79
80
81
82
# File 'lib/zimbra/domain.rb', line 78

def delete(dist)
  xml = invoke("n2:DeleteDomainRequest") do |message|
    Builder.delete(message, dist.id)
  end
end

#get_by_id(id) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/zimbra/domain.rb', line 55

def get_by_id(id)
  xml = invoke("n2:GetDomainRequest") do |message|
    Builder.get_by_id(message, id)
  end
  return nil if soap_fault_not_found?
  Parser.domain_response(xml/"//n2:domain")
end

#get_by_name(name) ⇒ Object



63
64
65
66
67
68
69
# File 'lib/zimbra/domain.rb', line 63

def get_by_name(name)
  xml = invoke("n2:GetDomainRequest") do |message|
    Builder.get_by_name(message, name)
  end
  return nil if soap_fault_not_found?
  Parser.domain_response(xml/"//n2:domain")
end

#modify(domain) ⇒ Object



71
72
73
74
75
76
# File 'lib/zimbra/domain.rb', line 71

def modify(domain)
  xml = invoke("n2:ModifyDomainRequest") do |message|
    Builder.modify(message, domain)
  end
  Parser.domain_response(xml/'//n2:domain')
end