class ComicVine::Api::Response
Attributes
body[R]
error[R]
headers[R]
limit[R]
number_of_page_results[R]
number_of_total_results[R]
offset[R]
raw_response[R]
results[R]
status[R]
status_code[R]
version[R]
Public Class Methods
new(status:, headers:, body:)
click to toggle source
# File lib/comic_vine/api/response.rb, line 8 def initialize(status:, headers:, body:) @status = status @headers = headers @body = body parse_body end
Private Instance Methods
parse_body()
click to toggle source
# File lib/comic_vine/api/response.rb, line 18 def parse_body data = JSON.parse(body) methods = %w(error limit offset number_of_page_results number_of_total_results status_code results version) methods.each do |method_name| instance_variable_set(:"@#{method_name}", data[method_name]) end rescue nil end