Class: Ubidots::VariableService

Inherits:
Object
  • Object
show all
Defined in:
lib/ubidots/variable_service.rb

Class Method Summary collapse

Class Method Details

.retrieve_for_current_user ⇒ Object



9
10
11
12
13
# File 'lib/ubidots/variable_service.rb', line 9

def self.retrieve_for_current_user
  url = "#{Ubidots::API_URL}/variables/"
  response = RestClient.get url, { "X-UbidotsApiKey" => @@key }
  JSON.parse(response.body).to_collection_with_finders
end

.retrieve_from_datasource(source) ⇒ Object



3
4
5
6
7
# File 'lib/ubidots/variable_service.rb', line 3

def self.retrieve_from_datasource(source)
  url = "#{Ubidots::API_URL}/datasources/#{source.primary_key}/variables/"
  response = RestClient.get url, { "X-UbidotsApiKey" => @@key }
  JSON.parse(response.body).to_collection_with_finders
end