Module: BSB::AusPayNet::Client
- Defined in:
- lib/bsb/aus_pay_net/client.rb
Defined Under Namespace
Classes: MissingSubscriptionKeyError, Response
Class Method Summary collapse
Class Method Details
.fetch_all_bsbs ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/bsb/aus_pay_net/client.rb', line 12 def self.fetch_all_bsbs subscription_key = ENV.fetch('AUSPAYNET_SUB_KEY', nil) if subscription_key.nil? raise MissingSubscriptionKeyError, "the environment variable 'AUSPAYNET_SUB_KEY' must be present" end conn = Faraday.new( url: 'https://auspaynet-bicbsb-api-prod.azure-api.net', headers: { 'Content-Type': 'application/json', 'Ocp-Apim-Subscription-Key': subscription_key } ) do |faraday| faraday.response :raise_error faraday.response :json end response = conn.post('/BSBQuery-V2/manual/paths/invoke', '{}') Response.new(body: response.body.fetch('data')) end |