Sha256: 93e41798439b1e5d179cd62193ce784054a4684e2add5b583a00e0677f406a1f

Contents?: true

Size: 983 Bytes

Versions: 4

Compression:

Stored size: 983 Bytes

Contents

module Pardot
  module Objects
    module Users
      def users
        @users ||= Users.new self
      end

      class Users
        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_by_email(email, params = {})
          post "/do/read/email/#{email}", params
        end

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

        protected

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

        def post(path, params = {}, result = 'user')
          response = @client.post 'user', 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/users.rb
ruby-pardot-1.4.2 lib/pardot/objects/users.rb
ruby-pardot-1.4.1 lib/pardot/objects/users.rb
ruby-pardot-1.4.0 lib/pardot/objects/users.rb