Class: MachineShop::DataSources

Inherits:
APIResource show all
Includes:
APIOperations::Create, APIOperations::List, APIOperations::Update
Defined in:
lib/machineshop/data_sources.rb

Instance Attribute Summary

Attributes inherited from MachineShopObject

#auth_token

Instance Method Summary collapse

Methods included from APIOperations::Update

#update

Methods included from APIOperations::Create

included

Methods included from APIOperations::List

included

Methods inherited from APIResource

class_name, #refresh, retrieve, url, #url

Methods inherited from MachineShopObject

#[], #[]=, #as_json, construct_from, #each, #initialize, #inspect, #keys, #refresh_from, #to_hash, #to_json, #to_s, #values

Constructor Details

This class inherits a constructor from MachineShop::MachineShopObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MachineShop::MachineShopObject

Instance Method Details

#deleteObject



24
25
26
# File 'lib/machineshop/data_sources.rb', line 24

def delete
  MachineShop.gem_delete("/platform/data_sources/#{self.id}?_type=#{self._type}", @auth_token,{})
end

#meters(filters = {}) ⇒ Object



19
20
21
22
# File 'lib/machineshop/data_sources.rb', line 19

def meters(filters={})
  filters.merge!(:device_instance_id => self.id)
  MachineShop::Meter.all(filters, @auth_token)
end

#report_count(params) ⇒ Object

Specific API calls



10
11
12
# File 'lib/machineshop/data_sources.rb', line 10

def report_count(params)      
  MachineShop.gem_get(report_count_url, @auth_token, params)
end

#reports(filters = {}) ⇒ Object



14
15
16
17
# File 'lib/machineshop/data_sources.rb', line 14

def reports(filters={})
  filters.merge!(:device_instance_id => self.id)
  MachineShop::Report.all(filters, @auth_token)
end