Module: TimestampAPI::ModelDefaultAPIMethods::ClassMethods
- Defined in:
- lib/timestamp_api/model_default_api_methods.rb
Instance Method Summary collapse
Instance Method Details
#all ⇒ Object
17 18 19 20 |
# File 'lib/timestamp_api/model_default_api_methods.rb', line 17 def all raise APIPathNotSet.new(self) if api_path.nil? TimestampAPI.request(:get, api_path) end |
#api_path(path = nil) ⇒ Object
13 14 15 |
# File 'lib/timestamp_api/model_default_api_methods.rb', line 13 def api_path(path = nil) path.nil? ? self.class_variable_get(:@@api_path) : self.class_variable_set(:@@api_path, path) end |
#find(id) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/timestamp_api/model_default_api_methods.rb', line 22 def find(id) return nil if id.nil? raise APIPathNotSet.new(self) if api_path.nil? TimestampAPI.request(:get, "#{api_path}/#{id}") rescue RestClient::ResourceNotFound raise ResourceNotFound.new(self, id) end |