Module: Garb

Extended by:
Garb
Included in:
Garb
Defined in:
lib/garb.rb,
lib/garb/goal.rb,
lib/garb/step.rb,
lib/garb/model.rb,
lib/garb/report.rb,
lib/garb/account.rb,
lib/garb/profile.rb,
lib/garb/session.rb,
lib/garb/version.rb,
lib/garb/resource.rb,
lib/garb/destination.rb,
lib/garb/data_request.rb,
lib/garb/management/feed.rb,
lib/garb/management/goal.rb,
lib/garb/profile_reports.rb,
lib/garb/report_response.rb,
lib/garb/report_parameter.rb,
lib/garb/filter_parameters.rb,
lib/garb/management/account.rb,
lib/garb/management/profile.rb,
lib/garb/account_feed_request.rb,
lib/garb/authentication_request.rb,
lib/garb/management/web_property.rb

Defined Under Namespace

Modules: Management, Model, ProfileReports, Resource, Version Classes: Account, AccountFeedRequest, AuthenticationRequest, DataRequest, Destination, FilterParameters, Goal, Profile, Report, ReportParameter, ReportResponse, Session, Step

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#from_google_analytics(thing) ⇒ Object Also known as: from_ga



54
55
56
# File 'lib/garb.rb', line 54

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


66
67
68
# File 'lib/garb.rb', line 66

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

#parse_properties(entry) ⇒ Object



59
60
61
62
63
64
# File 'lib/garb.rb', line 59

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

#to_google_analytics(thing) ⇒ Object Also known as: to_ga



47
48
49
50
51
# File 'lib/garb.rb', line 47

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

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