Class: Garb::Management::Feed
- Inherits:
-
Object
- Object
- Garb::Management::Feed
- Defined in:
- lib/garb/management/feed.rb
Constant Summary collapse
- BASE_URL =
"https://www.google.com/analytics/feeds/datasources/ga"
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
- #entries ⇒ Object
-
#initialize(session, path) ⇒ Feed
constructor
A new instance of Feed.
- #parsed_response ⇒ Object
- #response ⇒ Object
Constructor Details
#initialize(session, path) ⇒ Feed
Returns a new instance of Feed.
8 9 10 |
# File 'lib/garb/management/feed.rb', line 8 def initialize(session, path) @request = DataRequest.new(session, BASE_URL+path) end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
6 7 8 |
# File 'lib/garb/management/feed.rb', line 6 def request @request end |
Instance Method Details
#entries ⇒ Object
16 17 18 19 |
# File 'lib/garb/management/feed.rb', line 16 def entries # possible to have nil entries, yuck parsed_response ? [parsed_response['feed']['entry']].flatten.compact : [] end |
#parsed_response ⇒ Object
12 13 14 |
# File 'lib/garb/management/feed.rb', line 12 def parsed_response @parsed_response ||= Crack::XML.parse(response.body) end |
#response ⇒ Object
21 22 23 |
# File 'lib/garb/management/feed.rb', line 21 def response @response ||= request.send_request end |