Class: Sovren::Client
- Inherits:
-
Object
- Object
- Sovren::Client
- Defined in:
- lib/sovren/client.rb
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#hard_time_out_multiplier ⇒ Object
readonly
Returns the value of attribute hard_time_out_multiplier.
-
#parser_configuration_params ⇒ Object
readonly
Returns the value of attribute parser_configuration_params.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #connection ⇒ Object
- #convert(file, format) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
Initialize the client class that will be used for all sovren requests.
- #parse(file) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Initialize the client class that will be used for all sovren requests.
15 16 17 18 19 20 21 22 |
# File 'lib/sovren/client.rb', line 15 def initialize(={}) @endpoint = [:endpoint] @username = [:username] @password = [:password] @timeout = [:timout] || 30000 @hard_time_out_multiplier = [:hard_time_out_multiplier] || 2 @parser_configuration_params = [:parser_configuration_params] || "_100000_0_00000010_0000000110101100_1_0000000000000111111102000000000010000100000000000000" end |
Instance Attribute Details
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
3 4 5 |
# File 'lib/sovren/client.rb', line 3 def endpoint @endpoint end |
#hard_time_out_multiplier ⇒ Object (readonly)
Returns the value of attribute hard_time_out_multiplier.
3 4 5 |
# File 'lib/sovren/client.rb', line 3 def hard_time_out_multiplier @hard_time_out_multiplier end |
#parser_configuration_params ⇒ Object (readonly)
Returns the value of attribute parser_configuration_params.
3 4 5 |
# File 'lib/sovren/client.rb', line 3 def parser_configuration_params @parser_configuration_params end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
3 4 5 |
# File 'lib/sovren/client.rb', line 3 def password @password end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
3 4 5 |
# File 'lib/sovren/client.rb', line 3 def timeout @timeout end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
3 4 5 |
# File 'lib/sovren/client.rb', line 3 def username @username end |
Instance Method Details
#connection ⇒ Object
24 25 26 |
# File 'lib/sovren/client.rb', line 24 def connection Savon.client(wsdl: endpoint, log: false) end |
#convert(file, format) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/sovren/client.rb', line 42 def convert(file, format) result = connection.call(:do_conversion_simplified) do |c| c.({ "DocumentAsByteArray" => Base64.encode64(file), "OutputType" => format}) end result.body[:do_conversion_simplified_response][:do_conversion_simplified_result].to_s end |
#parse(file) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/sovren/client.rb', line 28 def parse(file) result = connection.call(:parse) do |c| c.({ "DocumentAsByteArray" => Base64.encode64(file), "ParserConfigurationParams" => parser_configuration_params, "AlsoUseSovrenTaxonomy" => true, "EmbedConvertedTextInHrXml" => true, "HardTimeOutMultiplier" => hard_time_out_multiplier, "TimeOutInMs" => timeout}) end Resume.parse(result.body[:parse_response][:parse_result]) end |