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
|
||||
class Client
|
||||
attr_reader :version, :connection
|
||||
|
||||
delegate :get, to: :connection
|
||||
|
||||
def initialize(**args)
|
||||
@version = args[:version] || 'v1'
|
||||
@connection_args = args.slice(:url, :params, :headers).reverse_merge(
|
||||
url: "https://api.strike.me/#{version}"
|
||||
)
|
||||
|
||||
# headers: {
|
||||
# 'Content-Type' => 'application/json',
|
||||
# 'Authorization' => "Bearer #{ENV.fetch('STRIKE_API_KEY')}"
|
||||
# }
|
||||
@connection = Faraday.new(@connection_args) do |builder|
|
||||
builder.request :authorization, 'Bearer', -> { ENV.fetch('STRIKE_API_KEY') }
|
||||
builder.request :json
|
||||
builder.response :json
|
||||
end
|
||||
end
|
||||
|
||||
def account_id
|
||||
ENV.fetch('STRIKE_ACCOUNT_ID')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user