Module: Legato::Management::Finder

Included in:
Account, Goal, Profile, Segment, WebProperty
Defined in:
lib/legato/management/finder.rb

Instance Method Summary collapse

Instance Method Details

#all(user, path = default_path) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/legato/management/finder.rb', line 8

def all(user, path=default_path)
  uri = if user.api_key
    # oauth + api_key
    base_uri + path + "?key=#{user.api_key}"
  else
    # oauth 2
    base_uri + path
  end

  json = user.access_token.get(base_uri + path).body
  items = MultiJson.decode(json).fetch('items', [])
  items.map {|item| new(item, user)}
end

#base_uriObject



4
5
6
# File 'lib/legato/management/finder.rb', line 4

def base_uri
  "https://www.googleapis.com/analytics/v3/management"
end