Class: Access::Device
- Inherits:
-
Object
- Object
- Access::Device
- Defined in:
- lib/access/device.rb
Class Method Summary collapse
- .find(member_key, options = {}) ⇒ Object
- .process_batch(chunk) ⇒ Object
- .search(member_key, options = {}) ⇒ Object
Instance Method Summary collapse
-
#initialize(values) ⇒ Device
constructor
A new instance of Device.
Constructor Details
#initialize(values) ⇒ Device
Returns a new instance of Device.
8 9 10 11 12 13 |
# File 'lib/access/device.rb', line 8 def initialize(values) self.class.class_eval {attr_reader *values.keys } values.each do |attribute_name, attribute_value| self.instance_variable_set("@#{attribute_name}", attribute_value) end end |
Class Method Details
.find(member_key, options = {}) ⇒ Object
19 20 21 |
# File 'lib/access/device.rb', line 19 def self.find(member_key, = {}) Access::Api.new.find_device member_key, end |
.process_batch(chunk) ⇒ Object
4 5 6 |
# File 'lib/access/device.rb', line 4 def self.process_batch(chunk) chunk.map { |device| new(device) } end |
.search(member_key, options = {}) ⇒ Object
15 16 17 |
# File 'lib/access/device.rb', line 15 def self.search(member_key, = {}) Access::Api.new.search_devices member_key, end |