Skip to content

Instantly share code, notes, and snippets.

@pnegri
Created October 1, 2012 01:46
Show Gist options
  • Save pnegri/3809001 to your computer and use it in GitHub Desktop.
Save pnegri/3809001 to your computer and use it in GitHub Desktop.
[feature/criar_conta] patricknegri@~/Desenvolvimento/buzap_app_old/app/models: cat assinatura.rb
class Assinatura < ActiveResource::Base
#self.site = "http://localhost:3001"
self.site = "http://assinaturas.iugu.com.br"
def self.api_key
'smallandsmart'
end
def self.find(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
#if not options.include? :params
options[:params] = Hash.new if options[:params].nil?
#end
options[:params][:api] = self.api_key
args.push(options)
super
end
def save
prefix_options[:api] = Assinatura.api_key
#self.attributes.delete :id
super
end
def destroy
prefix_options['api'] = Assinatura.api_key
super
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment