Sha256: e131efd605d9a5a35e2b53a7e2caee1857018d7e45d3b298058e96b840ecd717

Contents?: true

Size: 604 Bytes

Versions: 1

Compression:

Stored size: 604 Bytes

Contents

module Garb
  module Management
    class Feed
      BASE_URL = "https://www.google.com/analytics/feeds/datasources/ga"

      attr_reader :request

      def initialize(session, path)
        @request = DataRequest.new(session, BASE_URL+path)
      end

      def parsed_response
        @parsed_response ||= Crack::XML.parse(response.body)
      end

      def entries
        # possible to have nil entries, yuck
        parsed_response ? Array(parsed_response['feed']['entry']).flatten.compact : []
      end

      def response
        @response ||= request.send_request
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
garb-0.9.0 lib/garb/management/feed.rb