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.



564
565
566
567
568
569
570
571
572
573
574
575
576
# File 'lib/pdfcrowd.rb', line 564

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/6.5.0 (https://pdfcrowd.com)')

    @retry_count = 1
    @converter_version = '24.04'
end

Instance Method Details

#getConsumedCreditCountObject



616
617
618
# File 'lib/pdfcrowd.rb', line 616

def getConsumedCreditCount()
    @consumed_credits
end

#getConverterVersionObject



636
637
638
# File 'lib/pdfcrowd.rb', line 636

def getConverterVersion()
    @converter_version
end

#getDebugLogUrlObject



608
609
610
# File 'lib/pdfcrowd.rb', line 608

def getDebugLogUrl()
    @debug_log_url
end

#getJobIdObject



620
621
622
# File 'lib/pdfcrowd.rb', line 620

def getJobId()
    @job_id
end

#getOutputSizeObject



632
633
634
# File 'lib/pdfcrowd.rb', line 632

def getOutputSize()
    @output_size
end

#getPageCountObject



624
625
626
# File 'lib/pdfcrowd.rb', line 624

def getPageCount()
    @page_count
end

#getRemainingCreditCountObject



612
613
614
# File 'lib/pdfcrowd.rb', line 612

def getRemainingCreditCount()
    @credits
end

#getTotalPageCountObject



628
629
630
# File 'lib/pdfcrowd.rb', line 628

def getTotalPageCount()
    @total_page_count
end

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



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

def post(fields, files, raw_data, out_stream = nil)
    request = 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

#setConverterVersion(converter_version) ⇒ Object



597
598
599
# File 'lib/pdfcrowd.rb', line 597

def setConverterVersion(converter_version)
    @converter_version = converter_version
end

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



601
602
603
604
605
606
# File 'lib/pdfcrowd.rb', line 601

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



593
594
595
# File 'lib/pdfcrowd.rb', line 593

def setRetryCount(retry_count)
    @retry_count = retry_count
end

#setUseHttp(use_http) ⇒ Object



585
586
587
# File 'lib/pdfcrowd.rb', line 585

def setUseHttp(use_http)
    @use_http = use_http
end

#setUserAgent(user_agent) ⇒ Object



589
590
591
# File 'lib/pdfcrowd.rb', line 589

def setUserAgent(user_agent)
    @user_agent = user_agent
end