Class: Garb::AccountFeedRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/garb/account_feed_request.rb

Constant Summary collapse

URL =
"https://www.google.com/analytics/feeds/accounts/default"

Instance Method Summary collapse

Constructor Details

#initialize(session = Session) ⇒ AccountFeedRequest

Returns a new instance of AccountFeedRequest.



5
6
7
# File 'lib/garb/account_feed_request.rb', line 5

def initialize(session = Session)
  @request = DataRequest.new(session, URL)
end

Instance Method Details

#entriesObject



17
18
19
# File 'lib/garb/account_feed_request.rb', line 17

def entries
  parsed_response ? Array(parsed_response['feed']['entry']).flatten.compact : []
end

#parsed_responseObject



13
14
15
# File 'lib/garb/account_feed_request.rb', line 13

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

#responseObject



9
10
11
# File 'lib/garb/account_feed_request.rb', line 9

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

#segmentsObject



21
22
23
# File 'lib/garb/account_feed_request.rb', line 21

def segments
  parsed_response ? Array(parsed_response['feed']['dxp:segment']).flatten.compact : []
end