Class: Textkernel
- Inherits:
-
Object
- Object
- Textkernel
- Defined in:
- lib/textkernel.rb,
lib/textkernel/version.rb
Constant Summary collapse
- VERSION =
'0.1.0'
Instance Method Summary collapse
- #extract!(resume_path) ⇒ Object
-
#initialize(attrs) ⇒ Textkernel
constructor
A new instance of Textkernel.
Constructor Details
#initialize(attrs) ⇒ Textkernel
Returns a new instance of Textkernel.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/textkernel.rb', line 9 def initialize(attrs) attributes = attrs.each_with_object({}) {|(key, value), o| o[key.to_s] = value} @account = attributes.fetch('account') @username = attributes.fetch('username') @password = attributes.fetch('password') @client = ::Savon.client(wsdl: attributes.fetch('wsdl')) # print client.operations # => [:process_document_advanced, :process_document, :process_url_atomic] end |
Instance Method Details
#extract!(resume_path) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/textkernel.rb', line 20 def extract!(resume_path) response = process_document(resume_path) if response.http.code == 200 document = response.body.dig(:process_document_response, :return) profile = Hash.from_xml(document) if document end {code: 'Success', resume: profile} rescue Savon::SOAPFault, Savon::HTTPError => err {code: 'Error', message: err.} end |