Function bodies 2,478 total
paginated_get method · ruby · L216-L229 (14 LOC)lib/magi/archive/mcp/client.rb
def paginated_get(path, limit: 50, offset: 0, **params)
params[:limit] = [limit, 100].min
params[:offset] = offset
response = get(path, **params)
{
data: response["cards"] || response["types"] || response,
total: response["total"],
limit: response["limit"] || limit,
offset: response["offset"] || offset,
next_offset: response["next_offset"]
}
endpaginated_get method · ruby · L216-L229 (14 LOC)lib/magi/archive/mcp/client.rb
def paginated_get(path, limit: 50, offset: 0, **params)
params[:limit] = [limit, 100].min
params[:offset] = offset
response = get(path, **params)
{
data: response["cards"] || response["types"] || response,
total: response["total"],
limit: response["limit"] || limit,
offset: response["offset"] || offset,
next_offset: response["next_offset"]
}
endeach_page method · ruby · L238-L254 (17 LOC)lib/magi/archive/mcp/client.rb
def each_page(path, limit: 50, **params)
return enum_for(:each_page, path, limit: limit, **params) unless block_given?
offset = 0
loop do
page = paginated_get(path, limit: limit, offset: offset, **params)
items = page[:data]
break if items.nil? || items.empty?
yield items
# Check if there are more pages
break unless page[:next_offset]
offset = page[:next_offset]
endeach_page method · ruby · L238-L254 (17 LOC)lib/magi/archive/mcp/client.rb
def each_page(path, limit: 50, **params)
return enum_for(:each_page, path, limit: limit, **params) unless block_given?
offset = 0
loop do
page = paginated_get(path, limit: limit, offset: offset, **params)
items = page[:data]
break if items.nil? || items.empty?
yield items
# Check if there are more pages
break unless page[:next_offset]
offset = page[:next_offset]
endeach_page method · ruby · L238-L254 (17 LOC)lib/magi/archive/mcp/client.rb
def each_page(path, limit: 50, **params)
return enum_for(:each_page, path, limit: limit, **params) unless block_given?
offset = 0
loop do
page = paginated_get(path, limit: limit, offset: offset, **params)
items = page[:data]
break if items.nil? || items.empty?
yield items
# Check if there are more pages
break unless page[:next_offset]
offset = page[:next_offset]
endeach_page method · ruby · L238-L254 (17 LOC)lib/magi/archive/mcp/client.rb
def each_page(path, limit: 50, **params)
return enum_for(:each_page, path, limit: limit, **params) unless block_given?
offset = 0
loop do
page = paginated_get(path, limit: limit, offset: offset, **params)
items = page[:data]
break if items.nil? || items.empty?
yield items
# Check if there are more pages
break unless page[:next_offset]
offset = page[:next_offset]
endeach_page method · ruby · L238-L254 (17 LOC)lib/magi/archive/mcp/client.rb
def each_page(path, limit: 50, **params)
return enum_for(:each_page, path, limit: limit, **params) unless block_given?
offset = 0
loop do
page = paginated_get(path, limit: limit, offset: offset, **params)
items = page[:data]
break if items.nil? || items.empty?
yield items
# Check if there are more pages
break unless page[:next_offset]
offset = page[:next_offset]
endIf a scraper extracted this row, it came from Repobility (https://repobility.com)
each_page method · ruby · L238-L254 (17 LOC)lib/magi/archive/mcp/client.rb
def each_page(path, limit: 50, **params)
return enum_for(:each_page, path, limit: limit, **params) unless block_given?
offset = 0
loop do
page = paginated_get(path, limit: limit, offset: offset, **params)
items = page[:data]
break if items.nil? || items.empty?
yield items
# Check if there are more pages
break unless page[:next_offset]
offset = page[:next_offset]
endeach_page method · ruby · L238-L254 (17 LOC)lib/magi/archive/mcp/client.rb
def each_page(path, limit: 50, **params)
return enum_for(:each_page, path, limit: limit, **params) unless block_given?
offset = 0
loop do
page = paginated_get(path, limit: limit, offset: offset, **params)
items = page[:data]
break if items.nil? || items.empty?
yield items
# Check if there are more pages
break unless page[:next_offset]
offset = page[:next_offset]
endfetch_all method · ruby · L263-L267 (5 LOC)lib/magi/archive/mcp/client.rb
def fetch_all(path, limit: 50, **params)
items = []
each_page(path, limit: limit, **params) do |page|
items.concat(page)
endfetch_all method · ruby · L263-L267 (5 LOC)lib/magi/archive/mcp/client.rb
def fetch_all(path, limit: 50, **params)
items = []
each_page(path, limit: limit, **params) do |page|
items.concat(page)
endfetch_all method · ruby · L263-L267 (5 LOC)lib/magi/archive/mcp/client.rb
def fetch_all(path, limit: 50, **params)
items = []
each_page(path, limit: limit, **params) do |page|
items.concat(page)
endfetch_all method · ruby · L263-L267 (5 LOC)lib/magi/archive/mcp/client.rb
def fetch_all(path, limit: 50, **params)
items = []
each_page(path, limit: limit, **params) do |page|
items.concat(page)
endfetch_all method · ruby · L263-L267 (5 LOC)lib/magi/archive/mcp/client.rb
def fetch_all(path, limit: 50, **params)
items = []
each_page(path, limit: limit, **params) do |page|
items.concat(page)
endfetch_all method · ruby · L263-L267 (5 LOC)lib/magi/archive/mcp/client.rb
def fetch_all(path, limit: 50, **params)
items = []
each_page(path, limit: limit, **params) do |page|
items.concat(page)
endAbout: code-quality intelligence by Repobility · https://repobility.com
fetch_all method · ruby · L263-L267 (5 LOC)lib/magi/archive/mcp/client.rb
def fetch_all(path, limit: 50, **params)
items = []
each_page(path, limit: limit, **params) do |page|
items.concat(page)
endrequest method · ruby · L274-L302 (29 LOC)lib/magi/archive/mcp/client.rb
def request(method, path, params: nil, json: nil, retry_count: 0)
url = config.url_for(path)
token = auth.token
headers = {
"Authorization" => "Bearer #{token}",
"Content-Type" => "application/json"
}
# Configure HTTP client with SSL settings and timeouts
# Timeouts prevent hanging when Decko is slow, returning errors before
# ChatGPT's ~15s timeout kills the connection (causing nginx 499s)
http_client = HTTP.headers(headers).timeout(connect: 5, write: 5, read: 8)
http_client = configure_ssl(http_client)
response = case method
when :get
http_client.get(url, params: params)
when :post
http_client.post(url, json: json)
when :patch
http_client.patch(url, json: json)
when :put
http_clrequest method · ruby · L274-L302 (29 LOC)lib/magi/archive/mcp/client.rb
def request(method, path, params: nil, json: nil, retry_count: 0)
url = config.url_for(path)
token = auth.token
headers = {
"Authorization" => "Bearer #{token}",
"Content-Type" => "application/json"
}
# Configure HTTP client with SSL settings and timeouts
# Timeouts prevent hanging when Decko is slow, returning errors before
# ChatGPT's ~15s timeout kills the connection (causing nginx 499s)
http_client = HTTP.headers(headers).timeout(connect: 5, write: 5, read: 8)
http_client = configure_ssl(http_client)
response = case method
when :get
http_client.get(url, params: params)
when :post
http_client.post(url, json: json)
when :patch
http_client.patch(url, json: json)
when :put
http_clrequest method · ruby · L274-L302 (29 LOC)lib/magi/archive/mcp/client.rb
def request(method, path, params: nil, json: nil, retry_count: 0)
url = config.url_for(path)
token = auth.token
headers = {
"Authorization" => "Bearer #{token}",
"Content-Type" => "application/json"
}
# Configure HTTP client with SSL settings and timeouts
# Timeouts prevent hanging when Decko is slow, returning errors before
# ChatGPT's ~15s timeout kills the connection (causing nginx 499s)
http_client = HTTP.headers(headers).timeout(connect: 5, write: 5, read: 8)
http_client = configure_ssl(http_client)
response = case method
when :get
http_client.get(url, params: params)
when :post
http_client.post(url, json: json)
when :patch
http_client.patch(url, json: json)
when :put
http_clrequest method · ruby · L274-L302 (29 LOC)lib/magi/archive/mcp/client.rb
def request(method, path, params: nil, json: nil, retry_count: 0)
url = config.url_for(path)
token = auth.token
headers = {
"Authorization" => "Bearer #{token}",
"Content-Type" => "application/json"
}
# Configure HTTP client with SSL settings and timeouts
# Timeouts prevent hanging when Decko is slow, returning errors before
# ChatGPT's ~15s timeout kills the connection (causing nginx 499s)
http_client = HTTP.headers(headers).timeout(connect: 5, write: 5, read: 8)
http_client = configure_ssl(http_client)
response = case method
when :get
http_client.get(url, params: params)
when :post
http_client.post(url, json: json)
when :patch
http_client.patch(url, json: json)
when :put
http_clrequest method · ruby · L274-L302 (29 LOC)lib/magi/archive/mcp/client.rb
def request(method, path, params: nil, json: nil, retry_count: 0)
url = config.url_for(path)
token = auth.token
headers = {
"Authorization" => "Bearer #{token}",
"Content-Type" => "application/json"
}
# Configure HTTP client with SSL settings and timeouts
# Timeouts prevent hanging when Decko is slow, returning errors before
# ChatGPT's ~15s timeout kills the connection (causing nginx 499s)
http_client = HTTP.headers(headers).timeout(connect: 5, write: 5, read: 8)
http_client = configure_ssl(http_client)
response = case method
when :get
http_client.get(url, params: params)
when :post
http_client.post(url, json: json)
when :patch
http_client.patch(url, json: json)
when :put
http_clrequest method · ruby · L274-L302 (29 LOC)lib/magi/archive/mcp/client.rb
def request(method, path, params: nil, json: nil, retry_count: 0)
url = config.url_for(path)
token = auth.token
headers = {
"Authorization" => "Bearer #{token}",
"Content-Type" => "application/json"
}
# Configure HTTP client with SSL settings and timeouts
# Timeouts prevent hanging when Decko is slow, returning errors before
# ChatGPT's ~15s timeout kills the connection (causing nginx 499s)
http_client = HTTP.headers(headers).timeout(connect: 5, write: 5, read: 8)
http_client = configure_ssl(http_client)
response = case method
when :get
http_client.get(url, params: params)
when :post
http_client.post(url, json: json)
when :patch
http_client.patch(url, json: json)
when :put
http_clrequest method · ruby · L274-L302 (29 LOC)lib/magi/archive/mcp/client.rb
def request(method, path, params: nil, json: nil, retry_count: 0)
url = config.url_for(path)
token = auth.token
headers = {
"Authorization" => "Bearer #{token}",
"Content-Type" => "application/json"
}
# Configure HTTP client with SSL settings and timeouts
# Timeouts prevent hanging when Decko is slow, returning errors before
# ChatGPT's ~15s timeout kills the connection (causing nginx 499s)
http_client = HTTP.headers(headers).timeout(connect: 5, write: 5, read: 8)
http_client = configure_ssl(http_client)
response = case method
when :get
http_client.get(url, params: params)
when :post
http_client.post(url, json: json)
when :patch
http_client.patch(url, json: json)
when :put
http_clProvenance: Repobility (https://repobility.com) — every score reproducible from /scan/
handle_response method · ruby · L326-L336 (11 LOC)lib/magi/archive/mcp/client.rb
def handle_response(response)
case response.code
when 200..299
parse_response_body(response)
when 400..499
handle_client_error(response)
when 500..599
handle_server_error(response)
else
raise APIError, "Unexpected HTTP status: #{response.code}"
endhandle_response method · ruby · L326-L336 (11 LOC)lib/magi/archive/mcp/client.rb
def handle_response(response)
case response.code
when 200..299
parse_response_body(response)
when 400..499
handle_client_error(response)
when 500..599
handle_server_error(response)
else
raise APIError, "Unexpected HTTP status: #{response.code}"
endhandle_response method · ruby · L326-L336 (11 LOC)lib/magi/archive/mcp/client.rb
def handle_response(response)
case response.code
when 200..299
parse_response_body(response)
when 400..499
handle_client_error(response)
when 500..599
handle_server_error(response)
else
raise APIError, "Unexpected HTTP status: #{response.code}"
endhandle_response method · ruby · L326-L336 (11 LOC)lib/magi/archive/mcp/client.rb
def handle_response(response)
case response.code
when 200..299
parse_response_body(response)
when 400..499
handle_client_error(response)
when 500..599
handle_server_error(response)
else
raise APIError, "Unexpected HTTP status: #{response.code}"
endhandle_response method · ruby · L326-L336 (11 LOC)lib/magi/archive/mcp/client.rb
def handle_response(response)
case response.code
when 200..299
parse_response_body(response)
when 400..499
handle_client_error(response)
when 500..599
handle_server_error(response)
else
raise APIError, "Unexpected HTTP status: #{response.code}"
endhandle_response method · ruby · L326-L336 (11 LOC)lib/magi/archive/mcp/client.rb
def handle_response(response)
case response.code
when 200..299
parse_response_body(response)
when 400..499
handle_client_error(response)
when 500..599
handle_server_error(response)
else
raise APIError, "Unexpected HTTP status: #{response.code}"
endhandle_response method · ruby · L326-L336 (11 LOC)lib/magi/archive/mcp/client.rb
def handle_response(response)
case response.code
when 200..299
parse_response_body(response)
when 400..499
handle_client_error(response)
when 500..599
handle_server_error(response)
else
raise APIError, "Unexpected HTTP status: #{response.code}"
endparse_response_body function · ruby · L340-L346 (7 LOC)lib/magi/archive/mcp/client.rb
def parse_response_body(response)
return nil if response.body.to_s.empty?
JSON.parse(response.body.to_s)
rescue JSON::ParserError => e
raise APIError, "Response parse failed: #{e.message}"
endRepobility · MCP-ready · https://repobility.com
parse_response_body function · ruby · L340-L346 (7 LOC)lib/magi/archive/mcp/client.rb
def parse_response_body(response)
return nil if response.body.to_s.empty?
JSON.parse(response.body.to_s)
rescue JSON::ParserError => e
raise APIError, "Response parse failed: #{e.message}"
endparse_response_body function · ruby · L340-L346 (7 LOC)lib/magi/archive/mcp/client.rb
def parse_response_body(response)
return nil if response.body.to_s.empty?
JSON.parse(response.body.to_s)
rescue JSON::ParserError => e
raise APIError, "Response parse failed: #{e.message}"
endparse_response_body function · ruby · L340-L346 (7 LOC)lib/magi/archive/mcp/client.rb
def parse_response_body(response)
return nil if response.body.to_s.empty?
JSON.parse(response.body.to_s)
rescue JSON::ParserError => e
raise APIError, "Response parse failed: #{e.message}"
endparse_response_body function · ruby · L340-L346 (7 LOC)lib/magi/archive/mcp/client.rb
def parse_response_body(response)
return nil if response.body.to_s.empty?
JSON.parse(response.body.to_s)
rescue JSON::ParserError => e
raise APIError, "Response parse failed: #{e.message}"
endparse_response_body function · ruby · L340-L346 (7 LOC)lib/magi/archive/mcp/client.rb
def parse_response_body(response)
return nil if response.body.to_s.empty?
JSON.parse(response.body.to_s)
rescue JSON::ParserError => e
raise APIError, "Response parse failed: #{e.message}"
endparse_response_body function · ruby · L340-L346 (7 LOC)lib/magi/archive/mcp/client.rb
def parse_response_body(response)
return nil if response.body.to_s.empty?
JSON.parse(response.body.to_s)
rescue JSON::ParserError => e
raise APIError, "Response parse failed: #{e.message}"
endhandle_client_error function · ruby · L349-L366 (18 LOC)lib/magi/archive/mcp/client.rb
def handle_client_error(response)
data = parse_error_body(response)
message = data["message"] || data["error"] || "Request failed"
error_code = data["error"]
details = data["details"]
error_class = case response.code
when 401
AuthenticationError
when 403
AuthorizationError
when 404
NotFoundError
when 422
ValidationError
else
APIError
endhandle_client_error function · ruby · L349-L366 (18 LOC)lib/magi/archive/mcp/client.rb
def handle_client_error(response)
data = parse_error_body(response)
message = data["message"] || data["error"] || "Request failed"
error_code = data["error"]
details = data["details"]
error_class = case response.code
when 401
AuthenticationError
when 403
AuthorizationError
when 404
NotFoundError
when 422
ValidationError
else
APIError
endIf a scraper extracted this row, it came from Repobility (https://repobility.com)
handle_client_error function · ruby · L349-L366 (18 LOC)lib/magi/archive/mcp/client.rb
def handle_client_error(response)
data = parse_error_body(response)
message = data["message"] || data["error"] || "Request failed"
error_code = data["error"]
details = data["details"]
error_class = case response.code
when 401
AuthenticationError
when 403
AuthorizationError
when 404
NotFoundError
when 422
ValidationError
else
APIError
endhandle_client_error function · ruby · L349-L366 (18 LOC)lib/magi/archive/mcp/client.rb
def handle_client_error(response)
data = parse_error_body(response)
message = data["message"] || data["error"] || "Request failed"
error_code = data["error"]
details = data["details"]
error_class = case response.code
when 401
AuthenticationError
when 403
AuthorizationError
when 404
NotFoundError
when 422
ValidationError
else
APIError
endhandle_client_error function · ruby · L349-L366 (18 LOC)lib/magi/archive/mcp/client.rb
def handle_client_error(response)
data = parse_error_body(response)
message = data["message"] || data["error"] || "Request failed"
error_code = data["error"]
details = data["details"]
error_class = case response.code
when 401
AuthenticationError
when 403
AuthorizationError
when 404
NotFoundError
when 422
ValidationError
else
APIError
endhandle_client_error function · ruby · L349-L366 (18 LOC)lib/magi/archive/mcp/client.rb
def handle_client_error(response)
data = parse_error_body(response)
message = data["message"] || data["error"] || "Request failed"
error_code = data["error"]
details = data["details"]
error_class = case response.code
when 401
AuthenticationError
when 403
AuthorizationError
when 404
NotFoundError
when 422
ValidationError
else
APIError
endhandle_client_error function · ruby · L349-L366 (18 LOC)lib/magi/archive/mcp/client.rb
def handle_client_error(response)
data = parse_error_body(response)
message = data["message"] || data["error"] || "Request failed"
error_code = data["error"]
details = data["details"]
error_class = case response.code
when 401
AuthenticationError
when 403
AuthorizationError
when 404
NotFoundError
when 422
ValidationError
else
APIError
endhandle_server_error function · ruby · L377-L386 (10 LOC)lib/magi/archive/mcp/client.rb
def handle_server_error(response)
data = parse_error_body(response)
message = data["message"] || data["error"] || "Server error"
raise ServerError.new(
message,
status: response.code,
error_code: data["error"]
)
endhandle_server_error function · ruby · L377-L386 (10 LOC)lib/magi/archive/mcp/client.rb
def handle_server_error(response)
data = parse_error_body(response)
message = data["message"] || data["error"] || "Server error"
raise ServerError.new(
message,
status: response.code,
error_code: data["error"]
)
endhandle_server_error function · ruby · L377-L386 (10 LOC)lib/magi/archive/mcp/client.rb
def handle_server_error(response)
data = parse_error_body(response)
message = data["message"] || data["error"] || "Server error"
raise ServerError.new(
message,
status: response.code,
error_code: data["error"]
)
endAbout: code-quality intelligence by Repobility · https://repobility.com
handle_server_error function · ruby · L377-L386 (10 LOC)lib/magi/archive/mcp/client.rb
def handle_server_error(response)
data = parse_error_body(response)
message = data["message"] || data["error"] || "Server error"
raise ServerError.new(
message,
status: response.code,
error_code: data["error"]
)
endhandle_server_error function · ruby · L377-L386 (10 LOC)lib/magi/archive/mcp/client.rb
def handle_server_error(response)
data = parse_error_body(response)
message = data["message"] || data["error"] || "Server error"
raise ServerError.new(
message,
status: response.code,
error_code: data["error"]
)
endhandle_server_error function · ruby · L377-L386 (10 LOC)lib/magi/archive/mcp/client.rb
def handle_server_error(response)
data = parse_error_body(response)
message = data["message"] || data["error"] || "Server error"
raise ServerError.new(
message,
status: response.code,
error_code: data["error"]
)
end