Sha256: 1f8d3e0fb8a3168b99f8001c37f9a569c160dce284c6597ae6eccadf7910e197

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

require 'net/http'
require 'net/https'

require 'cgi'
require 'ostruct'
require 'crack'

begin
  require 'active_support/inflector'
rescue LoadError
  require 'active_support'
end

require 'garb/version'
require 'garb/authentication_request'
require 'garb/data_request'
require 'garb/account_feed_request'
require 'garb/session'
require 'garb/profile_reports'
require 'garb/step'
require 'garb/destination'
require 'garb/goal'
require 'garb/profile'
require 'garb/account'
require 'garb/filter_parameters'
require 'garb/report_parameter'
require 'garb/report_response'
require 'garb/resource'
require 'garb/report'

# management
require 'garb/management/feed'
require 'garb/management/account'
require 'garb/management/web_property'
require 'garb/management/profile'

require 'support'

module Garb
  GA = "http://schemas.google.com/analytics/2008"

  extend self

  def to_google_analytics(thing)
    return thing.to_google_analytics if thing.respond_to?(:to_google_analytics)

    "ga:#{thing.to_s.camelize(:lower)}"
  end
  alias :to_ga :to_google_analytics

  def from_google_analytics(thing)
    thing.to_s.gsub(/^ga\:/, '').underscore
  end
  alias :from_ga :from_google_analytics

  def parse_properties(entry)
    entry['dxp:property'].inject({}) do |hash, p|
      hash[Garb.from_ga(p['name'])] = p['value']
      hash
    end
  end

  def parse_link(entry, rel)
    entry['link'].detect {|link| link["rel"] == rel}['href']
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
garb-0.8.1 lib/garb.rb