Sha256: 5b486c3f1d73dd62bae82e2065bbfaaa9cd70ea4497150955fb2258e636d5d07

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

# encoding: UTF-8

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

module Dandelionapi
  module LanguageDetection

  	class Request < Analysis::Request

      ENDPOINT = "/li/v1"

      MANDATORY_FIELDS = [
        "text",
        "url",
        "html",
        "html_fragment"
      ]

      OPTIONAL_FIELDS = [
        "clean"
      ]

      FIELDS_FORMAT = {
        "text" => {
          valid: lambda {|value| value.is_a? String},
          error_message: 'text needs to be String'
        }, 
        "url" => {
          valid: lambda {|value| value.is_a? String},
          error_message: 'url needs to be String'
        },  
        "html" => {
          valid: lambda {|value| value.is_a? String},
          error_message: 'html needs to be String'
        },  
        "html_fragment" => {
          valid: lambda {|value| value.is_a? String},
          error_message: 'html_fragment needs to be String'
        }, 
        "clean" => {
          valid: lambda {|value| (value.is_a? TrueClass or value.is_a? FalseClass)},
          error_message: 'clean needs to be Boolean'
        }, 
      }

    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dandelionapi-0.0.5 lib/dandelionapi/language_detection.rb