Sha256: 44fd12dd6c4681314df61f39989f68663400fefdc200c648fcb3e87e424356ae
Contents?: true
Size: 1.09 KB
Versions: 4
Compression:
Stored size: 1.09 KB
Contents
require 'bjond-app-definition' require 'bjond-consequence' require 'bjond-event' require 'bjond-field' require 'faraday' require 'bjond-app/engine' require 'bjond-app-config' require 'bjond-jwt' include BjondJwt module BjondApi ## # Registers the given integration_app with a bjond-server. def self.register_app(integration_app, bjondhost=ENV['BJOND_SERVER']) conn = Faraday.new(:url => bjondhost) return conn.post do |req| req.url '/server-core/services/integrationmanager/register' req.headers['Content-Type'] = 'application/json' req.body = integration_app.to_json end end ## # Fires events to all bjond_registrations def fire_event(bjond_registration, payload) services = BjondService.where(:bjond_registration_id => bjond_registration.id) connections = [] services.each do |bjond_svc| conn = Faraday.new(:url => bjond_svc.endpoint) conn.post do |req| req.headers['Content-Type'] = 'application/json' req.body = BjondJwt::jwt_encode_payload(payload, bjond_registration) end end return connections end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
bjond-api-0.1.3 | lib/bjond-api.rb |
bjond-api-0.1.2 | lib/bjond-api.rb |
bjond-api-0.1.1 | lib/bjond-api.rb |
bjond-api-0.1.0 | lib/bjond-api.rb |