Sha256: 235b1f9da2058194c4cf9a5cae68586bb8cbf99a425ccfda6b0f2db2ff848016

Contents?: true

Size: 551 Bytes

Versions: 7

Compression:

Stored size: 551 Bytes

Contents

module Legato
  module Management
    module Finder
      def base_uri
        "https://www.googleapis.com/analytics/v3/management"
      end

      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
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
legato-0.3.3 lib/legato/management/finder.rb
legato-0.3.2 lib/legato/management/finder.rb
legato-0.3.1 lib/legato/management/finder.rb
legato-0.3.0 lib/legato/management/finder.rb
legato-0.2.0 lib/legato/management/finder.rb
legato-0.1.0 lib/legato/management/finder.rb
legato-0.0.10 lib/legato/management/finder.rb