Class: Itch::Reviews

Inherits:
Object
  • Object
show all
Includes:
Request, RequireAuth, SimpleInspect
Defined in:
lib/itch/reviews.rb

Overview

Fetch reviews

Instance Method Summary collapse

Methods included from Request

#validate_response

Methods included from RequireAuth

#require_auth, #with_login

Methods included from SimpleInspect

#exclude_inspection, #inspect, #pretty_print_instance_variables

Constructor Details

#initialize(agent, game_id) ⇒ Reviews

Returns a new instance of Reviews.



17
18
19
20
# File 'lib/itch/reviews.rb', line 17

def initialize(agent, game_id)
  @agent = agent
  @game_id = game_id
end

Instance Method Details

#listObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/itch/reviews.rb', line 22

def list
  all_reviews = []

  page_number = 1
  loop do
    page_reviews = parse_page_reviews(page_number)

    break if page_reviews.empty?

    all_reviews += page_reviews
    page_number += 1
    sleep 0.5
  end

  all_reviews
end