class Ubidots::Datasource

Attributes

context[R]
created_at[R]
description[R]
id[R]
last_activity[R]
name[R]
number_of_variables[R]
owner[R]
parent[R]
tags[R]
url[R]
variables_url[R]

Public Class Methods

new(bridge, data) click to toggle source
# File lib/ubidots/datasource.rb, line 7
def initialize(bridge, data)
  @bridge = bridge
  @id = data["id"]
  @name = data["name"]
  @url = data["url"]
  @last_activity = data["last_activity"]
  @tags = data["tags"]
  @description = data["description"]
  @created_at = data["created_at"]
  @owner = data["owner"]
  @parent = data["parent"]
  @context = data["context"]
  @variables_url = data["variables_url"]
  @number_of_variables = data["number_of_variables"]
end

Public Instance Methods

create_variable(data) click to toggle source
# File lib/ubidots/datasource.rb, line 35
def create_variable(data)
  endpoint = "datasources/#{@id}/variables"
  response = @bridge.post endpoint, data
  return Ubidots::Variable.new(@bridge, response)
end
get_variables() click to toggle source
# File lib/ubidots/datasource.rb, line 23
def get_variables
  endpoint = "datasources/#{@id}/variables"
  response = @bridge.get endpoint
  raw_items = response["results"]
  return @bridge.transform_to_variable_objects raw_items
end
remove_datasource() click to toggle source
# File lib/ubidots/datasource.rb, line 30
def remove_datasource
  endpoint = "datasources/#{@id}";
  @bridge.delete endpoint
end