Sha256: ebbc4e4b5ba611f660bd29aaaabfabaf0f5de67c231147ab0b6d0eaa19470751

Contents?: true

Size: 613 Bytes

Versions: 3

Compression:

Stored size: 613 Bytes

Contents

module PlausibleApi
  class ApiBase < Utils
    def request_class
      # Net::HTTP::Post
      raise NotImplementedError
    end

    def request_path
      # "/api/event"
      raise NotImplementedError
    end

    def request_auth?
      true
    end

    def request_body
      nil
    end

    def request_body?
      present?(request_body)
    end

    def request_headers
      {"content-type" => "application/json"}
    end

    def parse_response(body)
      raise NotImplementedError
    end

    def errors
      raise NotImplementedError
    end

    def valid?
      errors.empty?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
plausible_api-0.4.2 lib/plausible_api/api_base.rb
plausible_api-0.4.1 lib/plausible_api/api_base.rb
plausible_api-0.4 lib/plausible_api/api_base.rb