Class: SyoboiCalendar::Response
- Inherits:
-
Object
- Object
- SyoboiCalendar::Response
- Includes:
- Enumerable
- Defined in:
- lib/syoboi_calendar/response.rb
Instance Method Summary collapse
- #body ⇒ String
- #each(&block) ⇒ Object
- #headers ⇒ Hash
-
#initialize(faraday_response:, response_parser_class:) ⇒ Response
constructor
A new instance of Response.
- #resources ⇒ Array<SyoboiCalendar::Resources::BaseResource>
- #status ⇒ Integer
Constructor Details
#initialize(faraday_response:, response_parser_class:) ⇒ Response
Returns a new instance of Response.
7 8 9 10 |
# File 'lib/syoboi_calendar/response.rb', line 7 def initialize(faraday_response:, response_parser_class:) @faraday_response = faraday_response @response_parser_class = response_parser_class end |
Instance Method Details
#body ⇒ String
13 14 15 |
# File 'lib/syoboi_calendar/response.rb', line 13 def body faraday_response.body end |
#each(&block) ⇒ Object
Note:
Implementation for Enumerable
18 19 20 |
# File 'lib/syoboi_calendar/response.rb', line 18 def each(&block) resources.each(&block) end |
#headers ⇒ Hash
23 24 25 |
# File 'lib/syoboi_calendar/response.rb', line 23 def headers faraday_response.headers end |
#resources ⇒ Array<SyoboiCalendar::Resources::BaseResource>
28 29 30 |
# File 'lib/syoboi_calendar/response.rb', line 28 def resources @resources ||= response_parser_class.new(body).parse end |
#status ⇒ Integer
33 34 35 |
# File 'lib/syoboi_calendar/response.rb', line 33 def status faraday_response.status end |