Class: Swivel::DataSet
Instance Attribute Summary
Attributes inherited from Response
#disable_auto_refresh, #hash_doc, #refreshed_at
Class Method Summary collapse
-
.resource ⇒ Object
Append new data to this data_set.
Instance Method Summary collapse
- #append!(options = Hash.new) ⇒ Object
- #csv ⇒ Object
-
#replace!(options = Hash.new) ⇒ Object
Replace data in this data_set.
Methods inherited from Response
#[], #id, #initialize, #method_missing, #to_param, #to_s, #to_xml
Constructor Details
This class inherits a constructor from Swivel::Response
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Swivel::Response
Class Method Details
.resource ⇒ Object
Append new data to this data_set. Passed in options must contain csv data. This csv data must adhrere to the same column structure as the originally uploaded data_set.
data_set = swivel.data_set id
data_set.append! :data => `/tmp/append.csv`
431 432 433 |
# File 'lib/swivel.rb', line 431 def self.resource 'data-set' end |
Instance Method Details
#append!(options = Hash.new) ⇒ Object
435 436 437 438 439 440 441 442 443 |
# File 'lib/swivel.rb', line 435 def append! = Hash.new .merge! :mode => 'append', :id => self.id raise 'feed me data!' if [:data].blank? appended_data_set = @connection.upload! @refreshed_at = nil @retried = false @doc = appended_data_set.instance_variable_get :@doc self end |
#csv ⇒ Object
462 463 464 |
# File 'lib/swivel.rb', line 462 def csv @connection.call "/data_sets/csv/#{id}" end |
#replace!(options = Hash.new) ⇒ Object
Replace data in this data_set. Passed in options must contain csv data. This csv data must adhere to the same column structure as the originally uploaded data set.
data_set = swivel.data_set id
data_set.replace! :data => `/tmp/replace.csv`
452 453 454 455 456 457 458 459 460 |
# File 'lib/swivel.rb', line 452 def replace! = Hash.new .merge! :mode => 'replace', :id => self.id raise 'feed me data!' if [:data].blank? replaced_data_set = @connection.upload! @refreshed_at = nil @retried = false @doc = replaced_data_set.instance_variable_get :@doc self end |