Class: Tito::Event
- Defined in:
- lib/tito/event.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
Class Method Details
.get(path) ⇒ Object
22 23 24 25 |
# File 'lib/tito/event.rb', line 22 def get(path) parts = path.split('/') where(account_id: parts[0]).find(parts[1]).first end |
.path(params = nil) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/tito/event.rb', line 27 def path(params=nil) prefix_path = '%{account_id}' path_params = params.delete(:path) || params parts = [].unshift(prefix_path % path_params.symbolize_keys) if !params[:id] parts << 'events' end File.join(*parts) rescue KeyError raise ArgumentError, "Please make sure to include account_id" end |
Instance Method Details
#account_id ⇒ Object
8 9 10 |
# File 'lib/tito/event.rb', line 8 def account_id attributes['account_id'] || attributes['account-id'] end |
#account_id=(val) ⇒ Object
12 13 14 |
# File 'lib/tito/event.rb', line 12 def account_id=(val) attributes['account_id'] = val end |
#security_token ⇒ Object
16 17 18 |
# File 'lib/tito/event.rb', line 16 def security_token attributes['security_token'] || attributes['security-token'] end |