Class: Abbyy::Client
Instance Attribute Summary collapse
-
#task ⇒ Object
(also: #current_task)
readonly
Returns the value of attribute task.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#get(url = task[:resultUrl]) ⇒ String
Retrieve the result of processing task.
-
#initialize(application_id = Abbyy.application_id, password = Abbyy.password) ⇒ Client
constructor
A new instance of Client.
- #list_tasks ⇒ Array
- #method_missing(meth, *args, &block) ⇒ Object
Methods included from XML
Constructor Details
#initialize(application_id = Abbyy.application_id, password = Abbyy.password) ⇒ Client
Returns a new instance of Client.
12 13 14 15 16 17 |
# File 'lib/abbyy/client.rb', line 12 def initialize(application_id = Abbyy.application_id, password = Abbyy.password) @appliction_id = application_id @password = password @url = "http://#{CGI.escape(@appliction_id)}:#{CGI.escape(@password)}@cloud.ocrsdk.com" @task = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
35 36 37 38 39 |
# File 'lib/abbyy/client.rb', line 35 def method_missing(meth, *args, &block) api = API.new self self.resource = api.execute meth, *args, &block current_task end |
Instance Attribute Details
#task ⇒ Object (readonly) Also known as: current_task
Returns the value of attribute task.
10 11 12 |
# File 'lib/abbyy/client.rb', line 10 def task @task end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
10 11 12 |
# File 'lib/abbyy/client.rb', line 10 def url @url end |
Instance Method Details
#get(url = task[:resultUrl]) ⇒ String
Retrieve the result of processing task
25 26 27 |
# File 'lib/abbyy/client.rb', line 25 def get(url = task[:resultUrl]) RestClient.get(url) end |
#list_tasks ⇒ Array
31 32 33 |
# File 'lib/abbyy/client.rb', line 31 def list_tasks parse_task get("#{url}/listTasks") end |