Class: ConstantContact::ContactList

Inherits:
Base
  • Object
show all
Includes:
Searchable
Defined in:
lib/constantcontact/contact_list.rb

Constant Summary

Constant Summary

Constants inherited from Base

Base::DATE_FORMAT

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods included from Searchable

included

Methods inherited from Base

api_key, api_key=, collection_path, connection, element_path, parse_id, #to_atom

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ConstantContact::Base

Class Method Details

+ (Object) find_by_name(name)



23
24
25
26
# File 'lib/constantcontact/contact_list.rb', line 23

def self.find_by_name(name)
  lists = self.find :all
  lists.find{|list| list.Name == name}
end

Instance Method Details

- (Object) to_xml



6
7
8
9
10
11
12
13
# File 'lib/constantcontact/contact_list.rb', line 6

def to_xml
  xml = Builder::XmlMarkup.new
  xml.tag!("ContactList", :xmlns => "http://ws.constantcontact.com/ns/1.0/") do
    self.attributes.each do |k, v| 
      xml.tag!( k.to_s.camelize, v ) unless v.respond_to?(:to_xml)
    end
  end
end

- (Object) url



15
16
17
18
19
20
21
# File 'lib/constantcontact/contact_list.rb', line 15

def url
  if id =~ /http/
    "#{id}"
  else
    "#{::Base.site}#{::Base.user}/lists/#{id}"
  end
end