Sha256: d2faa84fd51c41047ab6e053a48bb0232c25002c80763300115acfc2a8e54a53

Contents?: true

Size: 951 Bytes

Versions: 7

Compression:

Stored size: 951 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

7 entries across 7 versions & 1 rubygems

Version Path
ruby-pardot-1.3.2 lib/pardot/objects/visits.rb
ruby-pardot-1.3.1 lib/pardot/objects/visits.rb
ruby-pardot-1.3.0 lib/pardot/objects/visits.rb
ruby-pardot-1.2.0 lib/pardot/objects/visits.rb
ruby-pardot-1.1.0 lib/pardot/objects/visits.rb
ruby-pardot-1.0.2 lib/pardot/objects/visits.rb
ruby-pardot-1.0 lib/pardot/objects/visits.rb