Sha256: 8c33c92d7f9a3ce8ae623a0de6607100bea4bd959c5c437653a106d7929fc3a8

Contents?: true

Size: 512 Bytes

Versions: 2

Compression:

Stored size: 512 Bytes

Contents

# encoding: UTF-8

require "faraday"
require "faraday_middleware"
require "json"

module Dandelionapi

  class LanguageDetection < Base

    ENDPOINT = "/datatxt/li/v1"

    attr_accessor :text, :url, :html, :html_fragment, :clean

    def analyze(options)

      raise MissingParameters.new("Please provide one of the following parameters: text, url, html or html_fragment") if ([:text, :url, :html, :html_fragment] & options.keys).empty?

      params = options
      call(ENDPOINT, params)
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dandelionapi-0.0.3 lib/dandelionapi/language_detection.rb
dandelionapi-0.0.2 lib/dandelionapi/language_detection.rb