class GoodDataMarketo::MObject

Public Class Methods

new(data, config = {}) click to toggle source
# File lib/gooddata_marketo/models/child/mobj.rb, line 5
def initialize data, config = {}

  @object = {
      :type => data[:type],
      :id => data[:id],
      :raw => data
  }

  @headers = @object.keys.map{|k| k.to_s.capitalize! }
  @headers.pop()

  attributes = data[:attrib_list][:attrib]
  attribute_map = Hash.new
  attributes.map { |attr|
    @headers << property = attr[:name]
                value = attr[:value]
                attribute_map[property] = value
  }

  @attributes = attribute_map

end

Public Instance Methods

attributes(a = nil) click to toggle source
# File lib/gooddata_marketo/models/child/mobj.rb, line 48
def attributes a = nil

  if a
    @attributes[a]
  else
    @attributes
  end

end
headers() click to toggle source
# File lib/gooddata_marketo/models/child/mobj.rb, line 40
def headers
  @headers
end
id() click to toggle source
# File lib/gooddata_marketo/models/child/mobj.rb, line 44
def id
  @object[:id]
end
json()
Alias for: raw
object_type()
Alias for: type
raw() click to toggle source
# File lib/gooddata_marketo/models/child/mobj.rb, line 58
def raw
  @activity[:raw]
end
Also aliased as: json
to_a()
Alias for: to_row
to_row() click to toggle source
# File lib/gooddata_marketo/models/child/mobj.rb, line 32
def to_row
  row = [self.id,self.time,self.type,self.name]
  @attributes.each do |attr|
    row << attr[1]
  end
  row.map! { |i| i.to_s }
end
Also aliased as: to_a
type() click to toggle source
# File lib/gooddata_marketo/models/child/mobj.rb, line 28
def type
  @object[:type]
end
Also aliased as: object_type