Sha256: 3fc19629025d916c2eabf3a182a70078ed90907e0586a91d9352f818ec037ddf

Contents?: true

Size: 820 Bytes

Versions: 6

Compression:

Stored size: 820 Bytes

Contents

module DataSift
  class ApiResource
    include DataSift

    def initialize (config)
      @config = config
      config[:api_host] = 'api.datasift.com' unless config.has_key?(:api_host)
      config[:stream_host] = 'websocket.datasift.com' unless config.has_key?(:stream_host)
      config[:api_version] = 'v1' unless config.has_key?(:api_version)
      config[:enable_ssl] = false unless config.has_key?(:enable_ssl)
      # max 320 seconds retry - http://dev.datasift.com/docs/streaming-api/reconnecting
      config[:max_retry_time] = 320 unless config.has_key?(:max_retry_time)
    end

    def requires params
      params.each { |k, v|
        if v == nil || v.to_s.length == 0
          raise InvalidParamError.new "#{k} is a required parameter, it cannot be nil or empty"
        end
      }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
datasift-3.1.2 lib/api/api_resource.rb
datasift-3.1.1 lib/api/api_resource.rb
datasift-3.1.0 lib/api/api_resource.rb
datasift-3.0.1 lib/api/api_resource.rb
datasift-3.0.0 lib/api/api_resource.rb
datasift-3.0.0.beta4 lib/api/api_resource.rb