class Tend::Contact

Constants

ATTRIBUTES

Attributes

attributes[RW]

Public Class Methods

new(*args) click to toggle source
# File lib/tend/models/contact.rb, line 9
def initialize *args
  init(*args) do |att, value|
    case att
    when :segments
      a = []
      value.each do |h|
        a << Tend::Segment.new( h )
      end
      @segments = a
    when :campaign
      a = []
      value.each do |h|
        a << Tend::Campaign.new( h )
      end
      @campaigns = a
    when :referrer
      a = []
      value.each do |h|
        a << Tend::Referrer.new( h )
      end
      @referrers = a
    else
      send("#{att}=", value)
    end
  end
end

Public Instance Methods

segments(options = {}) click to toggle source
# File lib/tend/models/contact.rb, line 41
def segments options = {}
  return @segments if @segments && !options.delete(:reload)
  collection "segments", Tend::Segment, options
end
visits(options = {}) click to toggle source
# File lib/tend/models/contact.rb, line 36
def visits options = {}
  return @visits if @visits && !options.delete(:reload)
  collection "visits", Tend::Visit, options
end