Class: NoiteHoje::Resource

Inherits:
ActiveResource::Base
  • Object
show all
Defined in:
lib/noitehoje/resource.rb

Direct Known Subclasses

Event, Venue

Constant Summary collapse

@@auth_token =
ENV['NOITEHOJE_AUTH_TOKEN']

Class Method Summary collapse

Class Method Details

.append_auth_token_to_params(*arguments) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/noitehoje/resource.rb', line 17

def append_auth_token_to_params(*arguments)
  opts = arguments.last.is_a?(Hash) ? arguments.pop : {}
  opts = opts.has_key?(:params) ? opts : opts.merge(:params => {}) 
  opts[:params] = opts[:params].merge(:auth_token => @@auth_token)
  arguments << opts
  arguments
end

.find(*arguments) ⇒ Object



12
13
14
15
# File 'lib/noitehoje/resource.rb', line 12

def find(*arguments)
  arguments = append_auth_token_to_params(*arguments)
  super(*arguments)
end