Module: TreasureData::API::Result
- Included in:
- TreasureData::API
- Defined in:
- lib/td/client/api/result.rb
Instance Method Summary collapse
- #create_result(name, url, opts = {}) ⇒ true
- #delete_result(name) ⇒ true
- #list_result ⇒ Array<String>
Instance Method Details
#create_result(name, url, opts = {}) ⇒ true
26 27 28 29 30 31 32 33 |
# File 'lib/td/client/api/result.rb', line 26 def create_result(name, url, opts={}) params = {'url'=>url}.merge(opts) code, body, res = post("/v3/result/create/#{e name}", params) if code != "200" raise_error("Create result table failed", res) end return true end |
#delete_result(name) ⇒ true
37 38 39 40 41 42 43 |
# File 'lib/td/client/api/result.rb', line 37 def delete_result(name) code, body, res = post("/v3/result/delete/#{e name}") if code != "200" raise_error("Delete result table failed", res) end return true end |
#list_result ⇒ Array<String>
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/td/client/api/result.rb', line 9 def list_result code, body, res = get("/v3/result/list") if code != "200" raise_error("List result table failed", res) end js = checked_json(body, %w[results]) result = [] js['results'].map {|m| result << [m['name'], m['url'], nil] # same as database } return result end |