Class: Pennyworth::Integrations::GitHub::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/pennyworth/integrations/git_hub/response.rb

Overview

Represents a generic GitHub API response.

Instance Method Summary collapse

Constructor Details

#initialize(raw) ⇒ Response

Returns a new instance of Response.



8
9
10
# File 'lib/pennyworth/integrations/git_hub/response.rb', line 8

def initialize raw
  @raw = raw
end

Instance Method Details

#last_pageObject



14
# File 'lib/pennyworth/integrations/git_hub/response.rb', line 14

def last_page = page("last")

#next_pageObject



12
# File 'lib/pennyworth/integrations/git_hub/response.rb', line 12

def next_page = page("next")

#recordsObject



16
# File 'lib/pennyworth/integrations/git_hub/response.rb', line 16

def records = success? ? JSON(raw.body, symbolize_names: true) : []

#success?Boolean

Returns:

  • (Boolean)


18
# File 'lib/pennyworth/integrations/git_hub/response.rb', line 18

def success? = raw.status.success?