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/result_set.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, ResultSet, 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



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

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



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

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



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

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

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