Class: Mosaic::Lyris::List

Inherits:
Object
  • Object
show all
Defined in:
lib/mosaic/lyris/list.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Object

callback_url, configuration, configuration=, default_list_id, default_trigger_id, get_array_data, get_boolean_data, get_data, get_date_data, get_demographic_data, get_element, get_integer_data, get_integer_element, get_time_data, get_time_element, get_time_offset_data, get_xml_time_data, #initialize, load_configuration, logger, logger=, password, post, put_array_data, put_data, put_demographic_data, put_extra_data, server, site_id, #to_param, triggers

Constructor Details

This class inherits a constructor from Mosaic::Lyris::Object

Instance Attribute Details

#cache_timeObject (readonly)

Returns the value of attribute cache_time.



6
7
8
# File 'lib/mosaic/lyris/list.rb', line 6

def cache_time
  @cache_time
end

#clickthru_urlObject (readonly)

Returns the value of attribute clickthru_url.



6
7
8
# File 'lib/mosaic/lyris/list.rb', line 6

def clickthru_url
  @clickthru_url
end

Returns the value of attribute footer_html.



6
7
8
# File 'lib/mosaic/lyris/list.rb', line 6

def footer_html
  @footer_html
end

Returns the value of attribute footer_text.



6
7
8
# File 'lib/mosaic/lyris/list.rb', line 6

def footer_text
  @footer_text
end

#handle_autoreplyObject (readonly)

Returns the value of attribute handle_autoreply.



6
7
8
# File 'lib/mosaic/lyris/list.rb', line 6

def handle_autoreply
  @handle_autoreply
end

#handle_autoreply_emailObject (readonly)

Returns the value of attribute handle_autoreply_email.



6
7
8
# File 'lib/mosaic/lyris/list.rb', line 6

def handle_autoreply_email
  @handle_autoreply_email
end

#handle_unsubscribeObject (readonly)

Returns the value of attribute handle_unsubscribe.



6
7
8
# File 'lib/mosaic/lyris/list.rb', line 6

def handle_unsubscribe
  @handle_unsubscribe
end

#handle_unsubscribe_emailObject (readonly)

Returns the value of attribute handle_unsubscribe_email.



6
7
8
# File 'lib/mosaic/lyris/list.rb', line 6

def handle_unsubscribe_email
  @handle_unsubscribe_email
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/mosaic/lyris/list.rb', line 6

def id
  @id
end

#last_sentObject (readonly)

Returns the value of attribute last_sent.



6
7
8
# File 'lib/mosaic/lyris/list.rb', line 6

def last_sent
  @last_sent
end

#membersObject (readonly)

Returns the value of attribute members.



6
7
8
# File 'lib/mosaic/lyris/list.rb', line 6

def members
  @members
end

#messagesObject (readonly)

Returns the value of attribute messages.



6
7
8
# File 'lib/mosaic/lyris/list.rb', line 6

def messages
  @messages
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/mosaic/lyris/list.rb', line 6

def name
  @name
end

#reply_forward_emailObject (readonly)

Returns the value of attribute reply_forward_email.



6
7
8
# File 'lib/mosaic/lyris/list.rb', line 6

def reply_forward_email
  @reply_forward_email
end

#reply_forward_subjectObject (readonly)

Returns the value of attribute reply_forward_subject.



6
7
8
# File 'lib/mosaic/lyris/list.rb', line 6

def reply_forward_subject
  @reply_forward_subject
end

#reply_from_emailObject (readonly)

Returns the value of attribute reply_from_email.



6
7
8
# File 'lib/mosaic/lyris/list.rb', line 6

def reply_from_email
  @reply_from_email
end

#reply_from_nameObject (readonly)

Returns the value of attribute reply_from_name.



6
7
8
# File 'lib/mosaic/lyris/list.rb', line 6

def reply_from_name
  @reply_from_name
end

#statusObject (readonly)

Returns the value of attribute status.



6
7
8
# File 'lib/mosaic/lyris/list.rb', line 6

def status
  @status
end

Class Method Details

.add(name, attributes = {}) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/mosaic/lyris/list.rb', line 34

def add(name, attributes = {})
  reply = post('list', 'add') do |request|
    put_data(request, 'name', name)
    put_extra_data(request, 'CLICKTHRU_URL', attributes[:clickthru_url])
  end
  new attributes.merge(:id => reply.at('/DATASET/DATA').inner_html.to_i, :name => name)
end

.delete(id) ⇒ Object



42
43
44
45
46
47
# File 'lib/mosaic/lyris/list.rb', line 42

def delete(id)
  reply = post('list', 'delete') do |request|
    request.MLID id
  end
  new :id => id
end

.query(what) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/mosaic/lyris/list.rb', line 49

def query(what)
  reply = post('list', query_type(what))
  reply.search('/DATASET/RECORD').collect do |record|
    new :cache_time => get_xml_time_data(record, 'cache-time'),
        :id => get_integer_data(record, 'name', :id),
        :last_sent => get_date_data(record, 'last-sent'),
        :members => get_integer_data(record, 'members'),
        :messages => get_integer_data(record, 'messages'),
        :name => get_data(record, 'name'),
        :status => get_data(record, 'status')
  end
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/mosaic/lyris/list.rb', line 25

def active?
  status == 'active'
end

#archived?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/mosaic/lyris/list.rb', line 29

def archived?
  status == 'archived'
end