class BotFramework::ApiBase

Attributes

service_url[RW]

Public Class Methods

new(service_url) click to toggle source
# File lib/bot_framework/api_base.rb, line 8
def initialize(service_url)
  @service_url = service_url
end

Public Instance Methods

api_delete(local_uri) click to toggle source
# File lib/bot_framework/api_base.rb, line 23
def api_delete(local_uri)
  uri = URI.join(service_url, URI.escape(local_uri))
  BotFramework.connector.token.delete(uri)
end
api_get(local_uri, _opts = {}) click to toggle source
# File lib/bot_framework/api_base.rb, line 12
def api_get(local_uri, _opts = {})
  uri = URI.join(service_url, URI.escape(local_uri))
  JSON.parse(BotFramework.connector.token.get(uri).body)
end
api_post(local_uri, opts = {}) click to toggle source
# File lib/bot_framework/api_base.rb, line 17
def api_post(local_uri, opts = {})
  uri = URI.join(service_url, URI.escape(local_uri))
  JSON.parse(BotFramework.connector.token.post(uri, body: opts.to_json,
                                                    headers: { 'Content-Type' => 'application/json' }).body)
end
api_request(method, local_uri, opts) click to toggle source
# File lib/bot_framework/api_base.rb, line 28
def api_request(method, local_uri, opts)
  uri = URI.join(service_url, URI.escape(local_uri))
  BotFramework.connector.token.request(method, uri, opts)
end