Class: AmazonSellerCentral::FeedbackPage
- Extended by:
- ClassMethods
- Defined in:
- lib/amazon_seller_central/feedback_page.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
Instance Method Summary collapse
- #has_next? ⇒ Boolean
- #next_page ⇒ Object
- #parse ⇒ Object (also: #feedbacks)
Methods included from ClassMethods
load_all_pages, load_first_page
Methods inherited from Page
Constructor Details
This class inherits a constructor from AmazonSellerCentral::Page
Instance Attribute Details
#body ⇒ Object
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
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_page ⇒ Object
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 |
#parse ⇒ Object 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 |