Class: Freeagent::Timeslip

Inherits:
Base
  • Object
show all
Defined in:
lib/freeagent_api.rb

Overview

Timeslips

Class Method Summary collapse

Methods inherited from Base

authenticate

Class Method Details

.find(*arguments) ⇒ Object



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/freeagent_api.rb', line 96

def self.find(*arguments)
  scope   = arguments.slice!(0)
  options = arguments.slice!(0) || {}
  if options[:params] && options[:params][:from] && options[:params][:to]
    options[:params][:view] = options[:params][:from]+'_'+options[:params][:to]
    options[:params].delete(:from)
    options[:params].delete(:to)
  end

  case scope
    when :all   then find_every(options)
    when :first then find_every(options).first
    when :last  then find_every(options).last
    when :one   then find_one(options)
    else             find_single(scope, options)
  end
end