Class: ButterCMS::PostsFetchService

Inherits:
Object
  • Object
show all
Defined in:
lib/butter_cms/posts_fetch_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(request_options) ⇒ PostsFetchService

Returns a new instance of PostsFetchService.



3
4
5
# File 'lib/butter_cms/posts_fetch_service.rb', line 3

def initialize(request_options)
  @request_options = request_options
end

Instance Method Details

#more_posts?Boolean

Returns true if the next page is available, false otherwise

Returns:

  • (Boolean)


19
20
21
# File 'lib/butter_cms/posts_fetch_service.rb', line 19

def more_posts?
  !parser.next_page.nil?
end

#postsArray<ButterCMS::Post>

Returns array of post objects with the associated records included

Returns:



10
11
12
13
14
# File 'lib/butter_cms/posts_fetch_service.rb', line 10

def posts
  parser.posts.map do |post_attributes|
    ::ButterCMS::Parsers::PostObject.call(post_attributes)
  end
end