Skip to content

Instantly share code, notes, and snippets.

@jbritten
Created December 11, 2012 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbritten/4260275 to your computer and use it in GitHub Desktop.
Save jbritten/4260275 to your computer and use it in GitHub Desktop.
Creating Testers via the Prefinery API
attr_accessible :invitation_code
attr_accessor :invitation_code
before_validation :validate_invitation_code, :on => :create
def validate_invitation_code
tester = Prefinery::Tester.new(:beta_id => YOUR_BETA_ID)
tester.email = self.email
tester.invitation_code = self.invitation_code
tester.status = 'active'
if !tester.save
errors.add(:invitation_code, "is invalid")
false
end
true
end
Prefinery.configure do |config|
config.subdomain = 'YOUR_ACCOUNT_SUBDOMAIN'
config.api_key = 'YOUR_API_KEY'
end
gem 'prefinery'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment