Sha256: e93f5a88b43a99b1f09e01530280738af57a70f52e4fc3430b41bfb1f1342ab9

Contents?: true

Size: 997 Bytes

Versions: 30

Compression:

Stored size: 997 Bytes

Contents

class TreasureData::API
module Result

  ####
  ## Result API
  ##

  # @return [Array<String>]
  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

  # @param [String] name
  # @param [String] url
  # @param [Hash] opts
  # @return [true]
  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

  # @param [String] name
  # @return [true]
  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

end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
td-client-2.0.0 lib/td/client/api/result.rb
td-client-1.0.8 lib/td/client/api/result.rb
td-client-1.0.7 lib/td/client/api/result.rb
td-client-1.0.6 lib/td/client/api/result.rb
td-client-1.0.5 lib/td/client/api/result.rb
td-client-1.0.4 lib/td/client/api/result.rb
td-client-1.0.3 lib/td/client/api/result.rb
td-client-1.0.2 lib/td/client/api/result.rb
td-client-1.0.1 lib/td/client/api/result.rb
td-client-1.0.0-java lib/td/client/api/result.rb
td-client-1.0.0 lib/td/client/api/result.rb
td-client-0.8.85 lib/td/client/api/result.rb
td-client-0.8.84 lib/td/client/api/result.rb
td-client-0.8.83 lib/td/client/api/result.rb
td-client-0.8.82 lib/td/client/api/result.rb
td-client-0.8.81 lib/td/client/api/result.rb
td-client-0.8.80 lib/td/client/api/result.rb
td-client-0.8.79 lib/td/client/api/result.rb
td-client-0.8.78 lib/td/client/api/result.rb
td-client-0.9.0dev2 lib/td/client/api/result.rb