Class: Redmine::Cli::BaseResource
- Inherits:
-
ActiveResource::Base
- Object
- ActiveResource::Base
- Redmine::Cli::BaseResource
- Defined in:
- lib/redmine-cli/resources.rb
Class Method Summary collapse
- .fetch_all(params = {}) ⇒ Object
-
.find(*arguments) ⇒ Object
HACK: Redmine API isn’t ActiveResource-friendly out of the box, so we need to pass nometa=1 to all requests since we don’t care about the metadata that gets passed back in the top level attributes.
Class Method Details
.fetch_all(params = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/redmine-cli/resources.rb', line 26 def fetch_all(params = {}) limit = 100 offset = 0 resources = [] while((fetched_resources = self.all(:params => params.merge({:limit => limit, :offset => offset}))).any?) resources += fetched_resources offset += limit if fetched_resources.length < limit then break end end resources end |
.find(*arguments) ⇒ Object
HACK: Redmine API isn’t ActiveResource-friendly out of the box, so we need to pass nometa=1 to all requests since we don’t care about the metadata that gets passed back in the top level attributes.
18 19 20 21 22 23 24 |
# File 'lib/redmine-cli/resources.rb', line 18 def find(*arguments) arguments[1] = arguments[1] || {} arguments[1][:params] = arguments[1][:params] || {} arguments[1][:params][:nometa] = 1 super end |