23 lines
540 B
Ruby
23 lines
540 B
Ruby
#
|
|
# API Docs: https://docs.btcpayserver.org/API/Greenfield/v1/
|
|
#
|
|
class BtcpayManagerService < ApplicationService
|
|
def initialize
|
|
@base_url = Setting.btcpay_api_url
|
|
@store_id = Setting.btcpay_store_id
|
|
@auth_token = Setting.btcpay_auth_token
|
|
end
|
|
|
|
private
|
|
|
|
def get(endpoint)
|
|
res = Faraday.get("#{@base_url}/#{endpoint}", {}, {
|
|
"Content-Type" => "application/json",
|
|
"Accept" => "application/json",
|
|
"Authorization" => "token #{@auth_token}"
|
|
})
|
|
|
|
JSON.parse(res.body)
|
|
end
|
|
end
|