Class: AmazonSellerCentral::FeedbackPage

Inherits:
Page
  • Object
show all
Extended by:
ClassMethods
Defined in:
lib/amazon_seller_central/feedback_page.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ClassMethods

load_all_pages, load_first_page

Methods inherited from Page

#initialize, #last_page?

Constructor Details

This class inherits a constructor from AmazonSellerCentral::Page

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



3
4
5
# File 'lib/amazon_seller_central/feedback_page.rb', line 3

def body
  @body
end

Instance Method Details

#has_next?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/amazon_seller_central/feedback_page.rb', line 5

def has_next?
  @has_next ||= @page.search('a').map(&:text).grep(/Next/).count > 0
end

#next_pageObject



9
10
11
12
13
14
15
# File 'lib/amazon_seller_central/feedback_page.rb', line 9

def next_page
  @next_page ||= begin
                   raise NoNextPageAvailableError unless has_next?
                   page = @agent.follow_link_with(:text => 'Next')
                   FeedbackPage.new(:page => page, :agent => @agent)
                 end
end

#parseObject Also known as: feedbacks



17
18
19
20
21
22
# File 'lib/amazon_seller_central/feedback_page.rb', line 17

def parse
  rows = @page.search('.//table[@width="100%"]').first.search('.//tr')
  rows[1..-1].map do |row|
    feedback_row_to_object(row)
  end
end