Class: Pdfcrowd::ConnectionHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/pdfcrowd.rb

Instance Method Summary collapse

Constructor Details

#initialize(user_name, api_key) ⇒ ConnectionHelper

Returns a new instance of ConnectionHelper.



536
537
538
539
540
541
542
543
544
545
546
547
# File 'lib/pdfcrowd.rb', line 536

def initialize(user_name, api_key)
    @user_name = user_name
    @api_key = api_key

    reset_response_data()

    setProxy(nil, nil, nil, nil)
    setUseHttp(false)
    setUserAgent('pdfcrowd_ruby_client/4.8.0 (http://pdfcrowd.com)')

    @retry_count = 1
end

Instance Method Details

#getConsumedCreditCountObject



583
584
585
# File 'lib/pdfcrowd.rb', line 583

def getConsumedCreditCount()
    @consumed_credits
end

#getDebugLogUrlObject



575
576
577
# File 'lib/pdfcrowd.rb', line 575

def getDebugLogUrl()
    @debug_log_url
end

#getJobIdObject



587
588
589
# File 'lib/pdfcrowd.rb', line 587

def getJobId()
    @job_id
end

#getOutputSizeObject



595
596
597
# File 'lib/pdfcrowd.rb', line 595

def getOutputSize()
    @output_size
end

#getPageCountObject



591
592
593
# File 'lib/pdfcrowd.rb', line 591

def getPageCount()
    @page_count
end

#getRemainingCreditCountObject



579
580
581
# File 'lib/pdfcrowd.rb', line 579

def getRemainingCreditCount()
    @credits
end

#post(fields, files, raw_data, out_stream = nil) ⇒ Object



549
550
551
552
553
554
# File 'lib/pdfcrowd.rb', line 549

def post(fields, files, raw_data, out_stream = nil)
    request = ConnectionHelper.create_request()
    request.body = ConnectionHelper.encode_multipart_post_data(fields, files, raw_data)
    request.content_type = 'multipart/form-data; boundary=' + MULTIPART_BOUNDARY
    do_post(request, out_stream)
end

#setProxy(host, port, user_name, password) ⇒ Object



568
569
570
571
572
573
# File 'lib/pdfcrowd.rb', line 568

def setProxy(host, port, user_name, password)
    @proxy_host = host
    @proxy_port = port
    @proxy_user_name = user_name
    @proxy_password = password
end

#setRetryCount(retry_count) ⇒ Object



564
565
566
# File 'lib/pdfcrowd.rb', line 564

def setRetryCount(retry_count)
    @retry_count = retry_count
end

#setUseHttp(use_http) ⇒ Object



556
557
558
# File 'lib/pdfcrowd.rb', line 556

def setUseHttp(use_http)
    @use_http = use_http
end

#setUserAgent(user_agent) ⇒ Object



560
561
562
# File 'lib/pdfcrowd.rb', line 560

def setUserAgent(user_agent)
    @user_agent = user_agent
end