Sha256: 14b76457ab0e7edf80c0d578777da58af48cd039bb8613290ec17488c5fcac85
Contents?: true
Size: 647 Bytes
Versions: 3
Compression:
Stored size: 647 Bytes
Contents
module Garb class ReportResponse KEYS = ['dxp:metric', 'dxp:dimension'] def initialize(response_body) @xml = response_body end def results @results ||= parse end private def parse entries.map do |entry| hash = values_for(entry).inject({}) do |h, v| h.merge(Garb.from_ga(v['name']) => v['value']) end OpenStruct.new(hash) end end def entries entry_hash = Crack::XML.parse(@xml) entry_hash ? [entry_hash['feed']['entry']].flatten : [] end def values_for(entry) KEYS.map {|k| entry[k]}.flatten.compact end end end
Version data entries
3 entries across 3 versions & 3 rubygems
Version | Path |
---|---|
shingara-garb-0.7.6 | lib/garb/report_response.rb |
garb-no-activesupport-0.7.4 | lib/garb/report_response.rb |
garb-0.7.4 | lib/garb/report_response.rb |