Method: Contacts::Base#contacts

Defined in:
lib/contacts/base.rb

#contacts(options = {}) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/contacts/base.rb', line 33

def contacts(options = {})
  return @contacts if @contacts
  if connected?
    url = URI.parse(contact_list_url)
    http = open_http(url)
    resp, data = http.get("#{url.path}?#{url.query}",
      "Cookie" => @cookies
    )
    
    if resp.code_type != Net::HTTPOK
      raise ConnectionError, self.class.const_get(:PROTOCOL_ERROR)
    end
    
    parse(data, options)
  end
end