Sha256: e9448d1ee5121f75ca48363a5f5f7d82b0a612b0f7095f7a6e7ac969b7b09b9b

Contents?: true

Size: 817 Bytes

Versions: 1

Compression:

Stored size: 817 Bytes

Contents

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

module Datatxt

  class Nex

    attr_accessor :endpoint, :text, :url, :html, :html_fragment, :lang, :min_confidence, :min_length, :social_hashtag, :social_mention, :include, :extra_types, :country, :custom_spots

    def initialize
      
    end

    def post(options)
      call(params)
    end

    protected

    def call(params)
      begin
        params = params.merge({api_key: Machinereading.config.api_key})
        conn = Faraday.new(url: Machinereading.config.endpoint) do |faraday|
          faraday.request  :url_encoded
          faraday.adapter  Faraday.default_adapter
        end
        response = conn.post "/#{endpoint}", params
        response.body
      rescue Exception => e
        puts e.inspect
      end
    end


  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datatxt-0.0.1 lib/datatxt/nex.rb