Class: DBC::DbcObject
- Inherits:
-
Object
show all
- Defined in:
- lib/dbc/dbc_object.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(attributes) ⇒ DbcObject
Returns a new instance of DbcObject.
3
4
5
6
7
|
# File 'lib/dbc/dbc_object.rb', line 3
def initialize(attributes)
attributes.each do |key, value|
instance_variable_set("@#{key}", value)
end
end
|
Class Method Details
.all(options = {}) ⇒ Object
13
14
15
16
|
# File 'lib/dbc/dbc_object.rb', line 13
def self.all(options = {})
api_response = DBC.request(self.endpoint, options)
self.create_dbc_objects(api_response)
end
|
.endpoint(id = '') ⇒ Object
9
10
11
|
# File 'lib/dbc/dbc_object.rb', line 9
def self.endpoint(id = '')
'/' + id.to_s
end
|
.find(id) ⇒ Object
18
19
20
21
|
# File 'lib/dbc/dbc_object.rb', line 18
def self.find(id)
api_response = DBC.request(self.endpoint(id))
self.create_dbc_object(api_response)
end
|