Sha256: 9376b86af27a32d8ba0fe2a826eb1525cd4f30edfbcfc53773c64d5191dea589

Contents?: true

Size: 878 Bytes

Versions: 4

Compression:

Stored size: 878 Bytes

Contents

module Pardot
  module Objects
    module Visits
      def visits
        @visits ||= Visits.new self
      end

      class Visits
        def initialize(client)
          @client = client
        end

        def query(params)
          result = get '/do/query', params, 'result'
          result['total_results'] = result['total_results'].to_i if result['total_results']
          result
        end

        def read(id, params = {})
          post "/do/read/id/#{id}", params
        end

        protected

        def get(path, params = {}, result = 'visit')
          response = @client.get 'visit', path, params
          result ? response[result] : response
        end

        def post(path, params = {}, result = 'visit')
          response = @client.post 'visit', path, params
          result ? response[result] : response
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-pardot-1.4.3 lib/pardot/objects/visits.rb
ruby-pardot-1.4.2 lib/pardot/objects/visits.rb
ruby-pardot-1.4.1 lib/pardot/objects/visits.rb
ruby-pardot-1.4.0 lib/pardot/objects/visits.rb