Class: Mosaic::Lyris::Demographic
- Defined in:
- lib/mosaic/lyris/demographic.rb
Instance Attribute Summary collapse
-
#enabled ⇒ Object
readonly
Returns the value of attribute enabled.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#list_id ⇒ Object
readonly
Returns the value of attribute list_id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class 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
#enabled ⇒ Object (readonly)
Returns the value of attribute enabled.
4 5 6 |
# File 'lib/mosaic/lyris/demographic.rb', line 4 def enabled @enabled end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
4 5 6 |
# File 'lib/mosaic/lyris/demographic.rb', line 4 def group @group end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/mosaic/lyris/demographic.rb', line 4 def id @id end |
#list_id ⇒ Object (readonly)
Returns the value of attribute list_id.
4 5 6 |
# File 'lib/mosaic/lyris/demographic.rb', line 4 def list_id @list_id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/mosaic/lyris/demographic.rb', line 4 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/mosaic/lyris/demographic.rb', line 4 def @options end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
4 5 6 |
# File 'lib/mosaic/lyris/demographic.rb', line 4 def size @size end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/mosaic/lyris/demographic.rb', line 4 def type @type end |
Class Method Details
.add(type, name, options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/mosaic/lyris/demographic.rb', line 14 def add(type, name, = {}) (type, ) reply = post('demographic', 'add') do |request| request.MLID [:list_id] if [:list_id] put_data(request, demographic_type(type), name) put_array_data(request, 'option', [:option]) put_data(request, 'state', 'enabled') if [:enabled] put_data(request, 'size', [:size]) if [:size] end new(.merge(:id => reply.at('/DATASET/DATA').inner_html.to_i, :name => name, :type => type)) end |
.query(what, options = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/mosaic/lyris/demographic.rb', line 26 def query(what, = {}) reply = post('demographic', query_type(what)) do |request| request.MLID [:list_id] if [:list_id] end reply.search('/DATASET/RECORD').collect do |record| new :enabled => ([:enabled, :enabled_details].include?(what) || get_boolean_data(record, 'state', 'enabled')), :group => get_data(record, "group"), :id => get_integer_data(record, 'id'), :list_id => [:list_id], :name => get_data(record, 'name'), :options => get_array_data(record, 'option'), :size => get_integer_data(record, 'size'), :type => get_data(record, 'type').downcase.gsub(/ /,'_').to_sym end end |