Sha256: c84e40d872c0badd941f1a387582ca7075178963fcc550ce5d4c2c1d33c4e33b

Contents?: true

Size: 717 Bytes

Versions: 8

Compression:

Stored size: 717 Bytes

Contents

# frozen_string_literal: true

module Gupshup
  module REST
    class Domain
      attr_reader :client

      def initialize(client)
        @client = client
        @host = nil
        @base_url = nil
        @port = nil
      end

      def absolute_url(uri)
        "#{@base_url.chomp('/')}/#{uri.chomp('/').gsub(/^\//, '')}"
      end

      def request(method, uri, params = {}, data = {}, headers = {}, auth = nil, timeout = nil)
        url = uri.match(/^http/) ? uri : absolute_url(uri)

        @client.request(
          @base_url,
          @port,
          method,
          url,
          params,
          data,
          headers,
          auth,
          timeout
        )
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gupshup-rb-0.2.1 lib/gupshup-rb/framework/rest/domain.rb
gupshup-rb-0.2.0 lib/gupshup-rb/framework/rest/domain.rb
gupshup-rb-0.1.9 lib/gupshup-rb/framework/rest/domain.rb
gupshup-rb-0.1.8.4 lib/gupshup-rb/framework/rest/domain.rb
gupshup-rb-0.1.8.3 lib/gupshup-rb/framework/rest/domain.rb
gupshup-rb-0.1.8.2 lib/gupshup-rb/framework/rest/domain.rb
gupshup-rb-0.1.8.1 lib/gupshup-rb/framework/rest/domain.rb
gupshup-rb-0.1.8 lib/gupshup-rb/framework/rest/domain.rb