Files
strike_me-api/lib/strike_me/api/base_client.rb
T
2025-09-15 15:55:58 -05:00

33 lines
796 B
Ruby

# frozen_string_literal: true
module StrikeMe
module API
# The BaseClient module is to be included in objects using the Strike client
# to make calls and transform the responses to objects.
# Factory of BaseModel instances
module BaseClient
extend ActiveSupport::Concern
def client
@client ||= Client.new
end
module ClassMethods
def autoload_default(name)
autoload name, "#{"#{self.name}/#{name}".underscore}.rb"
end
end
# cumbersome, but better for later debugging and handling
class ResponseError
attr_reader :url, :faraday_response
def initialize(url, faraday_response)
@url = url
@faraday_response = faraday_response
end
end
end
end
end