class Patentscope::Webservice

Constants

PATENTSCOPE_WEBSERVICE_LOCATION

Public Instance Methods

get_available_documents(args = {}) click to toggle source
# File lib/patentscope/webservice.rb, line 11
def get_available_documents(args = {})
  ia_number = PctAppNumber.new(args[:ia_number]).to_ia_number
  perform_operation(:getAvailableDocuments, { iaNumber: ia_number })
end
get_document_content(args = {}) click to toggle source
# File lib/patentscope/webservice.rb, line 16
def get_document_content(args = {})
  doc_id = args[:doc_id]
  perform_operation(:getDocumentContent, { docId: doc_id })
end
get_document_content_page(args = {}) click to toggle source
# File lib/patentscope/webservice.rb, line 36
def get_document_content_page(args = {})
  doc_id  = args[:doc_id]
  page_id = args[:page_id]
  perform_operation(:getDocumentContentPage, { docId: doc_id, pageId: page_id })
end
get_document_ocr_content(args = {}) click to toggle source
# File lib/patentscope/webservice.rb, line 21
def get_document_ocr_content(args = {})
  doc_id = args[:doc_id]
  perform_operation(:getDocumentOcrContent, { docId: doc_id })
end
get_document_table_of_contents(args = {}) click to toggle source
# File lib/patentscope/webservice.rb, line 31
def get_document_table_of_contents(args = {})
  doc_id = args[:doc_id]
  perform_operation(:getDocumentTableOfContents, { docId: doc_id })
end
get_iasr(args = {}) click to toggle source
# File lib/patentscope/webservice.rb, line 26
def get_iasr(args = {})
  ia_number = PctAppNumber.new(args[:ia_number]).to_ia_number
  perform_operation(:getIASR, { iaNumber: ia_number })
end
wsdl() click to toggle source
# File lib/patentscope/webservice.rb, line 7
def wsdl
  send_wsdl_request
end

Private Instance Methods

client() click to toggle source
# File lib/patentscope/webservice.rb, line 64
def client
  raise NoCredentialsError unless Patentscope.configured?
  Client.new(username: Patentscope.configuration.username,
             password: Patentscope.configuration.password)
end
perform_operation(operation, options_hash) click to toggle source
# File lib/patentscope/webservice.rb, line 44
def perform_operation(operation, options_hash)
  soap_envelope = soapbuilder.build_envelope(operation, options_hash)
  response = send_soap_request(soap_envelope)
  if response.include?('Error') && response.include?('Unauthorized')
    raise WrongCredentialsError
  elsif response.include?('Business error during the execution of service')
    raise BusinessError
  else
    soapstripper.strip_envelope(response, operation)
  end
end
send_soap_request(soap_envelope_xml) click to toggle source
# File lib/patentscope/webservice.rb, line 56
def send_soap_request(soap_envelope_xml)
  client.post_url(PATENTSCOPE_WEBSERVICE_LOCATION, "text/xml", soap_envelope_xml)
end
send_wsdl_request() click to toggle source
# File lib/patentscope/webservice.rb, line 60
def send_wsdl_request
  client.get_url(PATENTSCOPE_WEBSERVICE_LOCATION + '?wsdl')
end
soapbuilder() click to toggle source
# File lib/patentscope/webservice.rb, line 70
def soapbuilder
  WebserviceSoapBuilder.new
end
soapstripper() click to toggle source
# File lib/patentscope/webservice.rb, line 74
def soapstripper
  WebserviceSoapStripper.new
end