Sha256: 1d1b40c2d3a74b203b21a25ac0e0f1ffdf6855d22d05401decbe11428991b4ec

Contents?: true

Size: 888 Bytes

Versions: 5

Compression:

Stored size: 888 Bytes

Contents

module ApiClient
  # ApiClient::Configuration provides a way to configure ApiClient globally.
  class Configuration
    # Return the api url.
    #
    # @return [String] the api url.
    def path
      raise Exceptions::NotConfigured unless @path.size > 1
      @path
    end

    # Set the api url.
    #
    # @param [String] path api url.
    def path=(path)
      path = "#{path}/" unless path[path.size - 1, 1] == '/'
      @path = path
    end

    # Return the default header for requisitions.
    #
    # @return [Hash] the default header.
    def header
      return { 'Content-Type' => 'application/json' } unless @header
      @header
    end

    # Set the default header for requisitions.
    #
    # @param [Hash] header the default header for requitions.
    def header=(header = {})
      @header = { 'Content-Type' => 'application/json' }.merge(header)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
api-client-2.1.0 lib/api-client/configuration.rb
api-client-2.0.3 lib/api-client/configuration.rb
api-client-2.0.2 lib/api-client/configuration.rb
api-client-2.0.1 lib/api-client/configuration.rb
api-client-2.0.0 lib/api-client/configuration.rb