Initial commit
This commit is contained in:
commit
4b5f7906d7
33 files changed
+933
No files matched your search
@@ -0,0 +1,32 @@
|
||||
# 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
|
||||
Reference in new issue
Block a user