Class: Refine
- Inherits:
-
Object
- Object
- Refine
- Defined in:
- lib/google_refine_api.rb
Instance Attribute Summary collapse
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
- #create_importing_job ⇒ Object
- #create_project(upload, param = {}) ⇒ Object
-
#initialize(uri) ⇒ Refine
constructor
A new instance of Refine.
Constructor Details
#initialize(uri) ⇒ Refine
Returns a new instance of Refine.
57 58 59 |
# File 'lib/google_refine_api.rb', line 57 def initialize (uri) @uri = uri end |
Instance Attribute Details
#uri ⇒ Object
Returns the value of attribute uri
55 56 57 |
# File 'lib/google_refine_api.rb', line 55 def uri @uri end |
Instance Method Details
#create_importing_job ⇒ Object
61 62 63 64 65 66 |
# File 'lib/google_refine_api.rb', line 61 def create_importing_job response = RestClient.post("#{@uri}/command/core/create-importing-job", nil) job_id = JSON[response]["jobID"] warn response Job.new(self, job_id) end |
#create_project(upload, param = {}) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/google_refine_api.rb', line 68 def create_project (upload, param = {}) = { :"encoding" => "", :"separator" => "\\t", :"ignoreLines" => -1, :"headerLines" => 0, :"skipDataLines" => 0, :"limit" => 1000000, :"storeBlankRows" => true, :"guessCellValueTypes" => true, :"processQuotes" => false, :"storeBlankCellsAsNulls" => true, :"includeFileSources" => false, :"projectName" => "Uploaded by Google Refine API" } format = param[:format] param[:options] ||= {} = .update(param[:options]) job = create_importing_job job.load_raw_data(upload) project = job.create_project() project ensure job.cancel if job end |