lib/tito/event.rb in tito-0.1.1 vs lib/tito/event.rb in tito-0.1.3
- old
+ new
@@ -1,11 +1,24 @@
module Tito
class Event < Base
belongs_to :account
property :title, type: :string
+ property :security_token, type: :string
+ def account_id
+ attributes['account_id'] || attributes['account-id']
+ end
+
+ def account_id=(val)
+ attributes['account_id'] = val
+ end
+
+ def security_token
+ attributes['security_token'] || attributes['security-token']
+ end
+
class << self
def get(path)
parts = path.split('/')
where(account_id: parts[0]).find(parts[1]).first
@@ -17,28 +30,11 @@
parts = [].unshift(prefix_path % path_params.symbolize_keys)
if !params[:id]
parts << 'events'
end
File.join(*parts)
- # parts = ['%{account_id}', '%{id}']
- # if params
- # path_params = params.delete(:path) || params
- # parts.unshift(_prefix_path % path_params.symbolize_keys)
- # else
- # parts.unshift(_prefix_path)
- # end
- # parts.reject!{|part| part == "" }
- # File.join(*parts)
rescue KeyError
raise ArgumentError, "Please make sure to include account_id"
end
-
- # def path(params=nil)
- # if params[:id].blank?
- # ['%account_id', 'events'].compact.join('/')
- # else
- # '%account_id'
- # end
- # end
end
end
end
\ No newline at end of file