Module: AP::Client::Category

Included in:
AP::Client
Defined in:
lib/ap/client/category.rb

Instance Method Summary collapse

Instance Method Details

#categoriesObject

Returns an array of AP::Category objects representing the news categories



5
6
7
# File 'lib/ap/client/category.rb', line 5

def categories
  self.class.get("/v2/categories.svc/")["feed"]["entry"].collect { |e| AP::Category.new_from_api_data(e) }
end

#category(id) ⇒ Object

Returns an array of AP::Articles objects representing recent news in a category



10
11
12
# File 'lib/ap/client/category.rb', line 10

def category(id)
  self.class.get("/v2/categories.svc/#{id}")["feed"]["entry"].collect { |e| AP::Article.new_from_api_data(e) }
end