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/management/segment.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



56
57
58
# File 'lib/garb.rb', line 56

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


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

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

#parse_properties(entry) ⇒ Object



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

def parse_properties(entry)
  Hash[entry['dxp:property'].map {|p| [Garb.from_ga(p['name']),p['value']]}]
end

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



49
50
51
52
53
# File 'lib/garb.rb', line 49

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

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