Class: RfidApi::Action

Inherits:
Client
  • Object
show all
Defined in:
lib/rfid_api/action.rb

Instance Attribute Summary

Attributes inherited from Client

#destroyed

Class Method Summary collapse

Methods inherited from Client

all, #datetime, #destroy, #destroyed?, #errors, #errors=, #initialize, model_name, #new_record?, #persisted?, #read_attribute, resource_name, resource_name=, #save, #to_key, #to_param, #valid?, #write_attribute

Constructor Details

This class inherits a constructor from RfidApi::Client

Class Method Details

.create(device_id, attributes) ⇒ Object



10
11
12
13
# File 'lib/rfid_api/action.rb', line 10

def create(device_id, attributes)
  response = post("/devices/#{device_id}/#{plural_name}.#{format}", :body => { singular_name => attributes })
  resource(response, attributes)
end

.destroy(device_id, id) ⇒ Object



19
20
21
# File 'lib/rfid_api/action.rb', line 19

def destroy(device_id, id)
  resource delete("/devices/#{device_id}/#{plural_name}/#{id}.#{format}")
end

.find(device_id, id, options = {}) ⇒ Object



6
7
8
# File 'lib/rfid_api/action.rb', line 6

def find(device_id, id, options = {})
  resource get("/devices/#{device_id}/#{plural_name}/#{id}.#{format}", :query => options)
end

.update(device_id, id, attributes) ⇒ Object



15
16
17
# File 'lib/rfid_api/action.rb', line 15

def update(device_id, id, attributes)
  resource put("/devices/#{device_id}/#{plural_name}/#{id}.#{format}", :body => { singular_name => attributes })
end